JAL-3253-applet JAL-3424 headless fix for Windows
[jalview.git] / src / jalview / bin / Jalview.java
index 6f902af..2efa0fb 100755 (executable)
@@ -20,6 +20,7 @@
  */
 package jalview.bin;
 
+import jalview.api.AlignCalcWorkerI;
 import jalview.api.AlignFrameI;
 import jalview.api.AlignViewportI;
 import jalview.api.JalviewApp;
@@ -145,6 +146,8 @@ public class Jalview implements ApplicationSingletonI, JalviewJSApi
 
   private boolean noCalculation, noMenuBar, noStatus;
 
+  private boolean noAnnotation;
+
   public boolean getStartCalculations()
   {
     return !noCalculation;
@@ -160,6 +163,10 @@ public class Jalview implements ApplicationSingletonI, JalviewJSApi
     return !noStatus;
   }
 
+  public boolean getShowAnnotation()
+  {
+    return !noAnnotation;
+  }
 
   public static AlignFrame getCurrentAlignFrame()
   {
@@ -391,7 +398,13 @@ public class Jalview implements ApplicationSingletonI, JalviewJSApi
 
     try
     {
-      UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
+      if (Platform.isWin())
+       {
+        UIManager.setLookAndFeel(
+                headless ? "javax.swing.plaf.metal.MetalLookAndFeel"
+                        : UIManager.getSystemLookAndFeelClassName());
+//      UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
+      }
     } catch (Exception ex)
     {
       System.err.println("Unexpected Look and Feel Exception");
@@ -634,14 +647,6 @@ 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;
@@ -654,6 +659,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;
@@ -745,6 +756,13 @@ public class Jalview implements ApplicationSingletonI, JalviewJSApi
           System.out.println(
                   "CMD [-annotations " + data + "] executed successfully!");
         }
+
+        if (aparser.contains(ArgsParser.SHOWOVERVIEW))
+        {
+          af.overviewMenuItem_actionPerformed(null);
+          System.out.println("CMD [showoverview] executed successfully!");
+        }
+
         // set or clear the sortbytree flag.
         if (aparser.contains(ArgsParser.SORTBYTREE))
         {
@@ -754,18 +772,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))
@@ -2020,6 +2050,17 @@ public class Jalview implements ApplicationSingletonI, JalviewJSApi
 
   }
 
+  @Override
+  public void showOverview()
+  {
+    currentAlignFrame.overviewMenuItem_actionPerformed(null);
+  }
+
+  public void notifyWorker(AlignCalcWorkerI worker, String status)
+  {
+    // System.out.println("Jalview worker " + worker.getClass().getSimpleName()
+    // + " " + status);
+  }
 
 }