Jalview-JS/JAL-3253-applet adding more applet parameters and setting
[jalview.git] / src / jalview / gui / Preferences.java
index facc826..62c1239 100755 (executable)
@@ -84,6 +84,10 @@ import ext.edu.ucsf.rbvi.strucviz2.StructureManager;
 @SuppressWarnings("serial")
 public class Preferences extends GPreferences
 {
+  public static final String ANNOTATIONCOLOUR_MAX = "ANNOTATIONCOLOUR_MAX";
+
+  public static final String ANNOTATIONCOLOUR_MIN = "ANNOTATIONCOLOUR_MIN";
+
   public static final String ENABLE_SPLIT_FRAME = "ENABLE_SPLIT_FRAME";
 
   public static final String SCALE_PROTEIN_TO_CDNA = "SCALE_PROTEIN_TO_CDNA";
@@ -106,12 +110,42 @@ public class Preferences extends GPreferences
 
   public static final String CHIMERA_PATH = "CHIMERA_PATH";
 
+  public static final String SORT_ALIGNMENT = "SORT_ALIGNMENT";
+
+  public static final String WRAP_ALIGNMENT = "WRAP_ALIGNMENT";
+
   public static final String SORT_ANNOTATIONS = "SORT_ANNOTATIONS";
 
+  public static final String SORT_BY_TREE = "SORT_BY_TREE";
+
+  public static final String SHOW_ANNOTATIONS = "SHOW_ANNOTATIONS";
+
   public static final String SHOW_AUTOCALC_ABOVE = "SHOW_AUTOCALC_ABOVE";
 
+  public static final String SHOW_CONSERVATION = "SHOW_CONSERVATION";
+
+  public static final String SHOW_QUALITY = "SHOW_QUALITY";
+
+  public static final String SHOW_CONSENSUS_HISTOGRAM = "SHOW_CONSENSUS_HISTOGRAM";
+
+  public static final String SHOW_CONSENSUS = "SHOW_CONSENSUS";
+
+  public static final String SHOW_CONSENSUS_LOGO = "SHOW_CONSENSUS_LOGO";
+
+  public static final String SHOW_GROUP_CONSENSUS = "SHOW_GROUP_CONSENSUS";
+
+  public static final String SHOW_GROUP_CONSERVATION = "SHOW_GROUP_CONSERVATION";
+
+  public static final String NORMALISE_CONSENSUS_LOGO = "NORMALISE_CONSENSUS_LOGO";
+
+  public static final String NORMALISE_LOGO = "NORMALISE_LOGO";
+
   public static final String SHOW_OCCUPANCY = "SHOW_OCCUPANCY";
 
+  public static final String SHOW_OVERVIEW = "SHOW_OVERVIEW";
+
+  public static final String SHOW_UNCONSERVED = "SHOW_UNCONSERVED";
+
   public static final String SHOW_OV_HIDDEN_AT_START = "SHOW_OV_HIDDEN_AT_START";
 
   public static final String USE_LEGACY_GAP = "USE_LEGACY_GAP";
@@ -221,21 +255,21 @@ public class Preferences extends GPreferences
     fullScreen.setSelected(Cache.getDefault("SHOW_FULLSCREEN", false));
     annotations.setSelected(Cache.getDefault("SHOW_ANNOTATIONS", true));
 
-    conservation.setSelected(Cache.getDefault("SHOW_CONSERVATION", true));
-    quality.setSelected(Cache.getDefault("SHOW_QUALITY", true));
+    conservation.setSelected(Cache.getDefault(SHOW_CONSERVATION, true));
+    quality.setSelected(Cache.getDefault(SHOW_QUALITY, true));
     identity.setSelected(Cache.getDefault("SHOW_IDENTITY", true));
-    openoverv.setSelected(Cache.getDefault("SHOW_OVERVIEW", false));
+    openoverv.setSelected(Cache.getDefault(SHOW_OVERVIEW, false));
     showUnconserved
-            .setSelected(Cache.getDefault("SHOW_UNCONSERVED", false));
+            .setSelected(Cache.getDefault(SHOW_UNCONSERVED, false));
     showOccupancy.setSelected(Cache.getDefault(SHOW_OCCUPANCY, false));
     showGroupConsensus
-            .setSelected(Cache.getDefault("SHOW_GROUP_CONSENSUS", false));
+            .setSelected(Cache.getDefault(SHOW_GROUP_CONSENSUS, false));
     showGroupConservation.setSelected(
-            Cache.getDefault("SHOW_GROUP_CONSERVATION", false));
+            Cache.getDefault(SHOW_GROUP_CONSERVATION, false));
     showConsensHistogram.setSelected(
-            Cache.getDefault("SHOW_CONSENSUS_HISTOGRAM", true));
+            Cache.getDefault(SHOW_CONSENSUS_HISTOGRAM, true));
     showConsensLogo
