/*
- * 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.
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
{
AppJmolBinding jmb;
- ScriptWindow scriptWindow;
+ JPanel scriptWindow;
JSplitPane splitPane;
* @param pdbentry
* @param seq
* @param chains
- * @param alignFrame
+ * @param alignFrame
* @param align
* if true, new structure(s) will be align using associated alignment
*/
private void addStructure(final PDBEntry pdbentry, final SequenceI[] seq,
- final String[] chains, final boolean b, final IProgressIndicator alignFrame)
+ final String[] chains, final boolean b,
+ final IProgressIndicator alignFrame)
{
if (pdbentry.getFile() == null)
{
addingStructures = true;
_started = false;
alignAddedStructures = b;
- progressBar = alignFrame; // visual indication happens on caller frame.
+ progressBar = alignFrame; // visual indication happens on caller frame.
(worker = new Thread(this)).start();
return;
}
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);
void closeViewer()
{
jmb.closeViewer();
+
// TODO: check for memory leaks where instance isn't finalised because jmb
// holds a reference to the window
jmb = null;
// retrieve the pdb and store it locally
AlignmentI pdbseq = null;
pdbid = jmb.pdbentry[pi].getId();
- long hdl=pdbid.hashCode()-System.currentTimeMillis();
+ long hdl = pdbid.hashCode() - System.currentTimeMillis();
if (progressBar != null)
{
- progressBar.setProgressBar("Fetching PDB " + pdbid,
- hdl);
+ progressBar.setProgressBar("Fetching PDB " + pdbid, hdl);
}
try
{
{
Cache.log.error("Couldn't add files to Jmol viewer!", ex);
}
- long lastnotify=jmb.getLoadNotifiesHandled();
- // need to wait around until script has finished
- while (lastnotify>=jmb.getLoadNotifiesHandled());
+ long lastnotify = jmb.getLoadNotifiesHandled();
+ // need to wait around until script has finished
+ while (lastnotify >= jmb.getLoadNotifiesHandled())
+ ;
+ {
+ try
{
- try
- {
- Thread.sleep(35);
- } catch (Exception e)
- {
- }
- }
- // refresh the sequence colours for the new structure(s)
- jmb.updateColours(ap);
- // do superposition if asked to
- if (alignAddedStructures)
+ Thread.sleep(35);
+ } catch (Exception e)
{
- javax.swing.SwingUtilities.invokeLater(new Runnable()
+ }
+ }
+ // refresh the sequence colours for the new structure(s)
+ jmb.updateColours(ap);
+ // do superposition if asked to
+ if (alignAddedStructures)
+ {
+ javax.swing.SwingUtilities.invokeLater(new Runnable()
{
public void run()
{
public void showConsole(boolean showConsole)
{
- if (scriptWindow == null)
- scriptWindow = new ScriptWindow(this);
if (showConsole)
{
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 = null;