From: hansonr Date: Tue, 27 Aug 2019 23:25:22 +0000 (-0500) Subject: JAL-3253-applet JAL-3424 headless fix for Windows X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=72fb6df14f1ff426bbafa18dcc9a90450da93018;p=jalview.git JAL-3253-applet JAL-3424 headless fix for Windows --- diff --git a/src/jalview/bin/Jalview.java b/src/jalview/bin/Jalview.java index 2efa0fb..b149911 100755 --- a/src/jalview/bin/Jalview.java +++ b/src/jalview/bin/Jalview.java @@ -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; diff --git a/src/jalview/gui/AlignViewport.java b/src/jalview/gui/AlignViewport.java index eb9c180..fb3ec3a 100644 --- a/src/jalview/gui/AlignViewport.java +++ b/src/jalview/gui/AlignViewport.java @@ -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 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 diff --git a/src/jalview/gui/AssociatePdbFileWithSeq.java b/src/jalview/gui/AssociatePdbFileWithSeq.java index b81c344..1f540da 100644 --- a/src/jalview/gui/AssociatePdbFileWithSeq.java +++ b/src/jalview/gui/AssociatePdbFileWithSeq.java @@ -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) diff --git a/src/jalview/gui/CrossRefAction.java b/src/jalview/gui/CrossRefAction.java index 2ee741b..f607686 100644 --- a/src/jalview/gui/CrossRefAction.java +++ b/src/jalview/gui/CrossRefAction.java @@ -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) diff --git a/src/jalview/gui/Desktop.java b/src/jalview/gui/Desktop.java index a58e22a..ace7529 100644 --- a/src/jalview/gui/Desktop.java +++ b/src/jalview/gui/Desktop.java @@ -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; } diff --git a/src/jalview/gui/SplitFrame.java b/src/jalview/gui/SplitFrame.java index 8bfa428..253b02c 100644 --- a/src/jalview/gui/SplitFrame.java +++ b/src/jalview/gui/SplitFrame.java @@ -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); diff --git a/src/jalview/gui/VamsasApplication.java b/src/jalview/gui/VamsasApplication.java index 4404a8d..ef814d3 100644 --- a/src/jalview/gui/VamsasApplication.java +++ b/src/jalview/gui/VamsasApplication.java @@ -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() diff --git a/src/jalview/io/FileLoader.java b/src/jalview/io/FileLoader.java index c3afe1f..3585c93 100755 --- a/src/jalview/io/FileLoader.java +++ b/src/jalview/io/FileLoader.java @@ -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); } } diff --git a/src/jalview/io/VamsasAppDatastore.java b/src/jalview/io/VamsasAppDatastore.java index 1f2f0fb..84d31f0 100644 --- a/src/jalview/io/VamsasAppDatastore.java +++ b/src/jalview/io/VamsasAppDatastore.java @@ -1476,7 +1476,7 @@ public class VamsasAppDatastore // active if (mappings != null) { - Desktop.getInstance().getStructureSelectionManager() + Desktop.getStructureSelectionManager() .registerMappings(mappings); } } diff --git a/src/jalview/io/vamsas/Sequencemapping.java b/src/jalview/io/vamsas/Sequencemapping.java index 47cceb7..542bd3f 100644 --- a/src/jalview/io/vamsas/Sequencemapping.java +++ b/src/jalview/io/vamsas/Sequencemapping.java @@ -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); diff --git a/src/jalview/project/Jalview2XML.java b/src/jalview/project/Jalview2XML.java index c28f24d..1a25270 100644 --- a/src/jalview/project/Jalview2XML.java +++ b/src/jalview/project/Jalview2XML.java @@ -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 index 0000000..9373554 Binary files /dev/null and b/test-bh.png differ diff --git a/test/jalview/bin/CommandLineOperations.java b/test/jalview/bin/CommandLineOperations.java index c7b1d53..eaa395e 100644 --- a/test/jalview/bin/CommandLineOperations.java +++ b/test/jalview/bin/CommandLineOperations.java @@ -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); diff --git a/test/jalview/gui/AlignViewportTest.java b/test/jalview/gui/AlignViewportTest.java index ff8b19c..4db0df2 100644 --- a/test/jalview/gui/AlignViewportTest.java +++ b/test/jalview/gui/AlignViewportTest.java @@ -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)