JAL-3369 JAL-3253-applet adds JS app.showOverview()
[jalview.git] / src / jalview / bin / Jalview.java
index a67c5fd..28d029c 100755 (executable)
@@ -145,6 +145,8 @@ public class Jalview implements ApplicationSingletonI, JalviewJSApi
 
   private boolean noCalculation, noMenuBar, noStatus;
 
+  private boolean noAnnotation;
+
   public boolean getStartCalculations()
   {
     return !noCalculation;
@@ -160,6 +162,10 @@ public class Jalview implements ApplicationSingletonI, JalviewJSApi
     return !noStatus;
   }
 
+  public boolean getShowAnnotation()
+  {
+    return !noAnnotation;
+  }
 
   public static AlignFrame getCurrentAlignFrame()
   {
@@ -279,7 +285,11 @@ public class Jalview implements ApplicationSingletonI, JalviewJSApi
   {
 
     boolean isJS = Platform.isJS();
-    if (!isJS)
+    if (isJS)
+    {
+      Platform.setAppClass(this);
+    }
+    else
     {
       System.setSecurityManager(null);
     }
@@ -650,6 +660,12 @@ public class Jalview implements ApplicationSingletonI, JalviewJSApi
         System.out.println("CMD [nostatus] executed successfully!");
       }
 
+      if (aparser.contains(ArgsParser.NOANNOTATION)
+              || aparser.contains(ArgsParser.NOANNOTATION2))
+      {
+        noAnnotation = true;
+        System.out.println("CMD no-annotation executed successfully!");
+      }
       if (aparser.contains(ArgsParser.NOCALCULATION))
       {
         noCalculation = true;
@@ -750,18 +766,30 @@ public class Jalview implements ApplicationSingletonI, JalviewJSApi
             System.out.println("CMD [-sortbytree] executed successfully!");
           }
         }
-        
+
         boolean doUpdateAnnotation = false;
-        
 
-        if (aparser.contains(ArgsParser.NOANNOTATION)
-                || aparser.contains(ArgsParser.NOANNOTATION2))
+        /**
+         * we do this earlier in JalviewJS because of a complication with
+         * SHOWOVERVIEW
+         * 
+         * For now, just fixing this in JalviewJS.
+         *
+         * 
+         * @j2sIgnore
+         * 
+         */
         {
-          af.getViewport().setShowAnnotation(false);
-          if (!af.getViewport().isShowAnnotation())
+          if (aparser.contains(ArgsParser.NOANNOTATION)
+                  || aparser.contains(ArgsParser.NOANNOTATION2))
           {
-            doUpdateAnnotation = true;
-            System.out.println("CMD no-annotation executed successfully!");
+            af.getViewport().setShowAnnotation(false);
+            if (!af.getViewport().isShowAnnotation())
+            {
+              doUpdateAnnotation = true;
+              System.out
+                      .println("CMD no-annotation executed successfully!");
+            }
           }
         }
         if (aparser.contains(ArgsParser.NOSORTBYTREE))
@@ -2016,5 +2044,11 @@ public class Jalview implements ApplicationSingletonI, JalviewJSApi
 
   }
 
+  @Override
+  public void showOverview()
+  {
+    currentAlignFrame.overviewMenuItem_actionPerformed(null);
+  }
 
 }
+