From: hansonr Date: Tue, 27 Aug 2019 22:02:45 +0000 (-0500) Subject: JAL-3253-applet headless branch - just experimenting. X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=55f6f8a9ddd0b8bb4445d1cc582297af1d0aa4c5;p=jalview.git JAL-3253-applet headless branch - just experimenting. Windows (at least) headless does not allow for JInternalFrame even though, on paper, JInternalFrame should not be a heavy-weight component. --- diff --git a/src/jalview/bin/Jalview.java b/src/jalview/bin/Jalview.java index fae2b75..2752008 100755 --- a/src/jalview/bin/Jalview.java +++ b/src/jalview/bin/Jalview.java @@ -292,6 +292,7 @@ public class Jalview implements ApplicationSingletonI, JalviewJSApi } else { + // BH 2019.08.26 cannot pass null System.setSecurityManager(null); } @@ -342,6 +343,9 @@ public class Jalview implements ApplicationSingletonI, JalviewJSApi || "true".equals(System.getProperty("java.awt.headless"))) { headless = true; + + System.out.println("Headless operation detected."); + } // anything else! @@ -398,7 +402,9 @@ public class Jalview implements ApplicationSingletonI, JalviewJSApi try { - UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); + UIManager.setLookAndFeel( + headless ? "javax.swing.plaf.metal.MetalLookAndFeel" + : UIManager.getSystemLookAndFeelClassName()); } catch (Exception ex) { System.err.println("Unexpected Look and Feel Exception"); @@ -616,7 +622,8 @@ public class Jalview implements ApplicationSingletonI, JalviewJSApi { if (!(new File(file)).exists()) { - System.out.println("Can't find " + file); + System.out.println( + "Can't find " + new File(file).getAbsolutePath()); if (headless) { System.exit(1); @@ -753,7 +760,10 @@ public class Jalview implements ApplicationSingletonI, JalviewJSApi if (aparser.contains(ArgsParser.SHOWOVERVIEW)) { - af.overviewMenuItem_actionPerformed(null); + if (!headless) + { + af.overviewMenuItem_actionPerformed(null); + } System.out.println("CMD [showoverview] executed successfully!"); } diff --git a/src/jalview/bin/JalviewAppLoader.java b/src/jalview/bin/JalviewAppLoader.java index 51a0330..6225155 100644 --- a/src/jalview/bin/JalviewAppLoader.java +++ b/src/jalview/bin/JalviewAppLoader.java @@ -987,9 +987,12 @@ public class JalviewAppLoader @Override public void run() { - StructureSelectionManager + if (Desktop.getInstance() != null) + { + StructureSelectionManager .getStructureSelectionManager(Desktop.getInstance()) .mouseOverVamsasSequence(sq, sq.findIndex(pos), null); + } } }); } diff --git a/src/jalview/bin/JalviewJS2.java b/src/jalview/bin/JalviewJS2.java index 1ed9f27..4a21374 100644 --- a/src/jalview/bin/JalviewJS2.java +++ b/src/jalview/bin/JalviewJS2.java @@ -33,10 +33,12 @@ public class JalviewJS2 { if (args.length == 0) { - args = new String[] { "open", "examples/uniref50.fa", "features", + args = new String[] { "headless", "open", "examples/uniref50.fa", + "features", "examples/exampleFeatures.txt" , "noannotation" , "showoverview" + , "png", "ALIGN.png" }; } Jalview.main(args); diff --git a/src/jalview/datamodel/features/SequenceFeatures.java b/src/jalview/datamodel/features/SequenceFeatures.java index 475167f..cb2b8cc 100644 --- a/src/jalview/datamodel/features/SequenceFeatures.java +++ b/src/jalview/datamodel/features/SequenceFeatures.java @@ -74,7 +74,7 @@ public class SequenceFeatures implements SequenceFeaturesI */ private final int INTERVAL_STORE_MODE = ( // true || // - true || Platform.isJS() ? // + Platform.isJS() ? // INTERVAL_STORE_LINKED_LIST // : INTERVAL_STORE_NCLIST// ); diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index bac06e9..d73d893 100644 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -131,6 +131,7 @@ import java.awt.event.MouseEvent; import java.awt.print.PageFormat; import java.awt.print.PrinterJob; import java.beans.PropertyChangeEvent; +import java.beans.PropertyVetoException; import java.io.File; import java.io.FileWriter; import java.io.PrintWriter; @@ -170,6 +171,17 @@ public class AlignFrame extends GAlignFrame IProgressIndicator, AlignViewControllerGuiI, ColourChangeListener { + public class IFrame extends JInternalFrame + { + public AlignFrame alignframe; + + IFrame(AlignFrame alignframe) + { + this.alignframe = alignframe; + } + + } + public static final int DEFAULT_WIDTH = 700; public static final int DEFAULT_HEIGHT = 500; @@ -291,15 +303,25 @@ public class AlignFrame extends GAlignFrame public AlignFrame(AlignmentI al, HiddenColumns hiddenColumns, int width, int height, String sequenceSetId, String viewId) { + super(); + + System.out.println("AlignFrame 1"); + setSize(width, height); + System.out.println("GAlignFrame 2"); + if (al.getDataset() == null) { al.setDataset(null); } + System.out.println("GAlignFrame 3"); + viewport = new AlignViewport(al, hiddenColumns, sequenceSetId, viewId); + System.out.println("GAlignFrame 4"); + init(); } @@ -343,8 +365,12 @@ public class AlignFrame extends GAlignFrame */ void init() { + + System.out.println("AlignFrame 8"); boolean newPanel = (alignPanel == null); viewport.setShowAutocalculatedAbove(isShowAutoCalculatedAbove()); + + System.out.println("AlignFrame 9"); if (newPanel) { if (Platform.isJS()) @@ -360,9 +386,13 @@ public class AlignFrame extends GAlignFrame boolean showAnnotation = Jalview.getInstance().getShowAnnotation(); viewport.setShowAnnotation(showAnnotation); } + System.out.println("AlignFrame 11"); alignPanel = new AlignmentPanel(this, viewport); + System.out.println("GAlignFrame 12"); } + System.out.println("GAlignFrame 13"); addAlignmentPanel(alignPanel, newPanel); + System.out.println("GAlignFrame 14"); // setBackground(Color.white); // BH 2019 @@ -782,11 +812,14 @@ public class AlignFrame extends GAlignFrame int aSize = alignPanels.size(); + System.out.println("AlignFrame 21"); + tabbedPane.setVisible(aSize > 1 || ap.av.getViewName() != null); + System.out.println("AlignFrame 23"); if (aSize == 1 && ap.av.getViewName() == null) { - this.getContentPane().add(ap, BorderLayout.CENTER); + getContentPane().add(ap, BorderLayout.CENTER); } else { @@ -824,9 +857,10 @@ public class AlignFrame extends GAlignFrame tabbedPane.setVisible(true); AlignmentPanel first = alignPanels.get(0); tabbedPane.addTab(first.av.getViewName(), first); - this.getContentPane().add(tabbedPane, BorderLayout.CENTER); + getContentPane().add(tabbedPane, BorderLayout.CENTER); } + public AlignViewport getViewport() { return viewport; @@ -858,7 +892,8 @@ public class AlignFrame extends GAlignFrame } } }); - addInternalFrameListener(new javax.swing.event.InternalFrameAdapter() + iframe.addInternalFrameListener( + new javax.swing.event.InternalFrameAdapter() { @Override public void internalFrameClosed( @@ -1058,12 +1093,12 @@ public class AlignFrame extends GAlignFrame // file is reloaded. if (FileFormat.Jalview.equals(currentFileFormat)) { - JInternalFrame[] frames = Desktop.getDesktopPane().getAllFrames(); + AlignFrame[] frames = Desktop.getAlignFrames(); for (int i = 0; i < frames.length; i++) { if (frames[i] instanceof AlignFrame && frames[i] != this - && ((AlignFrame) frames[i]).fileName != null - && ((AlignFrame) frames[i]).fileName.equals(fileName)) + && frames[i].fileName != null + && frames[i].fileName.equals(fileName)) { try { @@ -1077,7 +1112,7 @@ public class AlignFrame extends GAlignFrame } Desktop.getInstance().closeAssociatedWindows(); - FileLoader loader = new FileLoader(); + FileLoader loader = new FileLoader(!Jalview.isHeadlessMode()); DataSourceType protocol = fileName.startsWith("http:") ? DataSourceType.URL : DataSourceType.FILE; @@ -1130,6 +1165,7 @@ public class AlignFrame extends GAlignFrame } } + @Override public void addFromText_actionPerformed(ActionEvent e) { @@ -1255,7 +1291,7 @@ public class AlignFrame extends GAlignFrame if (FileFormat.Jalview.equals(format)) { - String shortName = title; + String shortName = getTitle(); if (shortName.indexOf(File.separatorChar) > -1) { shortName = shortName.substring( @@ -1544,7 +1580,7 @@ public class AlignFrame extends GAlignFrame { if (closeAllTabs) { - if (this.isClosed()) + if (isClosed()) { // really close all the windows - otherwise wait till // setClosed(true) is called @@ -1567,7 +1603,7 @@ public class AlignFrame extends GAlignFrame * this will raise an INTERNAL_FRAME_CLOSED event and this method will * be called recursively, with the frame now in 'closed' state */ - this.setClosed(true); + iframe.setClosed(true); } } catch (Exception ex) { @@ -2319,13 +2355,13 @@ public class AlignFrame extends GAlignFrame // title a concatenation of operations. if (!externalPaste) { - if (title.startsWith("Copied sequences")) + if (getTitle().startsWith("Copied sequences")) { - newtitle = title; + newtitle = getTitle(); } else { - newtitle = newtitle.concat("- from " + title); + newtitle = newtitle.concat("- from " + getTitle()); } } else @@ -2375,17 +2411,18 @@ public class AlignFrame extends GAlignFrame // TODO: maintain provenance of an alignment, rather than just make the // title a concatenation of operations. { - if (title.startsWith("Copied sequences")) + if (getTitle().startsWith("Copied sequences")) { - newtitle = title; + newtitle = getTitle(); } else { - newtitle = newtitle.concat("- from " + title); + newtitle = newtitle.concat("- from " + getTitle()); } } - Desktop.addInternalFrame(af, newtitle, DEFAULT_WIDTH, DEFAULT_HEIGHT); + Desktop.addInternalFrame(af, newtitle, DEFAULT_WIDTH, + DEFAULT_HEIGHT); } catch (Exception ex) { @@ -2444,7 +2481,7 @@ public class AlignFrame extends GAlignFrame { try { - AlignFrame.this.setClosed(true); + AlignFrame.this.getIFrame().setClosed(true); } catch (Exception ex) { } @@ -3773,7 +3810,7 @@ public class AlignFrame extends GAlignFrame frameTitle += viewport.getViewName() + " of "; } - frameTitle += this.title; + frameTitle += this.getTitle(); Desktop.addInternalFrame(tp, frameTitle, 600, 500); } @@ -4850,7 +4887,7 @@ public class AlignFrame extends GAlignFrame } else { - new FileLoader().loadFile(viewport, file, sourceType, format); + new FileLoader(!Jalview.isHeadlessMode()).loadFile(viewport, file, sourceType, format); } } } @@ -5660,12 +5697,13 @@ public class AlignFrame extends GAlignFrame } AlignmentI cdna = new Alignment( cdnaSeqs.toArray(new SequenceI[cdnaSeqs.size()])); - GAlignFrame alignFrame = new AlignFrame(cdna, AlignFrame.DEFAULT_WIDTH, + AlignFrame alignFrame = new AlignFrame(cdna, AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT); cdna.alignAs(alignment); String newtitle = "cDNA " + MessageManager.getString("label.for") + " " - + this.title; - Desktop.addInternalFrame(alignFrame, newtitle, AlignFrame.DEFAULT_WIDTH, + + getTitle(); + Desktop.addInternalFrame(alignFrame, newtitle, + AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT); } @@ -5899,6 +5937,41 @@ public class AlignFrame extends GAlignFrame alignPanel.getSeqPanel().selection(sel, csel, hidden, null); } + public void setSelected(boolean b) throws PropertyVetoException + { + if (iframe != null) + { + iframe.setSelected(b); + } + } + + @Override + protected JInternalFrame getInternalFrame() + { + return new IFrame(this); + } + + public void dispose() + { + if (iframe != null) + { + iframe.dispose(); + } + } + + public void setMaximum(boolean b) throws PropertyVetoException + { + if (iframe != null) + { + iframe.setMaximum(b); + } + } + + public boolean isClosed() + { + return (iframe != null && iframe.isClosed()); + } + } class PrintThread extends Thread diff --git a/src/jalview/gui/AlignViewport.java b/src/jalview/gui/AlignViewport.java index eb9c180..779b48e 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() + getStructureSelectionManager() .registerMappings(align.getCodonFrames()); } @@ -410,10 +410,13 @@ public class AlignViewport extends AlignmentViewport if (al != null) { List mappings = al.getCodonFrames(); - if (mappings != null) + if (mappings != null && Desktop.getInstance() != null) { - StructureSelectionManager ssm = Desktop.getInstance() - .getStructureSelectionManager(); + // StructureSelectionManager ssm = Desktop.getInstance() + // .getStructureSelectionManager(); + + // BH 2019.08.27 allows for null Desktop instance + StructureSelectionManager ssm = getStructureSelectionManager(); for (AlignedCodonFrame acf : mappings) { if (noReferencesTo(acf)) @@ -538,7 +541,7 @@ public class AlignViewport extends AlignmentViewport @Override public void sendSelection() { - Desktop.getInstance().getStructureSelectionManager().sendSelection( + getStructureSelectionManager().sendSelection( new SequenceGroup(getSelectionGroup()), new ColumnSelection(getColumnSelection()), new HiddenColumns(getAlignment().getHiddenColumns()), this); @@ -582,7 +585,9 @@ public class AlignViewport extends AlignmentViewport @Override public StructureSelectionManager getStructureSelectionManager() { - return Desktop.getInstance().getStructureSelectionManager(); + // BH allows for null Desktop instance + return StructureSelectionManager + .getStructureSelectionManager(Desktop.getInstance()); } @Override diff --git a/src/jalview/gui/AlignmentPanel.java b/src/jalview/gui/AlignmentPanel.java index b636fa7..3bb0259 100644 --- a/src/jalview/gui/AlignmentPanel.java +++ b/src/jalview/gui/AlignmentPanel.java @@ -126,15 +126,24 @@ public class AlignmentPanel extends GAlignmentPanel implements */ public AlignmentPanel(AlignFrame af, final AlignViewport av) { + + System.out.println("AP 1"); setBackground(Color.white); // BH 2019 setOpaque(true); alignFrame = af; this.av = av; + + System.out.println("AP 2"); setSeqPanel(new SeqPanel(av, this)); + + System.out.println("AP 3"); setIdPanel(new IdPanel(av, this)); + System.out.println("AP 4"); + setScalePanel(new ScalePanel(av, this)); + System.out.println("AP 5"); idPanelHolder.add(getIdPanel(), BorderLayout.CENTER); idwidthAdjuster = new IdwidthAdjuster(this); idSpaceFillerPanel1.add(idwidthAdjuster, BorderLayout.CENTER); @@ -254,7 +263,10 @@ public class AlignmentPanel extends GAlignmentPanel implements getIdPanel().getIdCanvas().setPreferredSize(d); hscrollFillerPanel.setPreferredSize(d); + System.out.println("AP 99"); repaint(); + + System.out.println("AP 100"); } /** diff --git a/src/jalview/gui/AssociatePdbFileWithSeq.java b/src/jalview/gui/AssociatePdbFileWithSeq.java index b81c344..acc1394 100644 --- a/src/jalview/gui/AssociatePdbFileWithSeq.java +++ b/src/jalview/gui/AssociatePdbFileWithSeq.java @@ -24,6 +24,7 @@ import jalview.datamodel.PDBEntry; import jalview.datamodel.SequenceI; import jalview.io.DataSourceType; import jalview.io.StructureFile; +import jalview.structure.StructureSelectionManager; import jalview.util.MessageManager; /** @@ -61,7 +62,8 @@ public class AssociatePdbFileWithSeq { PDBEntry entry = new PDBEntry(); StructureFile pdbfile = null; - pdbfile = Desktop.getInstance().getStructureSelectionManager() + pdbfile = StructureSelectionManager + .getStructureSelectionManager(Desktop.getInstance()) .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..0910843 100644 --- a/src/jalview/gui/CrossRefAction.java +++ b/src/jalview/gui/CrossRefAction.java @@ -34,6 +34,7 @@ import jalview.datamodel.SequenceI; import jalview.ext.ensembl.EnsemblInfo; import jalview.ext.ensembl.EnsemblMap; import jalview.io.gff.SequenceOntologyI; +import jalview.structure.StructureSelectionManager; import jalview.util.DBRefUtils; import jalview.util.MapList; import jalview.util.MappingUtils; @@ -440,7 +441,8 @@ public class CrossRefAction implements Runnable * register any new mappings for sequence mouseover etc * (will not duplicate any previously registered mappings) */ - Desktop.getInstance().getStructureSelectionManager() + StructureSelectionManager + .getStructureSelectionManager(Desktop.getInstance()) .registerMappings(dataset.getCodonFrames()); if (copyAlignment.getHeight() <= 0) diff --git a/src/jalview/gui/Desktop.java b/src/jalview/gui/Desktop.java index a58e22a..d312a25 100644 --- a/src/jalview/gui/Desktop.java +++ b/src/jalview/gui/Desktop.java @@ -199,7 +199,7 @@ public class Desktop extends GDesktop public static MyDesktopPane getDesktopPane() { - Desktop desktop = Desktop.getInstance(); + Desktop desktop = getInstance(); return desktop == null ? null : desktop.desktopPane; } @@ -799,7 +799,7 @@ public class Desktop extends GDesktop FileFormatI format = new IdentifyFile().identify(file, DataSourceType.PASTE); - new FileLoader().loadFile(file, DataSourceType.PASTE, format); + new FileLoader(true).loadFile(file, DataSourceType.PASTE, format); } } catch (Exception ex) @@ -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() || getInstance().instanceOnly) { return; } @@ -925,7 +925,7 @@ public class Desktop extends GDesktop // The Alignment Frame window could be added from a number of places, // hence, // I did this here in order not to miss out on any Alignment frame. - if (frame instanceof AlignFrame) + if (frame instanceof AlignFrame.IFrame) { frame.setMinimumSize(new Dimension(ALIGN_FRAME_DEFAULT_MIN_WIDTH, ALIGN_FRAME_DEFAULT_MIN_HEIGHT)); @@ -958,9 +958,9 @@ public class Desktop extends GDesktop JInternalFrame itf = getDesktopPane().getSelectedFrame(); if (itf != null) { - if (itf instanceof AlignFrame) + if (itf.getContentPane() instanceof AlignFrame) { - Jalview.setCurrentAlignFrame((AlignFrame) itf); + Jalview.setCurrentAlignFrame((AlignFrame) itf.getContentPane()); } itf.requestFocus(); } @@ -987,7 +987,7 @@ public class Desktop extends GDesktop { menuItem.removeActionListener(menuItem.getActionListeners()[0]); } - Desktop.getInstance().windowMenu.remove(menuItem); + getInstance().windowMenu.remove(menuItem); } }); @@ -1011,7 +1011,7 @@ public class Desktop extends GDesktop getDesktopPane().add(frame); - Desktop.getInstance().windowMenu.add(menuItem); + getInstance().windowMenu.add(menuItem); frame.toFront(); try @@ -1068,7 +1068,7 @@ public class Desktop extends GDesktop { if (!internalCopy) { - Desktop.getInstance().jalviewClipboard = null; + getInstance().jalviewClipboard = null; } internalCopy = false; @@ -1636,9 +1636,9 @@ public class Desktop extends GDesktop } AlignmentViewport source = null, target = null; - if (frames[0] instanceof AlignFrame) + if (frames[0] instanceof AlignFrame.IFrame) { - source = ((AlignFrame) frames[0]).getCurrentView(); + source = ((AlignFrame.IFrame) frames[0]).alignframe.getCurrentView(); } else if (frames[0] instanceof TreePanel) { @@ -1662,9 +1662,10 @@ public class Desktop extends GDesktop { continue; } - if (frames[i] instanceof AlignFrame) + if (frames[i] instanceof AlignFrame.IFrame) { - target = ((AlignFrame) frames[i]).getCurrentView(); + target = ((AlignFrame.IFrame) frames[i]).alignframe + .getCurrentView(); } else if (frames[i] instanceof TreePanel) { @@ -2080,7 +2081,8 @@ public class Desktop extends GDesktop ap.av.setGatherViewsHere(false); - addInternalFrame(newaf, af.getTitle(), AlignFrame.DEFAULT_WIDTH, + addInternalFrame(newaf, af.getTitle(), + AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT); } @@ -2106,9 +2108,10 @@ public class Desktop extends GDesktop for (int t = 0; t < frames.length; t++) { - if (frames[t] instanceof AlignFrame && frames[t] != source) + if (frames[t] instanceof AlignFrame.IFrame + && ((AlignFrame.IFrame) frames[t]).alignframe != source) { - AlignFrame af = (AlignFrame) frames[t]; + AlignFrame af = ((AlignFrame.IFrame) frames[t]).alignframe; boolean gatherThis = false; for (int a = 0; a < af.alignPanels.size(); a++) { @@ -2686,6 +2689,7 @@ public class Desktop extends GDesktop } } } + } /** @@ -2711,9 +2715,9 @@ public class Desktop extends GDesktop // REVERSE ORDER for (int i = frames.length - 1; i > -1; i--) { - if (frames[i] instanceof AlignFrame) + if (frames[i].getContentPane() instanceof AlignFrame) { - avp.add((AlignFrame) frames[i]); + avp.add((AlignFrame) frames[i].getContentPane()); } else if (frames[i] instanceof SplitFrame) { @@ -3160,7 +3164,7 @@ public class Desktop extends GDesktop */ public static void showUrl(final String url) { - showUrl(url, Desktop.getInstance()); + showUrl(url, getInstance()); } /** @@ -3209,7 +3213,7 @@ public class Desktop extends GDesktop public static ParamManager getUserParameterStore() { - Desktop d = Desktop.getInstance(); + Desktop d = getInstance(); if (d.wsparamManager == null) { d.wsparamManager = new WsParamSetManager(); @@ -3500,7 +3504,7 @@ public class Desktop extends GDesktop public static groovy.ui.Console getGroovyConsole() { - Desktop desktop = Desktop.getInstance(); + Desktop desktop = getInstance(); return desktop == null ? null : desktop.groovyConsole; } @@ -3773,4 +3777,10 @@ public class Desktop extends GDesktop return result; } + public static void addInternalFrame(AlignFrame af, String title, + int width, int height) + { + addInternalFrame(af.getIFrame(), title, width, height); + } + } diff --git a/src/jalview/gui/Finder.java b/src/jalview/gui/Finder.java index 2a6adda..1ff2dff 100755 --- a/src/jalview/gui/Finder.java +++ b/src/jalview/gui/Finder.java @@ -187,15 +187,14 @@ public class Finder extends GFinder } // now checks further down the window stack to fix bug // https://mantis.lifesci.dundee.ac.uk/view.php?id=36008 - JInternalFrame[] frames = Desktop.getDesktopPane().getAllFrames(); + AlignFrame[] frames = Desktop.getAlignFrames(); for (int f = 0; f < frames.length; f++) { - JInternalFrame alignFrame = frames[f]; - if (alignFrame != null && alignFrame instanceof AlignFrame - && !alignFrame.isIcon()) + AlignFrame alignFrame = frames[f]; + if (alignFrame != null && !alignFrame.getIFrame().isIcon()) { - av = ((AlignFrame) alignFrame).viewport; - ap = ((AlignFrame) alignFrame).alignPanel; + av = alignFrame.viewport; + ap = alignFrame.alignPanel; return true; } } diff --git a/src/jalview/gui/VamsasApplication.java b/src/jalview/gui/VamsasApplication.java index 4404a8d..6ac37a7 100644 --- a/src/jalview/gui/VamsasApplication.java +++ b/src/jalview/gui/VamsasApplication.java @@ -43,8 +43,6 @@ import java.util.Hashtable; import java.util.IdentityHashMap; import java.util.Iterator; -import javax.swing.JInternalFrame; - import uk.ac.vamsas.client.ClientHandle; import uk.ac.vamsas.client.IClient; import uk.ac.vamsas.client.IClientDocument; @@ -286,7 +284,7 @@ public class VamsasApplication implements SelectionSource, VamsasSource */ protected void updateJalviewGui() { - JInternalFrame[] frames = jdesktop.getAllFrames(); + AlignFrame[] frames = Desktop.getAlignFrames(); if (frames == null) { @@ -298,11 +296,7 @@ public class VamsasApplication implements SelectionSource, VamsasSource // REVERSE ORDER for (int i = frames.length - 1; i > -1; i--) { - if (frames[i] instanceof AlignFrame) - { - AlignFrame af = (AlignFrame) frames[i]; - af.alignPanel.alignmentChanged(); - } + frames[i].alignPanel.alignmentChanged(); } } catch (Exception e) { @@ -455,7 +449,7 @@ public class VamsasApplication implements SelectionSource, VamsasSource VamsasAppDatastore vds = new VamsasAppDatastore(doc, vobj2jv, jv2vobj, baseProvEntry(), alRedoState); // wander through frames - JInternalFrame[] frames = Desktop.getDesktopPane().getAllFrames(); + AlignFrame[] frames = Desktop.getAlignFrames(); if (frames == null) { @@ -469,9 +463,8 @@ public class VamsasApplication implements SelectionSource, VamsasSource // REVERSE ORDER for (int i = frames.length - 1; i > -1; i--) { - if (frames[i] instanceof AlignFrame) - { - AlignFrame af = (AlignFrame) frames[i]; + + AlignFrame af = frames[i]; if (!viewset.containsKey(af.getViewport().getSequenceSetId())) { // update alignment and root from frame. @@ -503,7 +496,7 @@ public class VamsasApplication implements SelectionSource, VamsasSource viewset.put(af.getViewport().getSequenceSetId(), af); } } - } + } // REVERSE ORDER // for (int i = frames.length - 1; i > -1; i--) diff --git a/src/jalview/io/FileLoader.java b/src/jalview/io/FileLoader.java index c3afe1f..b41073c 100755 --- a/src/jalview/io/FileLoader.java +++ b/src/jalview/io/FileLoader.java @@ -37,6 +37,7 @@ import jalview.gui.JvOptionPane; import jalview.json.binding.biojson.v1.ColourSchemeMapper; import jalview.project.Jalview2XML; import jalview.schemes.ColourSchemeI; +import jalview.structure.StructureSelectionManager; import jalview.util.MessageManager; import jalview.util.Platform; import jalview.ws.utils.UrlDownloadClient; @@ -280,6 +281,8 @@ public class FileLoader implements Runnable @Override public void run() { + + String title = protocol == DataSourceType.PASTE ? "Copied From Clipboard" : file; @@ -298,7 +301,8 @@ public class FileLoader implements Runnable format = new IdentifyFile().identify(source, false); // identify stream and rewind rather than close } - else if (selectedFile != null) { + else if (selectedFile != null) + { format = new IdentifyFile().identify(selectedFile, protocol); } else @@ -324,9 +328,11 @@ public class FileLoader implements Runnable } return; } + // TODO: cache any stream datasources as a temporary file (eg. PDBs // retrieved via URL) - if (Desktop.getDesktopPane() != null && Desktop.getDesktopPane().isShowMemoryUsage()) + if (Desktop.getDesktopPane() != null + && Desktop.getDesktopPane().isShowMemoryUsage()) { System.gc(); memused = (rt.maxMemory() - rt.totalMemory() + rt.freeMemory()); // free @@ -348,7 +354,8 @@ public class FileLoader implements Runnable } // BH 2018 switch to File object here instead of filename Platform.timeCheck(null, Platform.TIME_MARK); - alignFrame = new Jalview2XML(raiseGUI).loadJalviewAlign(selectedFile == null ? file : selectedFile); + alignFrame = new Jalview2XML(raiseGUI).loadJalviewAlign( + selectedFile == null ? file : selectedFile); Platform.timeCheck("JVP loaded", Platform.TIME_MARK); } @@ -378,27 +385,29 @@ public class FileLoader implements Runnable file.lastIndexOf(".")); String tempStructureFileStr = createNamedJvTempFile( urlLeafName, structExt); - + // BH - switching to File object here so as to hold // .秘bytes array directly File tempFile = new File(tempStructureFileStr); UrlDownloadClient.download(file, tempFile); - - al = fa.readFile(tempFile, DataSourceType.FILE, - format); + + al = fa.readFile(tempFile, DataSourceType.FILE, format); source = fa.getAlignFile(); } else { - if (selectedFile == null) { + if (selectedFile == null) + { al = fa.readFile(file, protocol, format); - - } else { + + } + else + { al = fa.readFile(selectedFile, protocol, format); - } + } source = fa.getAlignFile(); // keep reference for later if - - // necessary. + + // necessary. } } } catch (java.io.IOException ex) @@ -406,9 +415,17 @@ public class FileLoader implements Runnable error = ex.getMessage(); } + System.out.println("OK1"); + + if ((al != null) && (al.getHeight() > 0) && al.hasValidSequence()) { + + // construct and register dataset sequences + + StructureSelectionManager ssm = StructureSelectionManager + .getStructureSelectionManager(Desktop.getInstance()); for (SequenceI sq : al.getSequences()) { while (sq.getDatasetSequence() != null) @@ -421,16 +438,17 @@ public class FileLoader implements Runnable { // register PDB entries with desktop's structure selection // manager - Desktop.getInstance().getStructureSelectionManager() - .registerPDBEntry(pdbe); + ssm.registerPDBEntry(pdbe); } } } FeatureSettingsModelI proxyColourScheme = source .getFeatureColourScheme(); + if (viewport != null) { + if (proxyColourScheme != null) { viewport.applyFeaturesStyle(proxyColourScheme); @@ -440,6 +458,8 @@ public class FileLoader implements Runnable } else { + + System.out.println("OK9"); // otherwise construct the alignFrame if (source instanceof ComplexAlignFile) @@ -452,8 +472,10 @@ public class FileLoader implements Runnable .getGlobalColourScheme(); FeaturesDisplayedI fd = ((ComplexAlignFile) source) .getDisplayedFeatures(); + alignFrame = new AlignFrame(al, hiddenSeqs, colSel, AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT); + alignFrame.getViewport().setFeaturesDisplayed(fd); alignFrame.getViewport().setShowSequenceFeatures( ((ComplexAlignFile) source).isShowSeqFeatures()); @@ -466,28 +488,64 @@ public class FileLoader implements Runnable } else { - alignFrame = new AlignFrame(al, AlignFrame.DEFAULT_WIDTH, - AlignFrame.DEFAULT_HEIGHT); + + // Headless start fails here in Windows + + // Sorry, no JInternalFrame when headless, at least in Windows. + // Not clear why that would be, since an InternalFrame is not a + // top-level component. But maybe it is + + System.out.println("FileLoader test1"); + + try + { + // + alignFrame = new AlignFrame(al, AlignFrame.DEFAULT_WIDTH, + AlignFrame.DEFAULT_HEIGHT); + + System.out.println("FileLoader test2"); + + } catch (Throwable t) + { + System.out.println(t); + t.printStackTrace(); + } + if (source instanceof FeaturesSourceI) { + + System.out.println("FileLoader test3"); + alignFrame.getViewport().setShowSequenceFeatures(true); } } // add metadata and update ui + + System.out.println("FileLoader test4"); + if (!(protocol == DataSourceType.PASTE)) { + + System.out.println("FileLoader test5"); alignFrame.setFileName(file, format); alignFrame.setFileObject(selectedFile); // BH 2018 SwingJS } + + System.out.println("FileLoader test6"); + if (proxyColourScheme != null) { alignFrame.getViewport() .applyFeaturesStyle(proxyColourScheme); } + + System.out.println("FileLoader test7"); + alignFrame.setStatus(MessageManager.formatMessage( "label.successfully_loaded_file", new String[] { title })); + System.out.println("FileLoader test8" + raiseGUI); if (raiseGUI) { // add the window to the GUI @@ -510,6 +568,9 @@ public class FileLoader implements Runnable } else { + + System.out.println("OK10"); + if (Desktop.getInstance() != null) { Desktop.getInstance().stopLoading(); @@ -519,15 +580,15 @@ public class FileLoader implements Runnable "label.couldnt_load_file") + " " + title + "\n" + error; // TODO: refactor FileLoader to be independent of Desktop / Applet GUI // bits ? - if (raiseGUI && Desktop.getDesktopPane() != null) + if (raiseGUI) { javax.swing.SwingUtilities.invokeLater(new Runnable() { @Override public void run() { - JvOptionPane.showInternalMessageDialog(Desktop.getDesktopPane(), - errorMessage, + JvOptionPane.showInternalMessageDialog( + Desktop.getDesktopPane(), errorMessage, MessageManager .getString("label.error_loading_file"), JvOptionPane.WARNING_MESSAGE); @@ -541,6 +602,7 @@ public class FileLoader implements Runnable } } + updateRecentlyOpened(); } catch (Exception er) @@ -589,6 +651,7 @@ public class FileLoader implements Runnable } loadtime += System.currentTimeMillis(); + // TODO: Estimate percentage of memory used by a newly loaded alignment - // warn if more memory will be needed to work with it // System.gc(); @@ -598,7 +661,8 @@ public class FileLoader implements Runnable // memory // after // load - if (Desktop.getDesktopPane() != null && Desktop.getDesktopPane().isShowMemoryUsage()) + if (Desktop.getDesktopPane() != null + && Desktop.getDesktopPane().isShowMemoryUsage()) { if (alignFrame != null) { diff --git a/src/jalview/jbgui/GAlignFrame.java b/src/jalview/jbgui/GAlignFrame.java index 9de31ab..9fc62db 100755 --- a/src/jalview/jbgui/GAlignFrame.java +++ b/src/jalview/jbgui/GAlignFrame.java @@ -35,6 +35,7 @@ import jalview.util.Platform; import java.awt.BorderLayout; import java.awt.Color; +import java.awt.Container; import java.awt.GridLayout; import java.awt.Toolkit; import java.awt.event.ActionEvent; @@ -64,8 +65,19 @@ import javax.swing.event.MenuEvent; import javax.swing.event.MenuListener; @SuppressWarnings("serial") -public class GAlignFrame extends JInternalFrame +public abstract class GAlignFrame extends JPanel { + + + protected abstract JInternalFrame getInternalFrame(); + + protected JInternalFrame iframe; + + public JInternalFrame getIFrame() + { + return iframe; + } + protected JMenuBar alignFrameMenuBar = new JMenuBar(); protected JMenuItem closeMenuItem = new JMenuItem(); @@ -218,47 +230,60 @@ public class GAlignFrame extends JInternalFrame public GAlignFrame() { - try - { - // for Web-page embedding using id=align-frame-div - setName(Jalview.getAppID("alignment")); + System.out.println("GAlignFrame init"); - jbInit(); - setJMenuBar(alignFrameMenuBar); + // for Web-page embedding using id=align-frame-div + setName(Jalview.getAppID("alignment")); - // dynamically fill save as menu with available formats - for (String ff : FileFormats.getInstance().getWritableFormats(true)) + try + { + if (Jalview.isHeadlessMode()) + { + jbInit(); + } + else { - JMenuItem item = new JMenuItem(ff); - item.addActionListener(new ActionListener() + iframe = getInternalFrame(); + jbInit(); + iframe.setJMenuBar(alignFrameMenuBar); + // dynamically fill save as menu with available formats + for (String ff : FileFormats.getInstance().getWritableFormats(true)) { - @Override - public void actionPerformed(ActionEvent e) + JMenuItem item = new JMenuItem(ff); + + item.addActionListener(new ActionListener() { - outputText_actionPerformed(e.getActionCommand()); + @Override + public void actionPerformed(ActionEvent e) + { + outputText_actionPerformed(e.getActionCommand()); + } + }); + + outputTextboxMenu.add(item); + + if (Platform.allowMnemonics()) // was "not mac and not JS" + { + closeMenuItem.setMnemonic('C'); + outputTextboxMenu.setMnemonic('T'); + undoMenuItem.setMnemonic('Z'); + redoMenuItem.setMnemonic('0'); + copy.setMnemonic('C'); + cut.setMnemonic('U'); + pasteMenu.setMnemonic('P'); + reload.setMnemonic('R'); } - }); - outputTextboxMenu.add(item); + } + } } catch (Exception e) { System.err.println(e.toString()); } - if (Platform.allowMnemonics()) // was "not mac and not JS" - { - closeMenuItem.setMnemonic('C'); - outputTextboxMenu.setMnemonic('T'); - undoMenuItem.setMnemonic('Z'); - redoMenuItem.setMnemonic('0'); - copy.setMnemonic('C'); - cut.setMnemonic('U'); - pasteMenu.setMnemonic('P'); - reload.setMnemonic('R'); - } } private void jbInit() throws Exception @@ -542,8 +567,9 @@ public class GAlignFrame extends JInternalFrame pairwiseAlignmentMenuItem_actionPerformed(e); } }); + - this.getContentPane().setLayout(new BorderLayout()); + getContentPane().setLayout(new BorderLayout()); alignFrameMenuBar.setFont(new java.awt.Font("Verdana", 0, 11)); // statusBar.setBackground(Color.white); BH 2019.08.01 -- this does nothing, // as the label is not opaque @@ -1887,9 +1913,9 @@ public class GAlignFrame extends JInternalFrame addSequenceMenu.add(addFromFile); addSequenceMenu.add(addFromText); addSequenceMenu.add(addFromURL); - this.getContentPane().add(statusPanel, java.awt.BorderLayout.SOUTH); + getContentPane().add(statusPanel, java.awt.BorderLayout.SOUTH); statusPanel.add(statusBar, null); - this.getContentPane().add(tabbedPane, java.awt.BorderLayout.CENTER); + getContentPane().add(tabbedPane, java.awt.BorderLayout.CENTER); formatMenu.add(font); formatMenu.addSeparator(); @@ -2722,4 +2748,33 @@ public class GAlignFrame extends JInternalFrame protected void showComplement_actionPerformed(boolean complement) { } + + private JPanel headlessContentPane; + + protected Container getContentPane() + { + if (iframe != null) + { + return iframe.getContentPane(); + } + return (headlessContentPane == null + ? (headlessContentPane = new JPanel()) + : headlessContentPane); + } + + private String myTitle; + + public void setTitle(String title) + { + myTitle = title; + if (iframe != null) + { + iframe.setTitle(title); + } + } + + public String getTitle() + { + return myTitle; + } } diff --git a/src/jalview/jbgui/GAlignmentPanel.java b/src/jalview/jbgui/GAlignmentPanel.java index 3dd0205..7cf05de 100755 --- a/src/jalview/jbgui/GAlignmentPanel.java +++ b/src/jalview/jbgui/GAlignmentPanel.java @@ -20,45 +20,49 @@ */ package jalview.jbgui; +import jalview.bin.Jalview; + import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import javax.swing.BorderFactory; import javax.swing.ButtonGroup; +import javax.swing.JComponent; import javax.swing.JPanel; import javax.swing.JScrollBar; import javax.swing.JScrollPane; import javax.swing.border.Border; +import javax.swing.plaf.ScrollBarUI; @SuppressWarnings("serial") public class GAlignmentPanel extends JPanel { - protected JScrollBar vscroll = new JScrollBar(); + protected JScrollBar vscroll;// = new JScrollBar(); - protected JScrollBar hscroll = new JScrollBar(); + protected JScrollBar hscroll;// = new JScrollBar(); - BorderLayout borderLayout1 = new BorderLayout(); + BorderLayout borderLayout1;// = new BorderLayout(); - BorderLayout borderLayout3 = new BorderLayout(); + BorderLayout borderLayout3;// = new BorderLayout(); - BorderLayout borderLayout5 = new BorderLayout(); + BorderLayout borderLayout5;// = new BorderLayout(); - BorderLayout borderLayout6 = new BorderLayout(); + BorderLayout borderLayout6;// = new BorderLayout(); - ButtonGroup buttonGroup1 = new ButtonGroup(); + ButtonGroup buttonGroup1;// = new ButtonGroup(); - BorderLayout borderLayout7 = new BorderLayout(); + BorderLayout borderLayout7;// = new BorderLayout(); - BorderLayout borderLayout10 = new BorderLayout(); + BorderLayout borderLayout10;// = new BorderLayout(); - BorderLayout borderLayout11 = new BorderLayout(); + BorderLayout borderLayout11;// = new BorderLayout(); - public JScrollPane annotationScroller = new JScrollPane(); + public JScrollPane annotationScroller;// = new JScrollPane(); Border border1; - BorderLayout borderLayout4 = new BorderLayout(); + BorderLayout borderLayout4;// = new BorderLayout(); static JPanel newJPanel() { // BH 2019 @@ -70,28 +74,159 @@ public class GAlignmentPanel extends JPanel return p; } - protected JPanel sequenceHolderPanel = newJPanel(); - protected JPanel seqPanelHolder = newJPanel(); - protected JPanel scalePanelHolder = newJPanel(); - protected JPanel idPanelHolder = newJPanel(); - protected JPanel idSpaceFillerPanel1 = newJPanel(); - public JPanel annotationSpaceFillerHolder = newJPanel(); - protected JPanel hscrollFillerPanel = newJPanel(); - JPanel hscrollHolder = newJPanel(); + static + { + System.out.println("GAP 1 static "); + } + + protected JPanel sequenceHolderPanel;// = new JPanel(); + + protected JPanel seqPanelHolder;// = new JPanel(); + + protected JPanel scalePanelHolder;// = new JPanel(); + + protected JPanel idPanelHolder;// = new JPanel(); + + protected JPanel idSpaceFillerPanel1;// = new JPanel(); + public JPanel annotationSpaceFillerHolder;// = new JPanel(); + + protected JPanel hscrollFillerPanel;// = new JPanel(); + + JPanel hscrollHolder;// = new JPanel(); + + static + { + System.out.println("GAP 2 static "); + } public GAlignmentPanel() { + + System.out.println("GAP 3a"); + + System.out.println(Jalview.isHeadlessMode()); + try { + vscroll = newScrollBar(); + } catch (Throwable t) + { + t.printStackTrace(); + System.exit(1); + } + + hscroll = newScrollBar(); + + System.out.println("GAP 3b"); + + borderLayout1 = new BorderLayout(); + + borderLayout3 = new BorderLayout(); + + borderLayout5 = new BorderLayout(); + + borderLayout6 = new BorderLayout(); + + buttonGroup1 = new ButtonGroup(); + + borderLayout7 = new BorderLayout(); + + borderLayout10 = new BorderLayout(); + + borderLayout11 = new BorderLayout(); + + System.out.println("GAP 3c"); + annotationScroller = new JScrollPane() { + + @Override + public void updateUI() { + System.out.println("JScrollPane updateUI"); + } + + @Override + public JScrollBar createVerticalScrollBar() + { + return newScrollBar(); + } + + @Override + public JScrollBar createHorizontalScrollBar() + { + return newScrollBar(); + } + + + }; + System.out.println("GAP 3d"); + + borderLayout4 = new BorderLayout(); + + System.out.println("GAP 3e"); + sequenceHolderPanel = newJPanel(); + + seqPanelHolder = newJPanel(); + + scalePanelHolder = newJPanel(); + + idPanelHolder = newJPanel(); + + idSpaceFillerPanel1 = newJPanel(); + + annotationSpaceFillerHolder = newJPanel(); + + hscrollFillerPanel = newJPanel(); + + hscrollHolder = newJPanel(); + + System.out.println("GAP 3r"); + + try + { + + System.out.println("GAP 3 "); + jbInit(); + + System.out.println("GAP 4 "); + } catch (Exception e) { e.printStackTrace(); } } + private JScrollBar newScrollBar() + { + return new JScrollBar() + { + + /** + * Overrides JComponent.updateUI. + * + * @see JComponent#updateUI + */ + @Override + public void updateUI() + { + + System.out.println("JScrollBar.updateUI"); + setUI(new ScrollBarUI() + { + + }); + } + + @Override + public void setUI(ScrollBarUI ui) + { + System.out.println("JScrollBar.setUI"); + // setUI(ui); + } + }; + } + private void jbInit() throws Exception { // annotationScroller.setBackground(Color.white); // BH 2019 diff --git a/src/jalview/jbgui/GSplitFrame.java b/src/jalview/jbgui/GSplitFrame.java index ed715c8..770845f 100644 --- a/src/jalview/jbgui/GSplitFrame.java +++ b/src/jalview/jbgui/GSplitFrame.java @@ -72,15 +72,15 @@ public class GSplitFrame extends JInternalFrame */ protected void addSplitPane() { - splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, topFrame, - bottomFrame); + splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, topFrame.getIFrame(), + bottomFrame.getIFrame()); splitPane.setVisible(true); /* * set divider split at 50:50, or restore saved split if loading from * project */ - int topFrameHeight = topFrame.getHeight(); + int topFrameHeight = topFrame.getIFrame().getHeight(); splitPane.setDividerSize(DIVIDER_SIZE); if (topFrameHeight == 0) { @@ -107,14 +107,17 @@ public class GSplitFrame extends JInternalFrame if (Platform.isAMacAndNotJS()) { // this saves some space - but doesn't hide the title bar - topFrame.putClientProperty("JInternalFrame.isPalette", true); + topFrame.getIFrame().putClientProperty("JInternalFrame.isPalette", true); // topFrame.getRootPane().putClientProperty("Window.style", "small"); - bottomFrame.putClientProperty("JInternalFrame.isPalette", true); + bottomFrame.getIFrame().putClientProperty("JInternalFrame.isPalette", + true); } else { - ((BasicInternalFrameUI) topFrame.getUI()).setNorthPane(null); - ((BasicInternalFrameUI) bottomFrame.getUI()).setNorthPane(null); + ((BasicInternalFrameUI) topFrame.getIFrame().getUI()) + .setNorthPane(null); + ((BasicInternalFrameUI) bottomFrame.getIFrame().getUI()) + .setNorthPane(null); } } diff --git a/test/jalview/bin/CommandLineOperations.java b/test/jalview/bin/CommandLineOperations.java index c7b1d53..f770757 100644 --- a/test/jalview/bin/CommandLineOperations.java +++ b/test/jalview/bin/CommandLineOperations.java @@ -144,23 +144,41 @@ public class CommandLineOperations return classpath; } - private Worker getJalviewDesktopRunner(boolean withAwt, String cmd, + private Worker getJalviewDesktopRunner(boolean headless, String cmd, int timeout) { // Note: JAL-3065 - don't include quotes for lib/* because the arguments are // not expanded by the shell String classpath = getClassPath(); String _cmd = "java " - + (withAwt ? "-Djava.awt.headless=true" : "") + + (headless ? "-Djava.awt.headless=true" : "") + " -classpath " + classpath + " jalview.bin.Jalview "; Process ls2_proc = null; Worker worker = null; + + System.out.println("Executing " + _cmd + cmd); try { ls2_proc = Runtime.getRuntime().exec(_cmd + cmd); } catch (Throwable e1) { e1.printStackTrace(); + + String path = "%Java_HOME%/bin/java " + _cmd + cmd; + + try + { + + ProcessBuilder builder = new ProcessBuilder(path); + builder.redirectErrorStream(true); + ls2_proc = builder.start(); + + } catch (IOException e) + { + String s = e.getMessage(); + System.out.println(s); + } + } if (ls2_proc != null) { @@ -183,6 +201,12 @@ public class CommandLineOperations return worker; } + private void startProcess() + { + + + } + @BeforeTest(alwaysRun = true) public void initialize() { @@ -212,7 +236,7 @@ public class CommandLineOperations @BeforeTest(alwaysRun = true) public void setUpForCommandLineInputOperations() throws IOException { - String cmds = "-open examples/uniref50.fa -noquestionnaire -nousagestats"; + String cmds = "headless -open examples/uniref50.fa -noquestionnaire -nousagestats"; Worker worker = getJalviewDesktopRunner(false, cmds, SETUP_TIMEOUT); String ln = null; int count = 0; diff --git a/test/jalview/datamodel/SequenceTest.java b/test/jalview/datamodel/SequenceTest.java index 2f22112..75fa4a9 100644 --- a/test/jalview/datamodel/SequenceTest.java +++ b/test/jalview/datamodel/SequenceTest.java @@ -1224,7 +1224,7 @@ public class SequenceTest assertTrue(primaryDBRefs.isEmpty()); // empty dbrefs - sq.setDBRefs(null); + sq.setDBRefs(null); primaryDBRefs = sq.getPrimaryDBRefs(); assertTrue(primaryDBRefs.isEmpty()); diff --git a/test/jalview/project/Jalview2xmlTests.java b/test/jalview/project/Jalview2xmlTests.java index 830a759..c2fa989 100644 --- a/test/jalview/project/Jalview2xmlTests.java +++ b/test/jalview/project/Jalview2xmlTests.java @@ -1167,7 +1167,8 @@ public class Jalview2xmlTests extends Jalview2xmlBase // desktop assertEquals(frames.length, 2, "PCA and the tabbed alignment view should be the only two windows on the desktop"); - PCAPanel pcaPanel = (PCAPanel) frames[frames[0] == af ? 1 : 0]; + PCAPanel pcaPanel = (PCAPanel) frames[frames[0] == af.getIFrame() ? 1 + : 0]; AlignmentViewPanel restoredNewView = null; for (AlignmentViewPanel alignpanel : Desktop.getAlignmentPanels(null))