Jalview-JS/JAL-3253-applet adding more applet parameters and setting
[jalview.git] / src / jalview / bin / AppletParams.java
index 290ae01..86546a6 100644 (file)
@@ -1,5 +1,7 @@
 package jalview.bin;
 
+import jalview.gui.Preferences;
+
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Vector;
@@ -15,7 +17,8 @@ public class AppletParams extends HashMap<String, String>
 {
 
   private final static String[] params = { "alignpdbfiles",
-      "ANNOTATIONCOLOUR_MAX", "ANNOTATIONCOLOUR_MIN", "annotations",
+      Preferences.ANNOTATIONCOLOUR_MAX, Preferences.ANNOTATIONCOLOUR_MIN,
+      "annotations",
       "APPLICATION_URL", "automaticScrolling", "centrecolumnlabels",
       "debug", "defaultColour", "defaultColourNuc", "defaultColourProt",
       "embedded", "enableSplitFrame", "externalstructureviewer", "features",
@@ -134,7 +137,18 @@ public class AppletParams extends HashMap<String, String>
 
         switch (appletName)
         {
+
         // tested, working:
+
+        case "file":
+          appName = "open";
+          value = resourcePath + value;
+          appletName = null;
+          break;
+        case "file2":
+          value = resourcePath + value;
+          appName = null;
+          break;
         case "jnetfile":
           value = resourcePath + value;
           appName = null;
@@ -148,7 +162,6 @@ public class AppletParams extends HashMap<String, String>
           appName = null;
           break;
         case "pdbfile":
-          appName = "PDBFILE";
           value = resourcePath + value;
           appName = null;
           break;
@@ -158,32 +171,55 @@ public class AppletParams extends HashMap<String, String>
           value = resourcePath + value;
           appletName = null; // taken care of by Jalview
           break;
-        // implemented; not tested:
-        case "annotations":
-          value = resourcePath + value;
-          appName = null;
-          break;
         case "defaultcolour":
-          appName = "DEFAULT_COLOUR"; // defaultColour
+          appName = Preferences.DEFAULT_COLOUR;
           break;
         case "defaultcolournuc":
-          appName = "DEFAULT_COLOUR_NUC";// defaultColourNuc
+          appName = Preferences.DEFAULT_COLOUR_NUC;
           break;
         case "defaultcolourprot":
-          appName = "DEFAULT_COLOUR_PROT";// defaultColourProt";
+          appName = Preferences.DEFAULT_COLOUR_PROT;
+          break;
+
+        // implemented; not tested:
+
+        case "oninit":
+          appName = null;
+          break;
+        case "annotations":
+          value = resourcePath + value;
+          appName = null;
           break;
         case "annotationcolour_max":
-          appName = "ANNOTATIONCOLOUR_MAX";
+          appName = Preferences.ANNOTATIONCOLOUR_MAX;
           break;
         case "annotationcolour_min":
-          appName = "ANNOTATIONCOLOUR_MIN";
+          appName = Preferences.ANNOTATIONCOLOUR_MIN;
+          break;
+        case "enablesplitframe":
+          appName = Preferences.ENABLE_SPLIT_FRAME;
+          break;
+        case "hidefeaturegroups":
           break;
         case "centrecolumnlabels":
           appName = null;
           break;
-        case "enablesplitframe":
-          appName = "enableSplitFrame";
+        case "pdbseq":
+          appName = null;
+          break;
+        case "sortby":
+          appName = Preferences.SORT_ALIGNMENT; // id, etc.
+          break;
+        case "sortbytree":
+          appName = Preferences.SORT_BY_TREE;
+          value = checkTF(value);
+          appletName = null; // taken care of by Jalview
           break;
+        case "format":
+          break;
+
+        // probably not relevant:
+
         case "externalstructureviewer":
           break;
         case "alignpdbfiles":
@@ -197,8 +233,6 @@ public class AppletParams extends HashMap<String, String>
         case "heightscale":
           appName = "heightScale";
           break;
-        case "hidefeaturegroups":
-          break;
         case "jalviewhelpurl":
           break;
         case "label":
@@ -212,26 +246,24 @@ public class AppletParams extends HashMap<String, String>
         case "linkurl_":
           appName = "linkURL_";
           break;
+        case "rgb":
+          appName = null; // no background for application
+          break;
+
+        // unknown:
+
         case "nojmol":
           break;
         case "normaliselogo":
-          appName = "normaliseLogo";
+          appName = Preferences.NORMALISE_LOGO;
           break;
         case "normalisesequencelogo":
-          appName = "normaliseSequenceLogo";
-          break;
-        case "oninit":
-          break;
-        case "pdbseq":
-          appName = "PDBSEQ";
+          appName = Preferences.NORMALISE_CONSENSUS_LOGO;
           break;
         case "relaxedidmatch":
           break;
         case "resolvetocodebase":
           break;
-        case "rgb":
-          appName = "RGB";
-          break;
         case "scaleproteinascdna":
           appName = "scaleProteinAsCdna";
           break;
@@ -239,18 +271,6 @@ public class AppletParams extends HashMap<String, String>
           break;
         case "sequence":
           break;
-        case "sortby":
-          break;
-        case "sortbytree":
-          value = checkTF(value);
-          appletName = null; // taken care of by Jalview
-          break;
-        case "format":
-          break;
-        case "scorefile":
-          appName = "scoreFile";
-          value = resourcePath + value;
-          break;
         case "uppercase":
           appName = "upperCase";
           break;
@@ -267,70 +287,69 @@ public class AppletParams extends HashMap<String, String>
           appName = "windowWidth";
           break;
         case "wrap":
+          appName = Preferences.WRAP_ALIGNMENT;
           break;
+        case "scorefile":
+          appName = "scoreFile";
+          value = resourcePath + value;
+          break;
+
+        // TRUE/FALSE
 
-        // cases not handled in doc/parameters.xlsx
         case "debug":
           value = checkTF(value);
           break;
-        case "file":
-          appName = "open";
-          value = resourcePath + value;
-          break;
-        case "file2":
-          value = resourcePath + value;
-          break;
         case "embedded":
           value = checkTF(value);
           break;
-        case "showannotation":
-          appName = "SHOW_ANNOTATIONS";
+        case "showbutton":
           value = checkTF(value);
           break;
-        case "showbutton":
+        case "showannotation":
+          appName = Preferences.SHOW_ANNOTATIONS;
           value = checkTF(value);
           break;
         case "showconsensus":
-          appName = "SHOW_CONSENSUS_LOGO";
+          appName = Preferences.SHOW_CONSENSUS_LOGO;
           value = checkTF(value);
           break;
         case "showconsensushistogram":
-          appName = "SHOW_CONSENSUS_HISTOGRAM";
+          appName = Preferences.SHOW_CONSENSUS_HISTOGRAM;
           value = checkTF(value);
           break;
         case "showconservation":
-          appName = "SHOW_CONSERVATION";
+          appName = Preferences.SHOW_CONSERVATION;
           value = checkTF(value);
           break;
-        case "showfeaturegroups":
+        case "showgroupconsensus":
+          appName = Preferences.SHOW_GROUP_CONSENSUS;
           value = checkTF(value);
           break;
-        case "showfeaturesettings":
-          appName = "showFeatureSettings";
+        case "showgroupconservation":
+          appName = Preferences.SHOW_GROUP_CONSERVATION;
           value = checkTF(value);
           break;
-        case "showfullid":
-          appName = "showFullId";
+        case "showoccupancy":
+          appName = Preferences.SHOW_OCCUPANCY;
           value = checkTF(value);
           break;
-        case "showgroupconsensus":
-          appName = "SHOW_GROUP_CONSENSUS";
+        case "showquality":
+          appName = Preferences.SHOW_QUALITY;
           value = checkTF(value);
           break;
-        case "showgroupconservation":
-          appName = "SHOW_GROUP_CONSERVATION";
+        case "showsequencelogo":
+          appName = Preferences.SHOW_CONSENSUS_LOGO;
           value = checkTF(value);
           break;
-        case "showoccupancy":
-          appName = "SHOW_OCCUPANCY";
+        case "showfeaturegroups":
           value = checkTF(value);
           break;
-        case "showquality":
-          appName = "SHOW_QUALITY";
+        case "showfeaturesettings":
+          appName = "showFeatureSettings";
           value = checkTF(value);
           break;
-        case "showsequencelogo":
-          appName = "showSequenceLogo";
+        case "showfullid":
+          appName = "showFullId";
           value = checkTF(value);
           break;
         case "showtreebootstraps":
@@ -342,7 +361,7 @@ public class AppletParams extends HashMap<String, String>
           value = checkTF(value);
           break;
         case "showunconserved":
-          appName = "showUnconserved";
+          appName = Preferences.SHOW_UNCONSERVED;
           value = checkTF(value);
           break;
         case "showunlinkedtreenodes":
@@ -350,6 +369,8 @@ public class AppletParams extends HashMap<String, String>
           value = checkTF(value);
           break;
         default:
+          // could be pdbFile2, for example
+          // or one of the app preference names
           break;
         }
         if (value != null)