2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2)
3 * Copyright (C) 2014 The Jalview Authors
5 * This file is part of Jalview.
7 * Jalview is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation, either version 3
10 * of the License, or (at your option) any later version.
12 * Jalview is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19 * The Jalview Authors are detailed in the 'AUTHORS' file.
21 package jalview.appletgui;
23 import java.awt.Container;
24 import java.util.BitSet;
25 import java.util.Hashtable;
26 import java.util.Vector;
28 import org.jmol.api.JmolAppConsoleInterface;
29 import org.jmol.api.JmolViewer;
31 import jalview.api.AlignmentViewPanel;
32 import jalview.api.FeatureRenderer;
33 import jalview.api.SequenceRenderer;
34 import jalview.datamodel.PDBEntry;
35 import jalview.datamodel.SequenceI;
36 import jalview.ext.jmol.JalviewJmolBinding;
39 * bind an alignment view to an external Jmol instance.
44 public class ExtJmol extends JalviewJmolBinding
47 private AlignmentPanel ap;
49 protected ExtJmol(jalview.appletgui.AlignFrame alframe,
50 PDBEntry[] pdbentry, SequenceI[][] seq, String[][] chains,
53 super(alframe.alignPanel.getStructureSelectionManager(), pdbentry, seq,
57 public ExtJmol(JmolViewer viewer, AlignmentPanel alignPanel,
60 super(alignPanel.getStructureSelectionManager(), viewer);
63 notifyFileLoaded(null, null, null, null, 0);
66 public void updateColours(Object source)
69 // TODO Auto-generated method stub
73 public void showUrl(String arg0)
75 showUrl(arg0, "jmol");
78 public FeatureRenderer getFeatureRenderer(AlignmentViewPanel alignment)
80 AlignmentPanel ap = (AlignmentPanel) alignment;
81 if (ap.av.showSequenceFeatures)
83 return ap.getFeatureRenderer();
91 public SequenceRenderer getSequenceRenderer(AlignmentViewPanel alignment)
93 return ((AlignmentPanel) alignment).getSequenceRenderer();
96 public void notifyScriptTermination(String strStatus, int msWalltime)
101 public void sendConsoleEcho(String strEcho)
106 public void sendConsoleMessage(String strStatus)
111 public void showUrl(String url, String target)
113 ap.alignFrame.showURL(url, target);
116 public void refreshGUI()
121 public void selectionChanged(BitSet arg0)
123 System.out.println(arg0);
126 public void refreshPdbEntries()
128 Vector pdbe = new Vector();
129 Hashtable fileids = new Hashtable();
130 SequenceI[] sq = ap.av.getAlignment().getSequencesArray();
131 for (int s = 0; s < sq.length; s++)
133 Vector pdbids = sq[s].getPDBId();
136 for (int pe = 0, peSize = pdbids.size(); pe < peSize; pe++)
138 PDBEntry pentry = (PDBEntry) pdbids.elementAt(pe);
139 if (!fileids.containsKey(pentry.getId()))
141 pdbe.addElement(pentry);
146 pdbentry = new PDBEntry[pdbe.size()];
147 for (int pe = 0; pe < pdbe.size(); pe++)
149 pdbentry[pe] = (PDBEntry) pdbe.elementAt(pe);
154 public void showConsole(boolean show)
156 // This never gets called because we haven't overriden the associated Jmol's
159 .println("WARNING: unexpected call to ExtJmol's showConsole method. (showConsole="
164 protected JmolAppConsoleInterface createJmolConsole(JmolViewer viewer2,
165 Container consolePanel, String buttonsToShow)
167 // TODO Auto-generated method stub
172 protected void releaseUIResources()
179 console.setVisible(false);
182 } catch (Exception x)
192 public void releaseReferences(Object svl)
194 // TODO Auto-generated method stub