sortbytree/nosortbytree and defprop arguments. (defprop disabled for moment)
authorjprocter <Jim Procter>
Tue, 17 Mar 2009 16:56:05 +0000 (16:56 +0000)
committerjprocter <Jim Procter>
Tue, 17 Mar 2009 16:56:05 +0000 (16:56 +0000)
src/jalview/bin/Jalview.java

index 8205374..7e70bf4 100755 (executable)
@@ -83,6 +83,8 @@ public class Jalview
                       + "-eps FILE\tCreate EPS file FILE from alignment.\n"
                       + "-questionnaire URL\tQueries the given URL for information about any Jalview user questionnaires.\n"
                       + "-noquestionnaire\tTurn off questionnaire check.\n"
+                      + "-sortbytree OR -nosortbytree\tEnable or disable sorting of the given alignment by the given tree\n"
+                      + "-setprop PROPERTY=VALUE\tSet the given Jalview property, after all other properties files have been read\n\t (quote the 'PROPERTY=VALUE' pair to ensure spaces are passed in correctly)"
                       + "-dasserver nickname=URL\tAdd and enable a das server with given nickname (alphanumeric or underscores only) for retrieval of features for all alignments.\n"
                       +"\t\tSources that also support the sequence command may be specified by prepending the URL with sequence:\n"
                       +"\t\t e.g. sequence:http://localdas.somewhere.org/das/source)\n"
@@ -91,10 +93,22 @@ public class Jalview
                       + "\n~Read documentation in Application or visit http://www.jalview.org for description of Features and Annotations file~\n\n");
       System.exit(0);
     }
-
     Cache.loadProperties(aparser.getValue("props")); // must do this before
     // anything else!
-
+    String defs = aparser.getValue("setprop");
+    while (defs!=null)
+    {
+      int p = defs.indexOf('=');
+      if ( p==-1 )
+      {
+        System.err.println("Ignoring invalid setprop argument : "+defs);
+      } else {
+        System.out.println("Executing setprop argument: "+defs);
+        // DISABLED FOR SECURITY REASONS
+       // Cache.setProperty(defs.substring(0,p), defs.substring(p+1));
+      }
+      defs = aparser.getValue("setprop");
+    }
     if (aparser.contains("nodisplay"))
     {
       System.setProperty("java.awt.headless", "true");
@@ -128,6 +142,7 @@ public class Jalview
               // "com.sun.java.swing.plaf.windows.WindowsLookAndFeel"
               // "com.sun.java.swing.plaf.motif.MotifLookAndFeel"
 
+              
               );
     } catch (Exception ex)
     {
@@ -252,6 +267,15 @@ public class Jalview
         af.loadJalviewDataFile(data);
         System.out.println("Added " + data);
       }
+      // set or clear the sortbytree flag.
+      if (aparser.contains("sortbytree"))
+      {
+        af.getViewport().setSortByTree(true);
+      }
+      if (aparser.contains("nosortbytree"))
+      {
+        af.getViewport().setSortByTree(false);
+      }
       data = aparser.getValue("tree");
       if (data != null)
       {