groupURL link preference variables
[jalview.git] / src / jalview / gui / Preferences.java
index 26d7260..8868832 100755 (executable)
@@ -44,6 +44,14 @@ public class Preferences extends GPreferences
    * $SEQUENCE_ID$ or $SEQUENCE_ID=/.possible | chars ./=$
    */
   public static Vector sequenceURLLinks;
+  /**
+   * Holds name and link separated with | character. Sequence IDS and Sequences must be
+   * $SEQUENCEIDS$ or $SEQUENCEIDS=/.possible | chars ./=$ and $SEQUENCES$ or $SEQUENCES=/.possible | chars ./=$
+   * and separation character for first and second token specified after a pipe character at end |,|.
+   * (TODO: proper escape for using | to separate ids or sequences
+   */
+
+  public static Vector groupURLLinks;
   static
   {
     String string = Cache
@@ -51,7 +59,7 @@ public class Preferences extends GPreferences
                     "SEQUENCE_LINKS",
                     "SRS|http://srs.ebi.ac.uk/srsbin/cgi-bin/wgetz?-newId+(([uniprot-all:$SEQUENCE_ID$]))+-view+SwissEntry");
     sequenceURLLinks = new Vector();
-
+    
     try
     {
       StringTokenizer st = new StringTokenizer(string, "|");
@@ -71,6 +79,14 @@ public class Preferences extends GPreferences
     {
       System.out.println(ex + "\nError parsing sequence links");
     }
+    /**
+     * TODO: reformulate groupURL encoding so two or more can be stored in the .properties file as '|' separated strings 
+     */
+    
+    groupURLLinks = new Vector();
+    groupURLLinks.addElement("UNIPROT|EnVision2|http://www.ebi.ac.uk/enfin-srv/envision2/pages/linkin.jsf?workflow=Default&datasetName=JalviewIDs$DATASETID$&input=$SEQUENCEIDS$&inputType=0|,");
+    groupURLLinks.addElement("Seqs|EnVision2|http://www.ebi.ac.uk/enfin-srv/envision2/pages/linkin.jsf?workflow=Default&datasetName=JalviewSeqs$DATASETID$&input=$SEQUENCES=/([A-Za-z]+)+/=$&inputType=1|,");
+    
   }
 
   Vector nameLinks, urlLinks;
@@ -208,6 +224,11 @@ public class Preferences extends GPreferences
     proxyPortTB.setText(Cache.getDefault("PROXY_PORT", ""));
 
     defaultBrowser.setText(Cache.getDefault("DEFAULT_BROWSER", ""));
+    
+    usagestats.setSelected(Cache.getDefault("USAGESTATS", false));
+    questionnaire.setSelected(Cache.getProperty("NOQUESTIONNAIRES")==null); // note antisense here
+    versioncheck.setSelected(Cache.getDefault("VERSION_CHECK", true)); // default is true
+
     try
     {
       jbInit();
@@ -349,7 +370,20 @@ public class Preferences extends GPreferences
       System.setProperty("http.proxyHost", "");
       System.setProperty("http.proxyPort", "");
     }
-
+    Cache.setProperty("VERSION_CHECK", Boolean
+            .toString(versioncheck.isSelected()));
+    if (Cache.getProperty("USAGESTATS")!=null || usagestats.isSelected()) {
+      // default is false - we only set this if the user has actively agreed
+      Cache.setProperty("USAGESTATS",Boolean
+            .toString(usagestats.isSelected()));
+    }
+    if (!questionnaire.isSelected())
+    {
+      Cache.setProperty("NOQUESTIONNAIRES", "true");
+    } else {
+      // special - made easy to edit a property file to disable questionnaires by just adding the given line
+      Cache.removeProperty("NOQUESTIONNAIRES");
+    }
     Cache.applicationProperties.setProperty("BLC_JVSUFFIX", Boolean
             .toString(blcjv.isSelected()));
     Cache.applicationProperties.setProperty("CLUSTAL_JVSUFFIX", Boolean