-            .setSelected(Cache.getDefault("SHOW_CONSENSUS_LOGO", false));
+            .setSelected(Cache.getDefault(SHOW_CONSENSUS_LOGO, false));
     showNpTooltip
             .setSelected(Cache.getDefault("SHOW_NPFEATS_TOOLTIP", true));
     showDbRefTooltip
@@ -278,7 +312,7 @@ public class Preferences extends GPreferences
     sortby.addItem("No sort");
     sortby.addItem("Id");
     sortby.addItem("Pairwise Identity");
-    sortby.setSelectedItem(Cache.getDefault("SORT_ALIGNMENT", "No sort"));
+    sortby.setSelectedItem(Cache.getDefault(SORT_ALIGNMENT, "No sort"));
 
     sortAnnBy.addItem(SequenceAnnotationOrder.NONE.toString());
     sortAnnBy
@@ -319,9 +353,9 @@ public class Preferences extends GPreferences
     newProp = Cache.getDefault(DEFAULT_COLOUR_NUC, null);
     nucColour.setSelectedItem(newProp != null ? newProp : oldProp);
     minColour.setBackground(
-            Cache.getDefaultColour("ANNOTATIONCOLOUR_MIN", Color.orange));
+            Cache.getDefaultColour(ANNOTATIONCOLOUR_MIN, Color.orange));
     maxColour.setBackground(
-            Cache.getDefaultColour("ANNOTATIONCOLOUR_MAX", Color.red));
+            Cache.getDefaultColour(ANNOTATIONCOLOUR_MAX, Color.red));
 
     /*
      * Set overview panel defaults
@@ -540,7 +574,7 @@ public class Preferences extends GPreferences
     autoCalculateConsCheck
             .setSelected(Cache.getDefault("AUTO_CALC_CONSENSUS", true));
     padGaps.setSelected(Cache.getDefault("PAD_GAPS", false));
-    sortByTree.setSelected(Cache.getDefault("SORT_BY_TREE", false));
+    sortByTree.setSelected(Cache.getDefault(SORT_BY_TREE, false));
 
     annotations_actionPerformed(null); // update the display of the annotation
                                        // settings
@@ -612,9 +646,9 @@ public class Preferences extends GPreferences
             Boolean.toString(openoverv.isSelected()));
     Cache.setPropertyNoSave("SHOW_ANNOTATIONS",
             Boolean.toString(annotations.isSelected()));
-    Cache.setPropertyNoSave("SHOW_CONSERVATION",
+    Cache.setPropertyNoSave(SHOW_CONSERVATION,
             Boolean.toString(conservation.isSelected()));
-    Cache.setPropertyNoSave("SHOW_QUALITY",
+    Cache.setPropertyNoSave(SHOW_QUALITY,
             Boolean.toString(quality.isSelected()));
     Cache.setPropertyNoSave("SHOW_IDENTITY",
             Boolean.toString(identity.isSelected()));
@@ -635,13 +669,13 @@ public class Preferences extends GPreferences
             Boolean.toString(showUnconserved.isSelected()));
     Cache.setPropertyNoSave(SHOW_OCCUPANCY,
             Boolean.toString(showOccupancy.isSelected()));
-    Cache.setPropertyNoSave("SHOW_GROUP_CONSENSUS",
+    Cache.setPropertyNoSave(SHOW_GROUP_CONSENSUS,
             Boolean.toString(showGroupConsensus.isSelected()));
-    Cache.setPropertyNoSave("SHOW_GROUP_CONSERVATION",
+    Cache.setPropertyNoSave(SHOW_GROUP_CONSERVATION,
             Boolean.toString(showGroupConservation.isSelected()));
-    Cache.setPropertyNoSave("SHOW_CONSENSUS_HISTOGRAM",
+    Cache.setPropertyNoSave(SHOW_CONSENSUS_HISTOGRAM,
             Boolean.toString(showConsensHistogram.isSelected()));
-    Cache.setPropertyNoSave("SHOW_CONSENSUS_LOGO",
+    Cache.setPropertyNoSave(SHOW_CONSENSUS_LOGO,
             Boolean.toString(showConsensLogo.isSelected()));
     Cache.setPropertyNoSave("ANTI_ALIAS",
             Boolean.toString(smoothFont.isSelected()));
@@ -660,7 +694,7 @@ public class Preferences extends GPreferences
     Cache.setPropertyNoSave("SHOW_STARTUP_FILE",
             Boolean.toString(startupCheckbox.isSelected()));
 
-    Cache.setPropertyNoSave("SORT_ALIGNMENT",
+    Cache.setPropertyNoSave(SORT_ALIGNMENT,
             sortby.getSelectedItem().toString());
 
     // convert description of sort order to enum name for save
@@ -683,9 +717,9 @@ public class Preferences extends GPreferences
             protColour.getSelectedItem().toString());
     Cache.setPropertyNoSave(DEFAULT_COLOUR_NUC,
             nucColour.getSelectedItem().toString());
-    Cache.setColourProperty("ANNOTATIONCOLOUR_MIN",
+    Cache.setColourProperty(ANNOTATIONCOLOUR_MIN,
             minColour.getBackground());
-    Cache.setColourProperty("ANNOTATIONCOLOUR_MAX",
+    Cache.setColourProperty(ANNOTATIONCOLOUR_MAX,
             maxColour.getBackground());
 
     /*
@@ -871,6 +905,43 @@ public class Preferences extends GPreferences
     }
   }
 
+  public static void setAppletDefaults()
+  {
+
+    // http://www.jalview.org/old/v2_8/examples/appletParameters.html
+
+    // showConservation true or false Default is true.
+    // showQuality true or false Default is true.
+    // showConsensus true or false Default is true.
+    // showFeatureSettings true or false Shows the feature settings window when
+    // startin
+    // showTreeBootstraps true or false (default is true) show or hide branch
+    // bootstraps
+    // showTreeDistances true or false (default is true) show or hide branch
+    // lengths
+    // showUnlinkedTreeNodes true or false (default is false) indicate if
+    // unassociated nodes should be highlighted in the tree view
+    // showUnconserved true of false (default is false) When true, only gaps and
+    // symbols different to the consensus sequence ions of the alignment
+    // showGroupConsensus true of false (default is false) When true, shows
+    // consensus annotation row for any groups on the alignment. (since 2.7)
+    // showGroupConservation true of false (default is false) When true, shows
+    // amino-acid property conservation annotation row for any groups on the
+    // showConsensusHistogram true of false (default is true) When true, shows
+    // the percentage occurence of the consensus symbol for each column as a
+    // showSequenceLogo true of false (default is false) When true, shows a
+    // sequence logo above the consensus sequence (overlaid above the Consensus
+
+    Cache.setPropertyNoSave(SHOW_CONSERVATION, "true");
+    Cache.setPropertyNoSave(SHOW_QUALITY, "false");
+    Cache.setPropertyNoSave(SHOW_CONSENSUS, "true");
+    Cache.setPropertyNoSave("SHOW_UNCONSERVED", "false");
+    Cache.setPropertyNoSave("SHOW_GROUP_CONSERVATION", "false");
+    Cache.setPropertyNoSave("SHOW_GROUP_CONCENSUS", "false");
+
+    // TODO -- just a start here
+  }
+
   /**
    * Do any necessary validation before saving settings. Return focus to the
    * first tab which fails validation.