JAL-3253-applet adds NOMENUBAR, NOSTATUS, NOCALCULATION, SHOWOVERVIEW
[jalview.git] / src / jalview / bin / Jalview.java
index bb2038e..d9de469 100755 (executable)
@@ -146,6 +146,24 @@ public class Jalview implements ApplicationSingletonI, JalviewJSApi
 
   protected JSFunctionExec jsFunctionExec;
 
+  private boolean noCalculation, noMenuBar, noStatus;
+
+  public boolean getStartCalculations()
+  {
+    return !noCalculation;
+  }
+
+  public boolean getAllowMenuBar()
+  {
+    return !noMenuBar;
+  }
+
+  public boolean getShowStatus()
+  {
+    return !noStatus;
+  }
+
+
   public static AlignFrame getCurrentAlignFrame()
   {
     return getInstance().currentAlignFrame;
@@ -255,26 +273,6 @@ public class Jalview implements ApplicationSingletonI, JalviewJSApi
     getInstance().doMain(args);
   }
 
-  /**
-   * Allow an outside entity to initiate the second half of argument parsing
-   * (only).
-   * 
-   * @param args
-   * @return null is good
-   */
-  @Override
-  public Object parseArguments(String[] args)
-  {
-
-    try
-    {
-      ArgsParser aparser = new ArgsParser(args);
-      return parseArguments(aparser, false);
-    } catch (Throwable t)
-    {
-      return t;
-    }
-  }
 
   private static void logClass(String name)
   {
@@ -553,6 +551,33 @@ public class Jalview implements ApplicationSingletonI, JalviewJSApi
     parseArguments(aparser, true);
   }
 
+  /**
+   * Allow an outside entity to initiate the second half of argument parsing
+   * (only).
+   * 
+   * @param args
+   * @return null is good
+   */
+  @Override
+  public Object parseArguments(String[] args)
+  {
+
+    try
+    {
+      ArgsParser aparser = new ArgsParser(args);
+      return parseArguments(aparser, false);
+    } catch (Throwable t)
+    {
+      return t;
+    }
+  }
+
+  /**
+   * 
+   * @param aparser
+   * @param isStartup
+   * @return
+   */
   private Object parseArguments(ArgsParser aparser, boolean isStartup)
   {
     boolean isJS = Platform.isJS();
@@ -569,7 +594,6 @@ public class Jalview implements ApplicationSingletonI, JalviewJSApi
     String fileFormat = (isJavaAppletTag
             ? aparser.getAppletValue("format", null)
             : null);
-
     FileFormatI format = null;
     DataSourceType protocol = null;
 
@@ -597,8 +621,11 @@ public class Jalview implements ApplicationSingletonI, JalviewJSApi
       }
     }
 
+    String data;
+
     if (file != null)
     {
+
       if (!headless)
       {
         desktop.setProgressBar(
@@ -645,6 +672,32 @@ public class Jalview implements ApplicationSingletonI, JalviewJSApi
         // TODO ?
       }
 
+      if (aparser.contains(ArgsParser.SHOWOVERVIEW))
+      {
+        jalview.bin.Cache.setPropertyNoSave(Preferences.SHOW_OVERVIEW,
+                "true");
+
+        System.out.println("CMD [showoverview] executed successfully!");
+      }
+
+      if (aparser.contains(ArgsParser.NOMENUBAR))
+      {
+        noMenuBar = true;
+        System.out.println("CMD [nomenu] executed successfully!");
+      }
+
+      if (aparser.contains(ArgsParser.NOSTATUS))
+      {
+        noStatus = true;
+        System.out.println("CMD [nostatus] executed successfully!");
+      }
+
+      if (aparser.contains(ArgsParser.NOCALCULATION))
+      {
+        noCalculation = true;
+        System.out.println("CMD [nocalculation] executed successfully!");
+      }
+
       AlignFrame af = new FileLoader(!headless).loadFileWaitTillLoaded(file,
               protocol, format);
       if (af == null)
@@ -686,7 +739,7 @@ public class Jalview implements ApplicationSingletonI, JalviewJSApi
 
         // TODO: file2 How to implement file2 for the applet spit screen?
 
-        String data = aparser.getValue(ArgsParser.COLOUR, true);
+        data = aparser.getValue(ArgsParser.COLOUR, true);
         if (data != null)
         {
           data.replaceAll("%20", " ");
@@ -2005,4 +2058,5 @@ public class Jalview implements ApplicationSingletonI, JalviewJSApi
 
   }
 
+
 }