this.pdbentry = pdbentry;
this.sequence = seq;
- ssm = StructureSelectionManager.getStructureSelectionManager();
+ ssm = StructureSelectionManager.getStructureSelectionManager(ap.av.applet);
try
{
this.pdbentry = pdbentry;
this.sequence = seq;
- ssm = StructureSelectionManager.getStructureSelectionManager();
+ ssm = ap.av.getStructureSelectionManager();
try
{
package jalview.api;
import jalview.datamodel.AlignmentI;
+import jalview.structure.StructureSelectionManager;
/**
* abstract interface implemented by alignment panels holding an alignment view
{
AlignmentI getAlignment();
-
+ StructureSelectionManager getStructureSelectionManager();
}
if (PaintRefresher.components.size() == 0 && viewport.applet == null)\r
{\r
System.exit(0);\r
+ } else {\r
}\r
-\r
+ viewport = null;\r
+ alignPanel = null;\r
this.dispose();\r
}\r
\r
}\r
\r
jalview.structure.StructureSelectionManager\r
- .getStructureSelectionManager().sequenceColoursChanged(\r
+ .getStructureSelectionManager(viewport.applet).sequenceColoursChanged(\r
alignPanel);\r
\r
alignPanel.paintAlignment(true);\r
if (applet.useXtrnalSviewer)\r
{\r
// register the association(s) and quit, don't create any windows.\r
- if (StructureSelectionManager.getStructureSelectionManager().setMapping(seqs, chains, pdb.getFile(), protocol)==null) {\r
+ if (StructureSelectionManager.getStructureSelectionManager(applet).setMapping(seqs, chains, pdb.getFile(), protocol)==null) {\r
System.err.println("Failed to map "+pdb.getFile()+" ("+protocol+") to any sequences");\r
}\r
return;\r
{\r
alignPanel.seqPanel.selection(sel, csel, null);\r
}\r
+\r
+ public void scrollTo(int row, int column)\r
+ {\r
+ alignPanel.seqPanel.scrollTo(row, column); \r
+ }\r
}\r
import jalview.datamodel.*;
import jalview.schemes.*;
import jalview.structure.SelectionSource;
+import jalview.structure.StructureSelectionManager;
import jalview.structure.VamsasSource;
public class AlignViewport implements SelectionSource, VamsasSource
String sequenceSetID;
Hashtable hiddenRepSequences;
+
+ public void finalize() {
+ applet=null;
+ quality=null;
+ alignment=null;
+ colSel=null;
+ }
public AlignViewport(AlignmentI al, JalviewLite applet)
{
public void sendSelection()
{
jalview.structure.StructureSelectionManager
- .getStructureSelectionManager().sendSelection(
+ .getStructureSelectionManager(applet).sendSelection(
new SequenceGroup(getSelectionGroup()),
new ColumnSelection(getColumnSelection()), this);
}
import jalview.api.AlignmentViewPanel;
import jalview.datamodel.*;
+import jalview.structure.StructureSelectionManager;
public class AlignmentPanel extends Panel implements AdjustmentListener, AlignmentViewPanel
{
// this value is set false when selection area being dragged
boolean fastPaint = true;
-
+
+ public void finalize() {
+ alignFrame=null;
+ av=null;
+ seqPanel=null;
+ seqPanelHolder=null;
+ sequenceHolderPanel=null;
+ scalePanel=null;
+ scalePanelHolder=null;
+ annotationPanel=null;
+ annotationPanelHolder=null;
+ annotationSpaceFillerHolder=null;
+ }
public AlignmentPanel(AlignFrame af, final AlignViewport av)
{
try
setScrollValues(av.getStartRes(), av.getStartSeq());
repaint();
}
+
});
Dimension d = calculateIdWidth();
}
if (av.applet.debug) {
// DEBUG
- System.out.println("DEBUG: scroll didn't happen: start=" + r[0]
+ System.out.println("DEBUG: scroll: start=" + r[0]
+ " av.getStartRes()=" + av.getStartRes() + " end=" + r[1]
+ " seq.end=" + seq.getEnd() + " av.getEndRes()="
+ av.getEndRes() + " hextent=" + hextent);
{
return false;
}
- if (av.hasHiddenColumns)
+ return scrollTo(start, end, seqIndex, false, redrawOverview);
+ }
+ return true;
+ }
+ public boolean scrollTo(int ostart, int end, int seqIndex, boolean scrollToNearest, boolean redrawOverview)
+ {
+ int start=-1;
+ if (av.hasHiddenColumns)
+ {
+ start = av.getColumnSelection().findColumnPosition(ostart);
+ end = av.getColumnSelection().findColumnPosition(end);
+ if (start == end)
{
- start = av.getColumnSelection().findColumnPosition(start);
- end = av.getColumnSelection().findColumnPosition(end);
- if (start == end)
+ if (!scrollToNearest && !av.colSel.isVisible(ostart))
{
- if (!av.colSel.isVisible(r[0]))
- {
- // don't scroll - position isn't visible
- return false;
- }
+ // don't scroll - position isn't visible
+ return false;
+ }
}
}
if (!av.wrapAlignment)
{
scrollToWrappedVisible(start);
}
- }
if (redrawOverview && overviewPanel != null)
{
overviewPanel.setBoxPosition();
{
overviewPanel.setBoxPosition();
}
+ sendViewPosition();
+
}
annotationPanel.fastPaint(av.getStartRes() - oldX);
}
}
+ sendViewPosition();
}
+ private void sendViewPosition()
+ {
+ StructureSelectionManager.getStructureSelectionManager(av.applet).sendViewPosition(this, av.startRes, av.endRes, av.startSeq, av.endSeq);
+ }
public void paintAlignment(boolean updateOverview)
{
if (updateOverview)
{
jalview.structure.StructureSelectionManager
- .getStructureSelectionManager().sequenceColoursChanged(this);
+ .getStructureSelectionManager(av.applet).sequenceColoursChanged(this);
if (overviewPanel != null)
{
{
return av.alignment;
}
+ @Override
+ public StructureSelectionManager getStructureSelectionManager()
+ {
+ return StructureSelectionManager.getStructureSelectionManager(av.applet);
+ }
}
AlignmentPanel ap, String protocol)
{
this.ap = ap;
- jmb = new AppletJmolBinding(this, new PDBEntry[]
+ jmb = new AppletJmolBinding(this, ap.getStructureSelectionManager(), new PDBEntry[]
{ pdbentry }, new SequenceI[][]
{ seq }, new String[][]
{ chains }, protocol);
}
String alreadyMapped = StructureSelectionManager
- .getStructureSelectionManager().alreadyMappedToFile(
+ .getStructureSelectionManager(ap.av.applet).alreadyMappedToFile(
pdbentry.getId());
MCview.PDBfile reader = null;
if (alreadyMapped != null)
{
- reader = StructureSelectionManager.getStructureSelectionManager()
+ reader = StructureSelectionManager.getStructureSelectionManager(ap.av.applet)
.setMapping(seq, chains, pdbentry.getFile(), protocol);
// PROMPT USER HERE TO ADD TO NEW OR EXISTING VIEW?
// FOR NOW, LETS JUST OPEN A NEW WINDOW
{
for (int s = 0; s < jmb.pdbentry.length; s++)
{
- sb.append(StructureSelectionManager
- .getStructureSelectionManager().printMapping(
+ sb.append(jmb.printMapping(
jmb.pdbentry[s].getFile()));
sb.append("\n");
}
import jalview.datamodel.AlignmentI;
import jalview.datamodel.PDBEntry;
import jalview.datamodel.SequenceI;
+import jalview.structure.StructureSelectionManager;
import org.jmol.api.JmolAppConsoleInterface;
import org.jmol.api.JmolViewer;
*/
private AppletJmol appletJmolBinding;
- public AppletJmolBinding(AppletJmol appletJmol, PDBEntry[] pdbentry,
+ public AppletJmolBinding(AppletJmol appletJmol, StructureSelectionManager sSm, PDBEntry[] pdbentry,
SequenceI[][] seq, String[][] chains, String protocol)
{
- super(pdbentry, seq, chains, protocol);
+ super(sSm, pdbentry, seq, chains, protocol);
appletJmolBinding = appletJmol;
}
@Override
public void releaseReferences(Object svl)
{
- // TODO Auto-generated method stub
-
}
}
PDBEntry[] pdbentry, SequenceI[][] seq, String[][] chains,
String protocol)
{
- super(pdbentry, seq, chains, protocol);
+ super(alframe.alignPanel.getStructureSelectionManager(), pdbentry, seq, chains, protocol);
}
public ExtJmol(JmolViewer viewer, AlignmentPanel alignPanel,
SequenceI[][] seqs)
{
- super(viewer);
+ super(alignPanel.getStructureSelectionManager(), viewer);
ap = alignPanel;
this.sequence = seqs;
notifyFileLoaded(null, null, null, null, 0);
seqCanvas.addMouseMotionListener(this);
seqCanvas.addMouseListener(this);
- ssm = StructureSelectionManager.getStructureSelectionManager();
+ ssm = StructureSelectionManager.getStructureSelectionManager(av.applet);
ssm.addStructureViewerListener(this);
seqCanvas.repaint();
}
}
+ /**
+ * scroll to the given row/column - or nearest visible location
+ * @param row
+ * @param column
+ */
+ public void scrollTo(int row, int column)
+ {
+
+ row = row<0 ? ap.av.startSeq : row;
+ column = column<0 ? ap.av.startRes : column;
+ ap.scrollTo(row, row, column, true, true);
+ }
+
}
{
return tree;
}
+
+ public void finalize() throws Throwable {
+ ap=null;
+ av=null;
+ super.finalize();
+ }
/**
* Creates a new TreePanel object.
*/\r
package jalview.bin;\r
\r
+import jalview.api.StructureSelectionManagerProvider;\r
import jalview.appletgui.AlignFrame;\r
+import jalview.appletgui.AlignViewport;\r
import jalview.appletgui.EmbmenuFrame;\r
import jalview.appletgui.FeatureSettings;\r
import jalview.datamodel.Alignment;\r
* Jalview Applet. Runs in Java 1.18 runtime\r
* \r
* @author $author$\r
- * @version $Revision$\r
+ * @version $Revision: 1.92 $\r
*/\r
-public class JalviewLite extends Applet\r
+public class JalviewLite extends Applet implements StructureSelectionManagerProvider\r
{\r
\r
// /////////////////////////////////////////\r
&& (alignedPosition.trim().length() == 0 || alignedPosition\r
.toLowerCase().indexOf("false") > -1))\r
{\r
- StructureSelectionManager.getStructureSelectionManager()\r
+ StructureSelectionManager.getStructureSelectionManager(this)\r
.mouseOverVamsasSequence(sq, sq.findIndex(apos), null);\r
}\r
else\r
{\r
- StructureSelectionManager.getStructureSelectionManager()\r
+ StructureSelectionManager.getStructureSelectionManager(this)\r
.mouseOverVamsasSequence(sq, apos, null);\r
}\r
\r
setMouseoverListener(currentAlignFrame, listener);\r
}\r
\r
- private Vector javascriptListeners = new Vector();\r
+ private Vector<jalview.javascript.JSFunctionExec> javascriptListeners = new Vector<jalview.javascript.JSFunctionExec>();\r
\r
public void setMouseoverListener(AlignFrame af, String listener)\r
{\r
jalview.javascript.MouseOverListener mol = new jalview.javascript.MouseOverListener(\r
this, af, listener);\r
javascriptListeners.addElement(mol);\r
- StructureSelectionManager.getStructureSelectionManager()\r
+ StructureSelectionManager.getStructureSelectionManager(this)\r
.addStructureViewerListener(mol);\r
if (debug)\r
{\r
jalview.javascript.JsSelectionSender mol = new jalview.javascript.JsSelectionSender(\r
this, af, listener);\r
javascriptListeners.addElement(mol);\r
- StructureSelectionManager.getStructureSelectionManager()\r
+ StructureSelectionManager.getStructureSelectionManager(this)\r
.addSelectionListener(mol);\r
if (debug)\r
{\r
jalview.javascript.MouseOverStructureListener mol = new jalview.javascript.MouseOverStructureListener(\r
this, listener, separatorListToArray(modelSet));\r
javascriptListeners.addElement(mol);\r
- StructureSelectionManager.getStructureSelectionManager()\r
+ StructureSelectionManager.getStructureSelectionManager(this)\r
.addStructureViewerListener(mol);\r
if (debug)\r
{\r
msSize--;\r
if (lstner instanceof SelectionListener)\r
{\r
- StructureSelectionManager.getStructureSelectionManager()\r
+ StructureSelectionManager.getStructureSelectionManager(this)\r
.removeSelectionListener((SelectionListener) lstner);\r
}\r
else\r
{\r
- StructureSelectionManager.getStructureSelectionManager()\r
+ StructureSelectionManager.getStructureSelectionManager(this)\r
.removeStructureViewerListener(lstner, null);\r
}\r
rprt = debug;\r
\r
public void stop()\r
{\r
+ System.err.println("Applet "+getName()+" stop().");\r
+ tidyUp();\r
+ }\r
+ public void destroy()\r
+ {\r
+ System.err.println("Applet "+getName()+" destroy().");\r
+ tidyUp();\r
+ }\r
+ private void tidyUp()\r
+ {\r
+ removeAll();\r
+ if (currentAlignFrame!=null && currentAlignFrame.viewport!=null\r
+ && currentAlignFrame.viewport.applet!=null)\r
+ {\r
+ AlignViewport av = currentAlignFrame.viewport;\r
+ currentAlignFrame.closeMenuItem_actionPerformed();\r
+ av.applet=null;\r
+ currentAlignFrame=null;\r
+ }\r
if (javascriptListeners != null)\r
{\r
while (javascriptListeners.size() > 0)\r
{\r
- Object mol = javascriptListeners.elementAt(0);\r
+ jalview.javascript.JSFunctionExec mol = javascriptListeners.elementAt(0);\r
javascriptListeners.removeElement(mol);\r
if (mol instanceof SelectionListener)\r
{\r
- StructureSelectionManager.getStructureSelectionManager()\r
+ StructureSelectionManager.getStructureSelectionManager(this)\r
.removeSelectionListener((SelectionListener) mol);\r
}\r
else\r
{\r
- StructureSelectionManager.getStructureSelectionManager()\r
+ StructureSelectionManager.getStructureSelectionManager(this)\r
.removeStructureViewerListener(mol, null);\r
}\r
+ mol.jvlite=null;\r
}\r
}\r
- jsFunctionExec.stopQueue();\r
+ if (jsFunctionExec!=null) {\r
+ jsFunctionExec.stopQueue();\r
+ jsFunctionExec.jvlite=null;\r
+ }\r
+ initialAlignFrame=null;\r
+ jsFunctionExec = null;\r
+ javascriptListeners=null;\r
+ StructureSelectionManager.release(this);\r
}\r
private jalview.javascript.JSFunctionExec jsFunctionExec;\r
/**\r
{\r
try\r
{\r
- StructureSelectionManager.getStructureSelectionManager()\r
+ StructureSelectionManager.getStructureSelectionManager(this)\r
.mouseOverStructure(new Integer(pdbResNum).intValue(), chain,\r
pdbfile);\r
if (debug)\r
+ pdbResNum + "'");\r
}\r
}\r
+ /**\r
+ * adjust horizontal/vertical scroll to the make the given location the top left hand corner for given current view\r
+ * \r
+ * @param alf\r
+ * @param topRow\r
+ * @param leftHandColumn\r
+ */\r
+ public void scrollViewToIn(AlignFrame alf, String topRow, String leftHandColumn)\r
+ {\r
+ try {\r
+ alf.scrollTo(new Integer(topRow).intValue(), new Integer(leftHandColumn).intValue());\r
+ \r
+ } catch (Exception ex)\r
+ {\r
+ System.err.println("Couldn't parse integer arguments (topRow='"+topRow+"' and leftHandColumn='"+leftHandColumn+"'");\r
+ ex.printStackTrace();\r
+ }\r
+ }\r
\r
// //////////////////////////////////////////////\r
// //////////////////////////////////////////////\r
{\r
if (frame instanceof AlignFrame)\r
{\r
+ AlignViewport vp = ((AlignFrame) frame).viewport;\r
((AlignFrame) frame).closeMenuItem_actionPerformed();\r
- if (((AlignFrame) frame).viewport.applet.currentAlignFrame == frame)\r
+ if (vp.applet.currentAlignFrame == frame)\r
{\r
- ((AlignFrame) frame).viewport.applet.currentAlignFrame = null;\r
+ vp.applet.currentAlignFrame = null;\r
}\r
+ vp.applet=null;\r
+ vp=null;\r
+ \r
}\r
lastFrameX -= 40;\r
lastFrameY -= 40;\r
applet.remove(launcher);\r
applet.repaint();\r
}\r
+ callInitCallback();\r
}\r
\r
/**\r
\r
public void start()\r
{\r
- callInitCallback();\r
+// callInitCallback();\r
}\r
private Hashtable<String,long[]> jshashes=new Hashtable<String,long[]>();\r
private Hashtable<String,Hashtable<String,String[]>> jsmessages=new Hashtable<String,Hashtable<String,String[]>>();\r
import jalview.api.FeatureRenderer;\r
import jalview.api.SequenceRenderer;\r
import jalview.api.SequenceStructureBinding;\r
+import jalview.api.StructureSelectionManagerProvider;\r
import jalview.datamodel.*;\r
import jalview.structure.*;\r
import jalview.io.*;\r
\r
public abstract class JalviewJmolBinding implements StructureListener,\r
JmolStatusListener, SequenceStructureBinding,\r
- JmolSelectionListener, ComponentListener\r
+ JmolSelectionListener, ComponentListener, StructureSelectionManagerProvider\r
\r
{\r
/**\r
*/\r
public SequenceI[][] sequence;\r
\r
- StructureSelectionManager ssm;\r
+ public StructureSelectionManager ssm;\r
\r
public JmolViewer viewer;\r
\r
- public JalviewJmolBinding(PDBEntry[] pdbentry, SequenceI[][] sequenceIs,\r
+ public JalviewJmolBinding(StructureSelectionManager ssm, PDBEntry[] pdbentry, SequenceI[][] sequenceIs,\r
String[][] chains, String protocol)\r
{\r
+ this.ssm = ssm;\r
this.sequence = sequenceIs;\r
this.chains = chains;\r
this.pdbentry = pdbentry;\r
*/\r
}\r
\r
- public JalviewJmolBinding(JmolViewer viewer2)\r
+ public JalviewJmolBinding(StructureSelectionManager ssm, JmolViewer viewer2)\r
{\r
+ this.ssm = ssm;\r
viewer = viewer2;\r
viewer.setJmolStatusListener(this);\r
viewer.addSelectionListener(this);\r
{\r
viewer.setModeMouse(org.jmol.viewer.JmolConstants.MOUSE_NONE);\r
// remove listeners for all structures in viewer\r
- StructureSelectionManager.getStructureSelectionManager()\r
- .removeStructureViewerListener(this, this.getPdbFile());\r
+ ssm.removeStructureViewerListener(this, this.getPdbFile());\r
// and shut down jmol\r
viewer.evalStringQuiet("zap");\r
viewer.setJmolStatusListener(null);\r
chainFile = new Hashtable();\r
boolean notifyLoaded = false;\r
String[] modelfilenames = getPdbFile();\r
- ssm = StructureSelectionManager.getStructureSelectionManager();\r
// first check if we've lost any structures\r
if (oldmodels != null && oldmodels.length > 0)\r
{\r
chains[pe] = null;\r
}\r
}\r
+ /**\r
+ * \r
+ * @param pdbfile\r
+ * @return text report of alignment between pdbfile and any associated alignment sequences\r
+ */\r
+ public String printMapping(String pdbfile)\r
+ {\r
+ return ssm.printMapping(pdbfile);\r
+ }\r
+\r
}\r
import java.awt.*;
import jalview.analysis.*;
+import jalview.api.StructureSelectionManagerProvider;
import jalview.bin.*;
* DOCUMENT ME!
*
* @author $author$
- * @version $Revision$
+ * @version $Revision: 1.141 $
*/
public class AlignViewport implements SelectionSource, VamsasSource
{
{
if (alignment != null && alignment.getCodonFrames() != null)
{
- StructureSelectionManager.getStructureSelectionManager()
+ StructureSelectionManager.getStructureSelectionManager(Desktop.instance)
.removeMappings(alignment.getCodonFrames());
}
this.alignment = align;
if (alignment.getCodonFrames() != null)
{
- StructureSelectionManager.getStructureSelectionManager().addMappings(
+ StructureSelectionManager.getStructureSelectionManager(Desktop.instance).addMappings(
alignment.getCodonFrames());
}
}
public void sendSelection()
{
jalview.structure.StructureSelectionManager
- .getStructureSelectionManager().sendSelection(
+ .getStructureSelectionManager(Desktop.instance).sendSelection(
new SequenceGroup(getSelectionGroup()),
new ColumnSelection(getColumnSelection()), this);
}
}
}
}
+
+ public StructureSelectionManager getStructureSelectionManager()
+ {
+ return StructureSelectionManager.getStructureSelectionManager(Desktop.instance);
+ }
}
import jalview.jbgui.*;
import jalview.schemes.*;
import jalview.structure.SelectionSource;
+import jalview.structure.StructureSelectionManager;
/**
* DOCUMENT ME!
*
* @author $author$
- * @version $Revision$
+ * @version $Revision: 1.161 $
*/
public class AlignmentPanel extends GAlignmentPanel implements
AdjustmentListener, Printable, AlignmentViewPanel
if (updateOverview)
{
- jalview.structure.StructureSelectionManager
- .getStructureSelectionManager().sequenceColoursChanged(this);
+ av.getStructureSelectionManager().sequenceColoursChanged(this);
if (overviewPanel != null)
{
*/
public void closePanel()
{
- jalview.structure.StructureSelectionManager ssm = jalview.structure.StructureSelectionManager
- .getStructureSelectionManager();
- ssm.removeStructureViewerListener(seqPanel, null);
- ssm.removeSelectionListener(seqPanel);
PaintRefresher.RemoveComponent(seqPanel.seqCanvas);
PaintRefresher.RemoveComponent(idPanel.idCanvas);
PaintRefresher.RemoveComponent(this);
if (av != null)
{
+ jalview.structure.StructureSelectionManager ssm = av.getStructureSelectionManager();
+ ssm.removeStructureViewerListener(seqPanel, null);
+ ssm.removeSelectionListener(seqPanel);
av.alignment = null;
av = null;
}
alignFrame.setDisplayedView(this);
}
}
+
+ @Override
+ public StructureSelectionManager getStructureSelectionManager()
+ {
+ return av.getStructureSelectionManager();
+ }
}
}
// / TODO: check if protocol is needed to be set, and if chains are
// autodiscovered.
- jmb = new AppJmolBinding(this, pdbentrys, seqs, null, null);
+ jmb = new AppJmolBinding(this, ap.getStructureSelectionManager(), pdbentrys, seqs, null, null);
jmb.setLoadingFromArchive(true);
addAlignmentPanel(ap);
progressBar = ap.alignFrame;
// ////////////////////////////////
// Is the pdb file already loaded?
- String alreadyMapped = StructureSelectionManager
- .getStructureSelectionManager().alreadyMappedToFile(
+ String alreadyMapped = jmb.ssm.alreadyMappedToFile(
pdbentry.getId());
if (alreadyMapped != null)
if (option == JOptionPane.YES_OPTION)
{
- StructureSelectionManager.getStructureSelectionManager()
- .setMapping(seq, chains, alreadyMapped,
+ jmb.ssm.setMapping(seq, chains, alreadyMapped,
AppletFormatAdapter.FILE);
if (ap.seqPanel.seqCanvas.fr != null)
{
}
// /////////////////////////////////
- jmb = new AppJmolBinding(this, new PDBEntry[]
+ jmb = new AppJmolBinding(this, ap.getStructureSelectionManager(), new PDBEntry[]
{ pdbentry }, new SequenceI[][]
{ seq }, null, null);
addAlignmentPanel(ap);
{
for (int pdbe = 0; pdbe < jmb.pdbentry.length; pdbe++)
{
- cap.appendText(StructureSelectionManager
- .getStructureSelectionManager().printMapping(
+ cap.appendText(jmb.printMapping(
jmb.pdbentry[pdbe].getFile()));
cap.appendText("\n");
}
import jalview.datamodel.AlignmentI;
import jalview.datamodel.PDBEntry;
import jalview.datamodel.SequenceI;
+import jalview.structure.StructureSelectionManager;
import org.jmol.api.JmolAppConsoleInterface;
import org.jmol.api.JmolViewer;
*/
private AppJmol appJmolWindow;
- public AppJmolBinding(AppJmol appJmol, PDBEntry[] pdbentry,
+ public AppJmolBinding(AppJmol appJmol, StructureSelectionManager sSm, PDBEntry[] pdbentry,
SequenceI[][] sequenceIs, String[][] chains, String protocol)
{
- super(pdbentry, sequenceIs, chains, protocol);
+ super(sSm, pdbentry, sequenceIs, chains, protocol);
appJmolWindow = appJmol;
}
*
*
* @author $author$
- * @version $Revision$
+ * @version $Revision: 1.155 $
*/
public class Desktop extends jalview.jbgui.GDesktop implements
- DropTargetListener, ClipboardOwner, IProgressIndicator
+ DropTargetListener, ClipboardOwner, IProgressIndicator, jalview.api.StructureSelectionManagerProvider
{
private JalviewChangeSupport changeSupport = new JalviewChangeSupport();
* will be :)
*
* @author $author$
- * @version $Revision$
+ * @version $Revision: 1.134 $
*/
public class Jalview2XML
{
String pdbFile = (String) filedat[0];
SequenceI[] seq = (SequenceI[]) ((Vector<SequenceI>) filedat[2])
.toArray(new SequenceI[0]);
- StructureSelectionManager.getStructureSelectionManager()
- .setMapping(seq, null, pdbFile,
+ ((AppJmol) comp).jmb.ssm.setMapping(seq, null, pdbFile,
jalview.io.AppletFormatAdapter.FILE);
((AppJmol) comp).jmb.addSequenceForStructFile(pdbFile, seq);
}
* DOCUMENT ME!
*
* @author $author$
- * @version $Revision$
+ * @version $Revision: 1.118 $
*/
public class PopupMenu extends JPopupMenu
{
public void colourByStructure(String pdbid)
{
- Annotation[] anots = jalview.structure.StructureSelectionManager
- .getStructureSelectionManager().colourSequenceFromStructure(
+ Annotation[] anots = ap.av.getStructureSelectionManager().colourSequenceFromStructure(
sequence, pdbid);
AlignmentAnnotation an = new AlignmentAnnotation("Structure",
* DOCUMENT ME!
*
* @author $author$
- * @version $Revision$
+ * @version $Revision: 1.130 $
*/
public class SeqPanel extends JPanel implements MouseListener,
MouseMotionListener, MouseWheelListener, SequenceListener,
addMouseMotionListener(this);
addMouseListener(this);
addMouseWheelListener(this);
- ssm = StructureSelectionManager.getStructureSelectionManager();
+ ssm = StructureSelectionManager.getStructureSelectionManager(Desktop.instance);
ssm.addStructureViewerListener(this);
ssm.addSelectionListener(this);
}
{
final IPickManager pm = vclient.getPickManager();
final StructureSelectionManager ssm = StructureSelectionManager
- .getStructureSelectionManager();
+ .getStructureSelectionManager(Desktop.instance);
final VamsasApplication me = this;
pm.registerMessageHandler(new IMessageHandler()
{
if (mappings != null && mappings.length > 0)
{
jalview.structure.StructureSelectionManager
- .getStructureSelectionManager().addMappings(mappings);
+ .getStructureSelectionManager(Desktop.instance).addMappings(mappings);
}
}
}
import jalview.datamodel.AlignedCodonFrame;
import jalview.datamodel.Mapping;
import jalview.datamodel.SequenceI;
+import jalview.gui.Desktop;
import jalview.io.VamsasAppDatastore;
import uk.ac.vamsas.client.Vobject;
import uk.ac.vamsas.objects.core.AlignmentSequence;
}
bindjvvobj(mapping, sequenceMapping);
jalview.structure.StructureSelectionManager
- .getStructureSelectionManager().addMappings(
+ .getStructureSelectionManager(Desktop.instance).addMappings(
new AlignedCodonFrame[]
{ afc });
// Try to link up any conjugate database references in the two sequences
\r
public class JSFunctionExec implements Runnable\r
{\r
- JalviewLite jvlite;\r
+ public JalviewLite jvlite;\r
\r
public JSFunctionExec(JalviewLite applet)\r
{\r
jsExecQueue = jvlite.getJsExecQueue();\r
jvlite.setExecutor(this);\r
}\r
-\r
+ public void finalize() {\r
+ jvlite=null;\r
+ executor=null;\r
+ if (jsExecQueue!=null)\r
+ {\r
+ jsExecQueue.clear();\r
+ }\r
+ jsExecQueue=null;\r
+ }\r
private Vector jsExecQueue;\r
\r
private Thread executor = null;\r
{\r
if (jsExecQueue != null)\r
{\r
+ Vector<JSFunctionExec> q=null;\r
synchronized (jsExecQueue)\r
{\r
- Vector q = jsExecQueue;\r
- q.removeAllElements();\r
+ q = jsExecQueue;\r
jsExecQueue = null;\r
+ }\r
+ if (q!=null ) {\r
+ for (JSFunctionExec jx : q)\r
+ {\r
+ jx.jvlite=null;\r
+ \r
+ }\r
+ q.removeAllElements();\r
synchronized (q)\r
{\r
q.notifyAll();\r
}\r
}\r
- executor = null;\r
}\r
+ jvlite=null;\r
+ executor = null;\r
}\r
\r
public void run()\r
{\r
final Object source = srce;\r
StructureSelectionManager ssm = StructureSelectionManager\r
- .getStructureSelectionManager();\r
+ .getStructureSelectionManager(jvlite);\r
// if (jvlite.debug)\r
// {\r
// ssm.reportMapping();\r
final String[] colcommands = JmolCommands.getColourBySequenceCommand(\r
ssm, modelSet, sequence, sr, fr,\r
((AlignmentViewPanel) source).getAlignment());\r
+ if (colcommands==null)\r
+ {\r
+ // \r
+ return;\r
+ }\r
String mclass,mhandle;\r
if (jvlite.isJsMessageSetChanged(mclass="colourstruct",mhandle=((jalview.appletgui.AlignmentPanel) source).av\r
.getViewId(), colcommands)) {\r
jvlite.setJsMessageSet(mclass, mhandle , colcommands);\r
// and notify javascript handler\r
- String st[] = new String[0];\r
+ String st[] = new String[]\r
+ {\r
+ "colourstruct",\r
+ ""\r
+ + ((jalview.appletgui.AlignmentPanel) source).av\r
+ .getViewId(), ""+colcommands.length, ""+(colcommands[0]!=null ? colcommands[0].length() : 0)};\r
try\r
{\r
executeJavascriptFunction(\r
true,\r
- _listenerfn,\r
- st = new String[]\r
- {\r
- "colourstruct",\r
- ""\r
- + ((jalview.appletgui.AlignmentPanel) source).av\r
- .getViewId(), ""+colcommands.length, "" });\r
+ _listenerfn,st\r
+);\r
} catch (Exception ex)\r
{\r
System.err.println("Couldn't execute callback with "\r
return _listenerfn;\r
}\r
\r
+ public void finalise()\r
+ {\r
+ jvlite=null;\r
+ super.finalize();\r
+ }\r
@Override\r
public void releaseReferences(Object svl)\r
{\r
+ \r
// TODO Auto-generated method stub\r
\r
}\r
import MCview.*;
import jalview.analysis.*;
+import jalview.api.AlignmentViewPanel;
+import jalview.api.StructureSelectionManagerProvider;
import jalview.datamodel.*;
public class StructureSelectionManager
{
- static StructureSelectionManager instance;
+ static IdentityHashMap<StructureSelectionManagerProvider,StructureSelectionManager> instances;
StructureMapping[] mappings;
}\r
Hashtable mappingData = new Hashtable();
- public static StructureSelectionManager getStructureSelectionManager()
+ public static StructureSelectionManager getStructureSelectionManager(StructureSelectionManagerProvider context)
{
- if (instance == null)
+ if (instances == null)
{
- instance = new StructureSelectionManager();
+ instances = new java.util.IdentityHashMap<StructureSelectionManagerProvider,StructureSelectionManager>();
+ }
+ StructureSelectionManager instance=instances.get(context);
+ if (instance==null)
+ {
+ instances.put(context, instance=new StructureSelectionManager());
}
-
return instance;
}
}
}
}
- if (results.getSize() > 0)
+ if (results!=null)
{
for (int i = 0; i < listeners.size(); i++)
{
modifySeqMappingList(true, codonFrames);
}
- Vector sel_listeners = new Vector();
+ Vector<SelectionListener> sel_listeners = new Vector<SelectionListener>();
public void addSelectionListener(SelectionListener selecter)
{
}
}
}
+
+ Vector<AlignmentViewPanelListener> view_listeners=new Vector<AlignmentViewPanelListener>();
+ public synchronized void sendViewPosition(jalview.api.AlignmentViewPanel source, int startRes,
+ int endRes, int startSeq, int endSeq)
+ {
+
+ if (view_listeners != null && view_listeners.size() > 0)
+ {
+ Enumeration<AlignmentViewPanelListener> listeners = view_listeners.elements();
+ while (listeners.hasMoreElements())
+ {
+ AlignmentViewPanelListener slis = listeners
+ .nextElement();
+ if (slis != source)
+ {
+ slis.viewPosition(startRes, endRes, startSeq, endSeq, source);
+ }
+ ;
+ }
+ }
+ }
+
+
+ public void finalize() throws Throwable {
+ if (listeners!=null) {
+ listeners.clear();
+ listeners=null;
+ }
+ if (mappingData!=null)
+ {
+ mappingData.clear();
+ mappingData=null;
+ }
+ if (sel_listeners!=null)
+ {
+ sel_listeners.clear();
+ sel_listeners=null;
+ }
+ if (view_listeners!=null)
+ {
+ view_listeners.clear();
+ view_listeners=null;
+ }
+ mappings=null;
+ seqmappingrefs=null;
+ }
+
+ /**
+ * release all references associated with this manager provider
+ * @param jalviewLite
+ */
+ public static void release(StructureSelectionManagerProvider jalviewLite)
+ {
+ StructureSelectionManager mnger=(instances.get(jalviewLite));
+ if (mnger!=null)
+ {
+ instances.remove(jalviewLite);
+ try {
+ mnger.finalize();
+ } catch (Throwable x){};
+ }
+ }
+
}