From c7f05058ff22c137f7f2f62e8c0d64c41d38c871 Mon Sep 17 00:00:00 2001 From: jprocter Date: Fri, 20 Aug 2010 11:58:12 +0000 Subject: [PATCH] refactored external structure viewer binding API calls so they do not reference Jmol classes (re-instate's Jmol free launch of JalviewLite). --- src/jalview/appletgui/AlignFrame.java | 120 +++++++++++++++++++++++++++++++-- src/jalview/bin/JalviewLite.java | 43 +++--------- 2 files changed, 123 insertions(+), 40 deletions(-) diff --git a/src/jalview/appletgui/AlignFrame.java b/src/jalview/appletgui/AlignFrame.java index 14606b7..388d20f 100755 --- a/src/jalview/appletgui/AlignFrame.java +++ b/src/jalview/appletgui/AlignFrame.java @@ -21,6 +21,7 @@ import java.io.*; import java.net.*; import java.util.*; +import java.applet.Applet; import java.awt.*; import java.awt.event.*; @@ -3190,21 +3191,126 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, } } - public SequenceStructureBinding addJmolInstance(JmolViewer viewer, String[] sequenceIds) + /** + * create a new binding between structures in an existing jmol viewer instance + * and an alignpanel with sequences that have existing PDBFile entries. Note, + * this does not open a new Jmol window, or modify the display of the + * structures in the original jmol window. + * + * @param viewer JmolViewer instance + * @param sequenceIds + * - sequence Ids to search for associations + */ + public SequenceStructureBinding addStructureViewInstance(Object jmolviewer, String[] sequenceIds) { + org.jmol.api.JmolViewer viewer; + if (jmolviewer instanceof JmolViewer) + { + System.err.println("Unsupported viewer object :"+jmolviewer.getClass()); + return null; + } else { + viewer = (JmolViewer) jmolviewer; + } SequenceI[] seqs=null; if (sequenceIds==null || sequenceIds.length==0) { seqs = viewport.getAlignment().getSequencesArray(); } else { - // resolve seqs for sequenceIds. + Vector sqi=new Vector(); + AlignmentI al = viewport.getAlignment(); + for (int sid=0;sid0) { + seqs = new SequenceI[sqi.size()]; + for (int sid=0,sSize=sqi.size();sid0) + { + for (int pe=0,peSize=pdbe.size(); pe0) { - return alFrame.addJmolInstance(viewer, separatorListToArray(sequenceIds)); + return alFrame.addStructureViewInstance(viewer, separatorListToArray(sequenceIds)); } else { - return alFrame.addJmolInstance(viewer, null); + return alFrame.addStructureViewInstance(viewer, null); } } return null; -- 1.7.10.2