JAL-3253-applet JAL-3424 headless fix for Windows
authorhansonr <hansonr@STO24954W.ad.stolaf.edu>
Tue, 27 Aug 2019 23:25:22 +0000 (18:25 -0500)
committerhansonr <hansonr@STO24954W.ad.stolaf.edu>
Tue, 27 Aug 2019 23:25:22 +0000 (18:25 -0500)
14 files changed:
src/jalview/bin/Jalview.java
src/jalview/gui/AlignViewport.java
src/jalview/gui/AssociatePdbFileWithSeq.java
src/jalview/gui/CrossRefAction.java
src/jalview/gui/Desktop.java
src/jalview/gui/SplitFrame.java
src/jalview/gui/VamsasApplication.java
src/jalview/io/FileLoader.java
src/jalview/io/VamsasAppDatastore.java
src/jalview/io/vamsas/Sequencemapping.java
src/jalview/project/Jalview2XML.java
test-bh.png [new file with mode: 0644]
test/jalview/bin/CommandLineOperations.java
test/jalview/gui/AlignViewportTest.java

index 2efa0fb..b149911 100755 (executable)
@@ -305,6 +305,15 @@ public class Jalview implements ApplicationSingletonI, JalviewJSApi
 
     String usrPropsFile = aparser.getValue(ArgsParser.PROPS);
     Cache.loadProperties(usrPropsFile);
+
+    if (aparser.contains(ArgsParser.NODISPLAY)
+            || aparser.contains(ArgsParser.NOGUI)
+            || aparser.contains(ArgsParser.HEADLESS)
+            || "true".equals(System.getProperty("java.awt.headless")))
+    {
+      headless = true;
+    }
+
     if (isJS)
     {
       isJavaAppletTag = aparser.isApplet();
@@ -336,13 +345,7 @@ public class Jalview implements ApplicationSingletonI, JalviewJSApi
         showUsage();
         System.exit(0);
       }
-      if (aparser.contains(ArgsParser.NODISPLAY)
-              || aparser.contains(ArgsParser.NOGUI)
-              || aparser.contains(ArgsParser.HEADLESS)
-              || "true".equals(System.getProperty("java.awt.headless")))
-      {
-        headless = true;
-      }
+
 
       // anything else!
 
@@ -398,7 +401,7 @@ public class Jalview implements ApplicationSingletonI, JalviewJSApi
 
     try
     {
-      if (Platform.isWin())
+      if (!isJS && Platform.isWin())
        {
         UIManager.setLookAndFeel(
                 headless ? "javax.swing.plaf.metal.MetalLookAndFeel"
@@ -855,12 +858,12 @@ public class Jalview implements ApplicationSingletonI, JalviewJSApi
                     + "] executed successfully!");
             groovyscript = null;
           }
-          checkOutputFile(aparser, af, format);
           while (aparser.getSize() > 0)
           {
             System.out.println("Unknown arg: " + aparser.nextValue());
           }
         }
+        checkOutputFile(aparser, af, format);
       }
     }
     AlignFrame startUpAlframe = null;
index eb9c180..fb3ec3a 100644 (file)
@@ -391,7 +391,7 @@ public class AlignViewport extends AlignmentViewport
      */
     if (align != null)
     {
-      Desktop.getInstance().getStructureSelectionManager()
+      Desktop.getStructureSelectionManager()
               .registerMappings(align.getCodonFrames());
     }
 
