JAL-1933 desktop preferences for occupancy
authorJim Procter <jprocter@issues.jalview.org>
Thu, 27 Apr 2017 16:34:47 +0000 (17:34 +0100)
committerJim Procter <jprocter@issues.jalview.org>
Thu, 27 Apr 2017 16:34:47 +0000 (17:34 +0100)
src/jalview/gui/Preferences.java
src/jalview/jbgui/GPreferences.java

index cf80a6d..cccdd2e 100755 (executable)
@@ -107,6 +107,8 @@ public class Preferences extends GPreferences
 
   public static final String SHOW_AUTOCALC_ABOVE = "SHOW_AUTOCALC_ABOVE";
 
+  public static final String SHOW_OCCUPANCY = "SHOW_OCCUPANCY";
+
   private static final int MIN_FONT_SIZE = 1;
 
   private static final int MAX_FONT_SIZE = 30;
@@ -210,6 +212,7 @@ public class Preferences extends GPreferences
     openoverv.setSelected(Cache.getDefault("SHOW_OVERVIEW", false));
     showUnconserved
             .setSelected(Cache.getDefault("SHOW_UNCONSERVED", false));
+    showOccupancy.setSelected(Cache.getDefault(SHOW_OCCUPANCY, false));
     showGroupConsensus.setSelected(Cache.getDefault("SHOW_GROUP_CONSENSUS",
             false));
     showGroupConservation.setSelected(Cache.getDefault(
@@ -572,6 +575,8 @@ public class Preferences extends GPreferences
             Boolean.toString(idItalics.isSelected()));
     Cache.applicationProperties.setProperty("SHOW_UNCONSERVED",
             Boolean.toString(showUnconserved.isSelected()));
+    Cache.applicationProperties.setProperty(SHOW_OCCUPANCY,
+            Boolean.toString(showOccupancy.isSelected()));
     Cache.applicationProperties.setProperty("SHOW_GROUP_CONSENSUS",
             Boolean.toString(showGroupConsensus.isSelected()));
     Cache.applicationProperties.setProperty("SHOW_GROUP_CONSERVATION",
@@ -851,6 +856,7 @@ public class Preferences extends GPreferences
     conservation.setEnabled(annotations.isSelected());
     quality.setEnabled(annotations.isSelected());
     identity.setEnabled(annotations.isSelected());
+    showOccupancy.setEnabled(annotations.isSelected());
     showGroupConsensus.setEnabled(annotations.isSelected());
     showGroupConservation.setEnabled(annotations.isSelected());
     showConsensHistogram.setEnabled(annotations.isSelected()
index dda06b4..1ad95dd 100755 (executable)
@@ -101,6 +101,8 @@ public class GPreferences extends JPanel
 
   protected JComboBox<String> fontNameCB = new JComboBox<String>();
 
+  protected JCheckBox showOccupancy = new JCheckBox();
+
   protected JCheckBox showUnconserved = new JCheckBox();
 
   protected JCheckBox idItalics = new JCheckBox();
@@ -1174,6 +1176,13 @@ public class GPreferences extends JPanel
     identity.setHorizontalTextPosition(SwingConstants.LEFT);
     identity.setSelected(true);
     identity.setText(MessageManager.getString("label.consensus"));
+    showOccupancy.setFont(LABEL_FONT);
+    showOccupancy.setEnabled(false);
+    showOccupancy.setHorizontalAlignment(SwingConstants.RIGHT);
+    showOccupancy.setHorizontalTextPosition(SwingConstants.LEFT);
+    showOccupancy.setSelected(true);
+    showOccupancy.setText(MessageManager.getString("label.occupancy"));
+
     JLabel showGroupbits = new JLabel();
     showGroupbits.setFont(LABEL_FONT);
     showGroupbits.setHorizontalAlignment(SwingConstants.RIGHT);
@@ -1228,10 +1237,10 @@ public class GPreferences extends JPanel
             .getString("label.database_references"));
     annotations.setFont(LABEL_FONT);
     annotations.setHorizontalAlignment(SwingConstants.RIGHT);
-    annotations.setHorizontalTextPosition(SwingConstants.LEADING);
+    annotations.setHorizontalTextPosition(SwingConstants.LEFT);
     annotations.setSelected(true);
     annotations.setText(MessageManager.getString("label.show_annotations"));
-    annotations.setBounds(new Rectangle(169, 12, 200, 23));
+    // annotations.setBounds(new Rectangle(169, 12, 200, 23));
     annotations.addActionListener(new ActionListener()
     {
       @Override
@@ -1358,11 +1367,13 @@ public class GPreferences extends JPanel
     sortAutocalc.setBounds(new Rectangle(290, 285, 165, 21));
 
     JPanel annsettingsPanel = new JPanel();
-    annsettingsPanel.setBounds(new Rectangle(173, 34, 320, 75));
+    annsettingsPanel.setBounds(new Rectangle(173, 13, 320, 96));
     annsettingsPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
     annsettingsPanel.setBorder(new EtchedBorder());
     visualTab.add(annsettingsPanel);
     Border jb = new EmptyBorder(1, 1, 4, 5);
+    annotations.setBorder(jb);
+    showOccupancy.setBorder(jb);
     quality.setBorder(jb);
     conservation.setBorder(jb);
     identity.setBorder(jb);
@@ -1374,17 +1385,26 @@ public class GPreferences extends JPanel
     showConsensLogo.setBorder(jb);
 
     JPanel autoAnnotSettings = new JPanel();
-    autoAnnotSettings.setLayout(new GridLayout(3, 3));
     annsettingsPanel.add(autoAnnotSettings);
+    autoAnnotSettings.setLayout(new GridLayout(0, 2));
+    autoAnnotSettings.add(annotations);
     autoAnnotSettings.add(quality);
+    // second row of autoannotation box
+    autoAnnotSettings = new JPanel();
+    annsettingsPanel.add(autoAnnotSettings);
+
+    autoAnnotSettings.setLayout(new GridLayout(0, 3));
     autoAnnotSettings.add(conservation);
     autoAnnotSettings.add(identity);
+    autoAnnotSettings.add(showOccupancy);
     autoAnnotSettings.add(showGroupbits);
     autoAnnotSettings.add(showGroupConservation);
     autoAnnotSettings.add(showGroupConsensus);
     autoAnnotSettings.add(showConsensbits);
     autoAnnotSettings.add(showConsensHistogram);
     autoAnnotSettings.add(showConsensLogo);
+    
+    
 
     JPanel tooltipSettings = new JPanel();
     tooltipSettings.setBorder(new TitledBorder(MessageManager
@@ -1433,7 +1453,6 @@ public class GPreferences extends JPanel
     jPanel2.add(sortAnnLabel);
     jPanel2.add(startupCheckbox);
     visualTab.add(jPanel2);
-    visualTab.add(annotations);
     visualTab.add(startupFileTextfield);
     visualTab.add(sortby);
     visualTab.add(sortAnnBy);