Added configuration for plot hardware acceleration and heavyweight popup menus
This commit is contained in:
@@ -38,9 +38,13 @@ public class Installer extends ModuleInstall {
|
||||
// Initialize scan engine
|
||||
File home = p.getHome();
|
||||
System.setProperty(ApplicationConfigurator.FDA_HOME_ARGUMENT, home.getAbsolutePath());
|
||||
ch.psi.plot.jzy3d.MatrixPlot.setHardwareAccelerated(p.getHardwareAcceleration());
|
||||
ch.psi.plot.jzy3d.MatrixPlot.setLighweightPopups(p.getLightweightPopups());
|
||||
|
||||
ApplicationConfigurator c = new ApplicationConfigurator();
|
||||
c.initializeApplication();
|
||||
|
||||
|
||||
|
||||
// Register a change listener to reconfigure scan engine when the home directory changes
|
||||
p.addPropertyChangeListener(new PropertyChangeListener() {
|
||||
@@ -49,7 +53,6 @@ public class Installer extends ModuleInstall {
|
||||
public void propertyChange(PropertyChangeEvent pce) {
|
||||
if (pce.getPropertyName().equals(Preferences.VISUALIZATION_LAYOUT_CHANGED)) {
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
final PlotVisualizerTopComponent tc = PlotVisualizerTopComponent.findInstance();
|
||||
@@ -58,7 +61,15 @@ public class Installer extends ModuleInstall {
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (pce.getPropertyName().equals(Preferences.HARDWARE_ACCELERATION_CHANGED)) {
|
||||
ch.psi.plot.jzy3d.MatrixPlot.setHardwareAccelerated((Boolean)pce.getNewValue());
|
||||
return;
|
||||
}
|
||||
if (pce.getPropertyName().equals(Preferences.LIGHTWEIGHT_POPUPS_CHANGED)) {
|
||||
ch.psi.plot.jzy3d.MatrixPlot.setLighweightPopups((Boolean)pce.getNewValue());
|
||||
return;
|
||||
}
|
||||
|
||||
if (pce.getPropertyName().equals(Preferences.HOME_CHANGED)) {
|
||||
File h = (File) pce.getNewValue();
|
||||
System.setProperty(ApplicationConfigurator.FDA_HOME_ARGUMENT, h.getAbsolutePath());
|
||||
|
||||
@@ -37,6 +37,8 @@ public class DefaultPreferences implements Preferences {
|
||||
private final String PROPERTY_LINE_PLOT_IMPL = "ch.psi.fda.line_plot_impl";
|
||||
private final String PROPERTY_MATRIX_PLOT_IMPL = "ch.psi.fda.matrix_plot_impl";
|
||||
private final String PROPERTY_VISUALIZATION_LAYOUT= "ch.psi.fda.visualization_layout";
|
||||
private final String PROPERTY_HARDWARE_ACCELERATION = "ch.psi.fda.hardware_acceleration";
|
||||
private final String PROPERTY_LIGHTWEIGHT_POPUPS = "ch.psi.fda.lightweight_popups";
|
||||
|
||||
@Override
|
||||
public void setHome(String path){
|
||||
@@ -99,6 +101,37 @@ public class DefaultPreferences implements Preferences {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHardwareAcceleration(Boolean value){
|
||||
this.pss.firePropertyChange(Preferences.HARDWARE_ACCELERATION_CHANGED, this.getHardwareAcceleration(), value);
|
||||
NbPreferences.forModule(PreferencesPanel.class).put(PROPERTY_HARDWARE_ACCELERATION, value.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean getHardwareAcceleration(){
|
||||
try{
|
||||
return Boolean.valueOf(NbPreferences.forModule(PreferencesPanel.class).get(PROPERTY_HARDWARE_ACCELERATION, Boolean.TRUE.toString()));
|
||||
}
|
||||
catch (Exception ex){
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLightweightPopups(Boolean value){
|
||||
this.pss.firePropertyChange(Preferences.LIGHTWEIGHT_POPUPS_CHANGED, this.getLightweightPopups(), value);
|
||||
NbPreferences.forModule(PreferencesPanel.class).put(PROPERTY_LIGHTWEIGHT_POPUPS, value.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean getLightweightPopups(){
|
||||
try{
|
||||
return Boolean.valueOf(NbPreferences.forModule(PreferencesPanel.class).get(PROPERTY_LIGHTWEIGHT_POPUPS, Boolean.FALSE.toString()));
|
||||
}
|
||||
catch (Exception ex){
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
|
||||
<AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,32,0,0,1,-70"/>
|
||||
<AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,38,0,0,1,-70"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
|
||||
@@ -26,7 +26,7 @@
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
@@ -36,6 +36,7 @@
|
||||
</Group>
|
||||
<Group type="102" attributes="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="checkLightweightPopups" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="jLabel2" linkSize="1" min="-2" max="-2" attributes="0"/>
|
||||
@@ -52,6 +53,7 @@
|
||||
<EmptySpace type="separate" max="-2" attributes="0"/>
|
||||
<Component id="comboLayout" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Component id="checkHardwareAcceleration" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
@@ -85,7 +87,11 @@
|
||||
<Component id="jLabel4" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="comboLayout" alignment="0" min="-2" pref="20" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace min="-2" pref="132" max="-2" attributes="0"/>
|
||||
<EmptySpace type="separate" max="-2" attributes="0"/>
|
||||
<Component id="checkHardwareAcceleration" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="checkLightweightPopups" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="74" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
@@ -172,6 +178,20 @@
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JCheckBox" name="checkHardwareAcceleration">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="ch/psi/fda/ui/preferences/Bundle.properties" key="PreferencesPanel.checkHardwareAcceleration.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JCheckBox" name="checkLightweightPopups">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="ch/psi/fda/ui/preferences/Bundle.properties" key="PreferencesPanel.checkLightweightPopups.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
|
||||
@@ -71,6 +71,8 @@ final class PreferencesPanel extends javax.swing.JPanel {
|
||||
comboMatrix = new javax.swing.JComboBox();
|
||||
jLabel4 = new javax.swing.JLabel();
|
||||
comboLayout = new javax.swing.JComboBox();
|
||||
checkHardwareAcceleration = new javax.swing.JCheckBox();
|
||||
checkLightweightPopups = new javax.swing.JCheckBox();
|
||||
|
||||
setLayout(new java.awt.BorderLayout());
|
||||
|
||||
@@ -97,6 +99,10 @@ final class PreferencesPanel extends javax.swing.JPanel {
|
||||
|
||||
comboLayout.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
|
||||
|
||||
org.openide.awt.Mnemonics.setLocalizedText(checkHardwareAcceleration, org.openide.util.NbBundle.getMessage(PreferencesPanel.class, "PreferencesPanel.checkHardwareAcceleration.text")); // NOI18N
|
||||
|
||||
org.openide.awt.Mnemonics.setLocalizedText(checkLightweightPopups, org.openide.util.NbBundle.getMessage(PreferencesPanel.class, "PreferencesPanel.checkLightweightPopups.text")); // NOI18N
|
||||
|
||||
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
|
||||
jPanel1.setLayout(jPanel1Layout);
|
||||
jPanel1Layout.setHorizontalGroup(
|
||||
@@ -110,6 +116,7 @@ final class PreferencesPanel extends javax.swing.JPanel {
|
||||
.addComponent(jButton1))
|
||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(checkLightweightPopups)
|
||||
.addComponent(jLabel1)
|
||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||
.addComponent(jLabel2)
|
||||
@@ -122,7 +129,8 @@ final class PreferencesPanel extends javax.swing.JPanel {
|
||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||
.addComponent(jLabel4)
|
||||
.addGap(18, 18, 18)
|
||||
.addComponent(comboLayout, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
|
||||
.addComponent(comboLayout, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addComponent(checkHardwareAcceleration))
|
||||
.addGap(0, 0, Short.MAX_VALUE)))
|
||||
.addContainerGap())
|
||||
);
|
||||
@@ -150,7 +158,11 @@ final class PreferencesPanel extends javax.swing.JPanel {
|
||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jLabel4)
|
||||
.addComponent(comboLayout, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGap(132, 132, 132))
|
||||
.addGap(18, 18, 18)
|
||||
.addComponent(checkHardwareAcceleration)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(checkLightweightPopups)
|
||||
.addGap(74, 74, 74))
|
||||
);
|
||||
|
||||
add(jPanel1, java.awt.BorderLayout.CENTER);
|
||||
@@ -172,6 +184,8 @@ final class PreferencesPanel extends javax.swing.JPanel {
|
||||
this.comboLine.setSelectedItem(Lookup.getDefault().lookup(Preferences.class).getLinePlotImpl());
|
||||
this.comboMatrix.setSelectedItem(Lookup.getDefault().lookup(Preferences.class).getMatrixPlotImpl());
|
||||
this.comboLayout.setSelectedItem(Lookup.getDefault().lookup(Preferences.class).getVisualizationLayout());
|
||||
this.checkHardwareAcceleration.setSelected(Lookup.getDefault().lookup(Preferences.class).getHardwareAcceleration());
|
||||
this.checkLightweightPopups.setSelected(Lookup.getDefault().lookup(Preferences.class).getLightweightPopups());
|
||||
|
||||
}
|
||||
|
||||
@@ -180,6 +194,8 @@ final class PreferencesPanel extends javax.swing.JPanel {
|
||||
Lookup.getDefault().lookup(Preferences.class).setLinePlotImpl(String.valueOf(comboLine.getSelectedItem()));
|
||||
Lookup.getDefault().lookup(Preferences.class).setMatrixPlotImpl(String.valueOf(comboMatrix.getSelectedItem()));
|
||||
Lookup.getDefault().lookup(Preferences.class).setVisualizationLayout((VisualizationLayout) comboLayout.getSelectedItem());
|
||||
Lookup.getDefault().lookup(Preferences.class).setHardwareAcceleration(checkHardwareAcceleration.isSelected());
|
||||
Lookup.getDefault().lookup(Preferences.class).setLightweightPopups(checkLightweightPopups.isSelected());
|
||||
|
||||
}
|
||||
|
||||
@@ -188,6 +204,8 @@ final class PreferencesPanel extends javax.swing.JPanel {
|
||||
return (new File(this.jTextFieldApplicationHome.getText()).isDirectory());
|
||||
}
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JCheckBox checkHardwareAcceleration;
|
||||
private javax.swing.JCheckBox checkLightweightPopups;
|
||||
private javax.swing.JComboBox comboLayout;
|
||||
private javax.swing.JComboBox comboLine;
|
||||
private javax.swing.JComboBox comboMatrix;
|
||||
|
||||
@@ -31,6 +31,8 @@ public interface Preferences {
|
||||
public static final String LINE_PLOT_IMPL_CHANGED = "line_plot_impl_changed";
|
||||
public static final String MATRIX_PLOT_IMPL_CHANGED = "matrix_plot_impl_changed";
|
||||
public static final String VISUALIZATION_LAYOUT_CHANGED = "visualization_layout_changed";
|
||||
public static final String HARDWARE_ACCELERATION_CHANGED = "hardware_acceleration_changed";
|
||||
public static final String LIGHTWEIGHT_POPUPS_CHANGED = "lightweight_popups_changed";
|
||||
|
||||
|
||||
public void setHome(String path);
|
||||
@@ -54,4 +56,10 @@ public interface Preferences {
|
||||
|
||||
public void setVisualizationLayout(VisualizationLayout layout);
|
||||
public VisualizationLayout getVisualizationLayout();
|
||||
|
||||
public void setHardwareAcceleration(Boolean value);
|
||||
public Boolean getHardwareAcceleration();
|
||||
|
||||
public void setLightweightPopups(Boolean value);
|
||||
public Boolean getLightweightPopups();
|
||||
}
|
||||
|
||||
@@ -11,3 +11,5 @@ PreferencesPanel.jTextFieldApplicationHome.text=
|
||||
PreferencesPanel.jLabel2.text=Line Plot:
|
||||
PreferencesPanel.jLabel3.text=Matrix Plot:
|
||||
PreferencesPanel.jLabel4.text=Visualization Layout
|
||||
PreferencesPanel.checkHardwareAcceleration.text=Hardware Acceleration
|
||||
PreferencesPanel.checkLightweightPopups.text=Lightweight Popup Menus
|
||||
|
||||
Reference in New Issue
Block a user