@@ -412,7 +412,7 @@ public class AlignViewport extends AlignmentViewport
       List<AlignedCodonFrame> mappings = al.getCodonFrames();
       if (mappings != null)
       {
-        StructureSelectionManager ssm = Desktop.getInstance()
+        StructureSelectionManager ssm = Desktop
                 .getStructureSelectionManager();
         for (AlignedCodonFrame acf : mappings)
         {
@@ -538,7 +538,7 @@ public class AlignViewport extends AlignmentViewport
   @Override
   public void sendSelection()
   {
-    Desktop.getInstance().getStructureSelectionManager().sendSelection(
+    Desktop.getStructureSelectionManager().sendSelection(
             new SequenceGroup(getSelectionGroup()),
             new ColumnSelection(getColumnSelection()),
             new HiddenColumns(getAlignment().getHiddenColumns()), this);
@@ -582,7 +582,7 @@ public class AlignViewport extends AlignmentViewport
   @Override
   public StructureSelectionManager getStructureSelectionManager()
   {
-    return Desktop.getInstance().getStructureSelectionManager();
+    return Desktop.getStructureSelectionManager();
   }
 
   @Override
index b81c344..1f540da 100644 (file)
@@ -61,7 +61,7 @@ public class AssociatePdbFileWithSeq
   {
     PDBEntry entry = new PDBEntry();
     StructureFile pdbfile = null;
-    pdbfile = Desktop.getInstance().getStructureSelectionManager()
+    pdbfile = Desktop.getStructureSelectionManager()
             .setMapping(false, new SequenceI[]
             { sequence }, null, fileName, type);
     if (pdbfile == null)
index 2ee741b..f607686 100644 (file)
@@ -440,7 +440,7 @@ public class CrossRefAction implements Runnable
      * register any new mappings for sequence mouseover etc
      * (will not duplicate any previously registered mappings)
      */
-    Desktop.getInstance().getStructureSelectionManager()
+    Desktop.getStructureSelectionManager()
             .registerMappings(dataset.getCodonFrames());
 
     if (copyAlignment.getHeight() <= 0)
index a58e22a..ace7529 100644 (file)
@@ -909,7 +909,7 @@ public class Desktop extends GDesktop
     // A HEADLESS STATE WHEN NO DESKTOP EXISTS. MUST RETURN
     // IF JALVIEW IS RUNNING HEADLESS
     // ///////////////////////////////////////////////
-    if (Desktop.getInstance().instanceOnly || Jalview.isHeadlessMode())
+    if (Jalview.isHeadlessMode() || Desktop.getInstance().instanceOnly)
     {
       return;
     }
index 8bfa428..253b02c 100644 (file)
@@ -149,7 +149,7 @@ public class SplitFrame extends GSplitFrame implements SplitContainerI
   {
     // TODO if CommandListener is only ever 1:1 for complementary views,
     // may change broadcast pattern to direct messaging (more efficient)
-    final StructureSelectionManager ssm = Desktop.getInstance()
+    final StructureSelectionManager ssm = Desktop
             .getStructureSelectionManager();
     ssm.addCommandListener(((AlignFrame) getTopFrame()).getViewport());
     ssm.addCommandListener(((AlignFrame) getBottomFrame()).getViewport());
@@ -555,7 +555,7 @@ public class SplitFrame extends GSplitFrame implements SplitContainerI
      */
     adjustLayout();
 
-    final StructureSelectionManager ssm = Desktop.getInstance()
+    final StructureSelectionManager ssm = Desktop
             .getStructureSelectionManager();
     ssm.addCommandListener(newTopPanel.av);
     ssm.addCommandListener(newBottomPanel.av);
index 4404a8d..ef814d3 100644 (file)
@@ -762,7 +762,7 @@ public class VamsasApplication implements SelectionSource, VamsasSource
       try
       {
         IPickManager pm = vclient.getPickManager();
-        StructureSelectionManager ssm = Desktop.getInstance()
+        StructureSelectionManager ssm = Desktop
                 .getStructureSelectionManager();
         VamsasApplication me = this;
         pm.registerMessageHandler(new IMessageHandler()
index c3afe1f..3585c93 100755 (executable)
@@ -421,7 +421,7 @@ public class FileLoader implements Runnable
               {
                 // register PDB entries with desktop's structure selection
                 // manager
-                Desktop.getInstance().getStructureSelectionManager()
+                Desktop.getStructureSelectionManager()
                         .registerPDBEntry(pdbe);
               }
             }
index 1f2f0fb..84d31f0 100644 (file)
@@ -1476,7 +1476,7 @@ public class VamsasAppDatastore
           // active
           if (mappings != null)
           {
-            Desktop.getInstance().getStructureSelectionManager()
+            Desktop.getStructureSelectionManager()
                     .registerMappings(mappings);
           }
         }
index 47cceb7..542bd3f 100644 (file)
@@ -369,7 +369,7 @@ public class Sequencemapping extends Rangetype
       acf.addMap(from, to, mapping);
     }
     bindjvvobj(mapping, sequenceMapping);
-    Desktop.getInstance().getStructureSelectionManager()
+    Desktop.getStructureSelectionManager()
             .registerMapping(acf);
     // Try to link up any conjugate database references in the two sequences
     // matchConjugateDBRefs(from, to, mapping);
index c28f24d..1a25270 100644 (file)
@@ -3020,7 +3020,7 @@ public class Jalview2XML
     {
       if (ds.getCodonFrames() != null)
       {
-        Desktop.getInstance().getStructureSelectionManager()
+        Desktop.getStructureSelectionManager()
                 .registerMappings(ds.getCodonFrames());
       }
     }
@@ -3658,7 +3658,7 @@ public class Jalview2XML
             {
               entry.setProperty(prop.getName(), prop.getValue());
             }
-            Desktop.getInstance().getStructureSelectionManager()
+            Desktop.getStructureSelectionManager()
                     .registerPDBEntry(entry);
             // adds PDBEntry to datasequence's set (since Jalview 2.10)
             if (al.getSequenceAt(i).getDatasetSequence() != null)
diff --git a/test-bh.png b/test-bh.png
new file mode 100644 (file)
index 0000000..9373554
Binary files /dev/null and b/test-bh.png differ
index c7b1d53..eaa395e 100644 (file)
@@ -196,6 +196,7 @@ public class CommandLineOperations
     String cmds = "nodisplay -open examples/uniref50.fa -sortbytree -props test/jalview/io/testProps.jvprops -colour zappo "
             + "-jabaws http://www.compbio.dundee.ac.uk/jabaws -nosortbytree "
             + "-features examples/testdata/plantfdx.features -annotations examples/testdata/plantfdx.annotations -tree examples/testdata/uniref50_test_tree";
+    System.out.println("CommandLine test " + ++ntest);
     Worker worker = getJalviewDesktopRunner(true, cmds, SETUP_TIMEOUT);
     String ln = null;
     while ((ln = worker.getOutputReader().readLine()) != null)
@@ -207,8 +208,11 @@ public class CommandLineOperations
     {
       System.err.println(ln);
     }
+
   }
 
+  int ntest = 0;
+
   @BeforeTest(alwaysRun = true)
   public void setUpForCommandLineInputOperations() throws IOException
   {
@@ -248,7 +252,7 @@ public class CommandLineOperations
           int timeout)
   {
     String cmd = harg + type + " " + fileName;
-    // System.out.println(">>>>>>>>>>>>>>>> Command : " + cmd);
+    System.out.println(">>>>>>>>>>>>>>>> Command : " + cmd);
     File file = new File(fileName);
     file.deleteOnExit();
     Worker worker = getJalviewDesktopRunner(withAWT, cmd, timeout);
index ff8b19c..4db0df2 100644 (file)
@@ -79,7 +79,7 @@ public class AlignViewportTest
     /*
      * remove any sequence mappings left lying around by other tests
      */
-    Desktop.getInstance().getStructureSelectionManager().resetAll();
+    Desktop.getStructureSelectionManager().resetAll();
   }
 
   @BeforeMethod(alwaysRun = true)