JAL-1632 i18n for warning messages
[jalview.git] / src / jalview / gui / Preferences.java
index a61279a..cccdd2e 100755 (executable)
@@ -29,7 +29,9 @@ import jalview.io.JalviewFileChooser;
 import jalview.io.JalviewFileView;
 import jalview.jbgui.GPreferences;
 import jalview.jbgui.GSequenceLink;
-import jalview.schemes.ColourSchemeProperty;
+import jalview.schemes.ColourSchemeI;
+import jalview.schemes.ColourSchemes;
+import jalview.schemes.ResidueColourScheme;
 import jalview.urls.UrlLinkTableModel;
 import jalview.urls.api.UrlProviderFactoryI;
 import jalview.urls.api.UrlProviderI;
@@ -105,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;
@@ -208,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(
@@ -284,12 +289,16 @@ public class Preferences extends GPreferences
     /*
      * Set Colours tab defaults
      */
-    for (int i = ColourSchemeProperty.FIRST_COLOUR; i <= ColourSchemeProperty.LAST_COLOUR; i++)
+    protColour.addItem(ResidueColourScheme.NONE);
+    nucColour.addItem(ResidueColourScheme.NONE);
+    for (ColourSchemeI cs : ColourSchemes.getInstance().getColourSchemes())
     {
-      protColour.addItem(ColourSchemeProperty.getColourName(i));
-      nucColour.addItem(ColourSchemeProperty.getColourName(i));
+      String name = cs.getSchemeName();
+      protColour.addItem(name);
+      nucColour.addItem(name);
     }
-    String oldProp = Cache.getDefault(DEFAULT_COLOUR, "None");
+    String oldProp = Cache.getDefault(DEFAULT_COLOUR,
+            ResidueColourScheme.NONE);
     String newProp = Cache.getDefault(DEFAULT_COLOUR_PROT, null);
     protColour.setSelectedItem(newProp != null ? newProp : oldProp);
     newProp = Cache.getDefault(DEFAULT_COLOUR_NUC, null);
@@ -459,8 +468,6 @@ public class Preferences extends GPreferences
 
     useProxy.setSelected(Cache.getDefault("USE_PROXY", false));
     useProxy_actionPerformed(); // make sure useProxy is correctly initialised
-    proxyServerTB.setEnabled(useProxy.isSelected());
-    proxyPortTB.setEnabled(useProxy.isSelected());
     proxyServerTB.setText(Cache.getDefault("PROXY_SERVER", ""));
     proxyPortTB.setText(Cache.getDefault("PROXY_PORT", ""));
 
@@ -568,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",
@@ -847,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()