X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fext%2Fjmol%2FJalviewJmolBinding.java;h=a314fd6cca1c4118d4a97830d6a9fbe905fc7569;hb=642c2b09a1ad285fca557ded382a5c175a943711;hp=916579fe26681739bbd84e6ad50802d6e4a444d7;hpb=103b87ed34e2ca785e4ecd16a2901feb85363558;p=jalview.git diff --git a/src/jalview/ext/jmol/JalviewJmolBinding.java b/src/jalview/ext/jmol/JalviewJmolBinding.java index 916579f..a314fd6 100644 --- a/src/jalview/ext/jmol/JalviewJmolBinding.java +++ b/src/jalview/ext/jmol/JalviewJmolBinding.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. @@ -43,7 +43,8 @@ import org.jmol.viewer.Viewer; import jalview.schemes.*; public abstract class JalviewJmolBinding implements StructureListener, - JmolStatusListener, SequenceStructureBinding, JmolSelectionListener, ComponentListener + JmolStatusListener, SequenceStructureBinding, + JmolSelectionListener, ComponentListener { /** @@ -79,6 +80,7 @@ public abstract class JalviewJmolBinding implements StructureListener, Vector atomsPicked = new Vector(); public Vector chainNames; + Hashtable chainFile; /** @@ -114,7 +116,7 @@ public abstract class JalviewJmolBinding implements StructureListener, public PDBEntry[] pdbentry; /** - * datasource protocol for access to PDBEntry + * datasource protocol for access to PDBEntrylatest */ String protocol = null; @@ -212,8 +214,8 @@ public abstract class JalviewJmolBinding implements StructureListener, mlength = lbl.indexOf(":", p); } while (p < mlength && mlength < (lbl.length() - 2)); // TODO: lookup each pdb id and recover proper model number for it. - cmd.append(":" + lbl.substring(mlength + 1) + " /" - + (1+getModelNum((String)chainFile.get(lbl))) + " or "); + cmd.append(":" + lbl.substring(mlength + 1) + " /" + + (1 + getModelNum((String) chainFile.get(lbl))) + " or "); } if (cmd.length() > 0) cmd.setLength(cmd.length() - 4); @@ -231,8 +233,15 @@ public abstract class JalviewJmolBinding implements StructureListener, viewer.setJmolStatusListener(null); lastCommand = null; viewer = null; + releaseUIResources(); } + /** + * called by JalviewJmolbinding after closeViewer is called - release any + * resources and references so they can be garbage collected. + */ + protected abstract void releaseUIResources(); + public void colourByChain() { colourBySequence = false; @@ -545,7 +554,7 @@ public abstract class JalviewJmolBinding implements StructureListener, Color col = sr.getResidueBoxColour(sequence[pdbfnum][s], r); - if (showFeatures && fr!=null) + if (showFeatures && fr != null) col = fr.findFeatureColour(col, sequence[pdbfnum][s], r); String newSelcom = (mapping[m].getChain() != " " ? ":" + mapping[m].getChain() : "") @@ -1319,7 +1328,7 @@ public abstract class JalviewJmolBinding implements StructureListener, * @param codeBase * @param commandOptions */ - public void allocateViewer(Component renderPanel, boolean jmolfileio, + public void allocateViewer(Container renderPanel, boolean jmolfileio, String htmlName, URL documentBase, URL codeBase, String commandOptions) { @@ -1342,7 +1351,7 @@ public abstract class JalviewJmolBinding implements StructureListener, * @param buttonsToShow * - buttons to show on the console, in ordr */ - public void allocateViewer(Component renderPanel, boolean jmolfileio, + public void allocateViewer(Container renderPanel, boolean jmolfileio, String htmlName, URL documentBase, URL codeBase, String commandOptions, final Container consolePanel, String buttonsToShow) @@ -1356,9 +1365,8 @@ public abstract class JalviewJmolBinding implements StructureListener, if (consolePanel != null) { consolePanel.addComponentListener(this); - - } + } } @@ -1367,30 +1375,25 @@ public abstract class JalviewJmolBinding implements StructureListener, protected org.jmol.api.JmolAppConsoleInterface console = null; -@Override -public void componentResized(ComponentEvent e) -{ - -} + public void componentResized(ComponentEvent e) + { -@Override -public void componentMoved(ComponentEvent e) -{ - -} + } -@Override -public void componentShown(ComponentEvent e) -{ - showConsole(true); -} + public void componentMoved(ComponentEvent e) + { -@Override -public void componentHidden(ComponentEvent e) -{ - showConsole(false); -} + } + public void componentShown(ComponentEvent e) + { + showConsole(true); + } + + public void componentHidden(ComponentEvent e) + { + showConsole(false); + } public void setLoadingFromArchive(boolean loadingFromArchive) {