X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FAppJmol.java;h=868f306b72843c90a0026e84502ffd9859de8079;hb=153dd62dc91da13ae732600e6ea55ddbe15eab39;hp=74a9c221ee3787ea37eabf067cfea2a878cb4f15;hpb=3357d18e685c4fd5f089df73f0290eb1b72ce0ee;p=jalview.git diff --git a/src/jalview/gui/AppJmol.java b/src/jalview/gui/AppJmol.java index 74a9c22..868f306 100644 --- a/src/jalview/gui/AppJmol.java +++ b/src/jalview/gui/AppJmol.java @@ -1,5 +1,5 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5) + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.6) * Copyright (C) 2010 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle * * This file is part of Jalview. @@ -40,6 +40,7 @@ import org.jmol.api.*; import org.jmol.adapter.smarter.SmarterJmolAdapter; import org.jmol.popup.*; import org.jmol.viewer.JmolConstants; +import org.openscience.jmol.app.jmolpanel.AppConsole; public class AppJmol extends GStructureViewer implements Runnable, SequenceStructureBinding @@ -47,8 +48,8 @@ public class AppJmol extends GStructureViewer implements Runnable, { AppJmolBinding jmb; - ScriptWindow scriptWindow; - + JPanel scriptWindow; + JSplitPane splitPane; RenderPanel renderPanel; @@ -332,7 +333,15 @@ public class AppJmol extends GStructureViewer implements Runnable, this.getContentPane().add(renderPanel, java.awt.BorderLayout.CENTER); jalview.gui.Desktop.addInternalFrame(this, jmb.getViewerTitle(), getBounds().width, getBounds().height); - jmb.allocateViewer(renderPanel, true, "", null, null, ""); + if (scriptWindow == null) + { + BorderLayout bl = new BorderLayout(); + bl.setHgap(0); + bl.setVgap(0); + scriptWindow = new JPanel(bl); + scriptWindow.setVisible(false); + }; + jmb.allocateViewer(renderPanel, true, "", null, null, "", scriptWindow, null); jmb.newJmolPopup(true, "Jmol", true); jmb.evalStateCommand(command); jmb.setFinishedInit(true); @@ -405,6 +414,7 @@ public class AppJmol extends GStructureViewer implements Runnable, void closeViewer() { jmb.closeViewer(); + // TODO: check for memory leaks where instance isn't finalised because jmb // holds a reference to the window jmb = null; @@ -777,11 +787,8 @@ public class AppJmol extends GStructureViewer implements Runnable, { } } - - public void showConsole(boolean showConsole) +public void showConsole(boolean showConsole) { - if (scriptWindow == null) - scriptWindow = new ScriptWindow(this); if (showConsole) { @@ -791,15 +798,19 @@ public class AppJmol extends GStructureViewer implements Runnable, splitPane.setTopComponent(renderPanel); splitPane.setBottomComponent(scriptWindow); this.getContentPane().add(splitPane, BorderLayout.CENTER); + splitPane.setDividerLocation(getHeight() - 200); + scriptWindow.setVisible(true); + scriptWindow.validate(); + splitPane.validate(); } - splitPane.setDividerLocation(getHeight() - 200); - splitPane.validate(); } else { if (splitPane != null) - splitPane.setVisible(false); + { + splitPane.setVisible(false); + } splitPane = null; @@ -808,7 +819,6 @@ public class AppJmol extends GStructureViewer implements Runnable, validate(); } - class RenderPanel extends JPanel { final Dimension currentSize = new Dimension();