2 * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3 * Copyright (C) $$Year-Rel$$ 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 jalview.api.AlignmentViewPanel;
24 import jalview.api.FeatureRenderer;
25 import jalview.api.SequenceRenderer;
26 import jalview.datamodel.PDBEntry;
27 import jalview.datamodel.SequenceI;
28 import jalview.ext.jmol.JalviewJmolBinding;
29 import jalview.gui.IProgressIndicator;
30 import jalview.io.DataSourceType;
32 import java.awt.Container;
33 import java.util.ArrayList;
34 import java.util.List;
36 import java.util.Vector;
38 import org.jmol.api.JmolAppConsoleInterface;
39 import org.jmol.java.BS;
40 import org.jmol.viewer.Viewer;
43 * bind an alignment view to an external Jmol instance.
48 public class ExtJmol extends JalviewJmolBinding
51 private AlignmentPanel ap;
53 protected ExtJmol(AlignFrame alframe, PDBEntry[] pdbentry,
54 SequenceI[][] seq, DataSourceType protocol)
56 super(alframe.alignPanel.getStructureSelectionManager(), pdbentry, seq,
60 public ExtJmol(Viewer viewer, AlignmentPanel alignPanel,
63 super(alignPanel.getStructureSelectionManager(), seqs, viewer);
65 notifyFileLoaded(null, null, null, null, 0);
69 protected IProgressIndicator getIProgressIndicator()
71 // no progress indicators on applet (could access javascript for this)
76 public void updateColours(Object source)
79 // TODO Auto-generated method stub
84 public void showUrl(String arg0)
86 showUrl(arg0, "jmol");
90 public FeatureRenderer getFeatureRenderer(AlignmentViewPanel alignment)
92 AlignmentPanel alignPanel = (AlignmentPanel) alignment;
93 if (alignPanel.av.isShowSequenceFeatures())
95 return alignPanel.getFeatureRenderer();
105 public SequenceRenderer getSequenceRenderer(AlignmentViewPanel alignment)
107 return ((AlignmentPanel) alignment).getSequenceRenderer();
111 public void notifyScriptTermination(String strStatus, int msWalltime)
117 public void sendConsoleEcho(String strEcho)
123 public void sendConsoleMessage(String strStatus)
129 public void showUrl(String url, String target)
131 ap.alignFrame.showURL(url, target);
135 public void refreshGUI()
141 public void selectionChanged(BS arg0)
143 System.out.println(arg0);
147 public void refreshPdbEntries()
149 List<PDBEntry> pdbe = new ArrayList<>();
150 List<String> fileids = new ArrayList<>();
151 SequenceI[] sq = ap.av.getAlignment().getSequencesArray();
152 for (int s = 0; s < sq.length; s++)
154 Vector<PDBEntry> pdbids = sq[s].getAllPDBEntries();
157 for (int pe = 0, peSize = pdbids.size(); pe < peSize; pe++)
159 PDBEntry pentry = pdbids.elementAt(pe);
160 if (!fileids.contains(pentry.getId()))
166 fileids.add(pentry.getId());
171 PDBEntry[] newEntries = new PDBEntry[pdbe.size()];
172 for (int pe = 0; pe < pdbe.size(); pe++)
174 newEntries[pe] = pdbe.get(pe);
176 setPdbentry(newEntries);
180 public void showConsole(boolean show)
182 // This never gets called because we haven't overriden the associated Jmol's
185 "WARNING: unexpected call to ExtJmol's showConsole method. (showConsole="
190 protected JmolAppConsoleInterface createJmolConsole(
191 Container consolePanel, String buttonsToShow)
193 // TODO Auto-generated method stub
198 protected void releaseUIResources()
206 public void releaseReferences(Object svl)
208 // TODO Auto-generated method stub
213 public Map<String, Object> getJSpecViewProperty(String arg0)
215 // TODO Auto-generated method stub