2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
3 * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
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 of the License, or (at your option) any later version.
11 * Jalview is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty
13 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 * PURPOSE. See the GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
18 package jalview.appletgui;
20 import java.awt.Container;
21 import java.util.BitSet;
23 import jalview.api.AlignmentViewPanel;
24 import jalview.datamodel.AlignmentI;
25 import jalview.datamodel.PDBEntry;
26 import jalview.datamodel.SequenceI;
27 import jalview.structure.StructureSelectionManager;
29 import org.jmol.api.JmolAppConsoleInterface;
30 import org.jmol.api.JmolViewer;
31 import org.jmol.applet.AppletConsole;
32 import org.jmol.popup.JmolPopup;
34 class AppletJmolBinding extends jalview.ext.jmol.JalviewJmolBinding
38 * Window that contains the bound Jmol instance
40 private AppletJmol appletJmolBinding;
42 public AppletJmolBinding(AppletJmol appletJmol, StructureSelectionManager sSm, PDBEntry[] pdbentry,
43 SequenceI[][] seq, String[][] chains, String protocol)
45 super(sSm, pdbentry, seq, chains, protocol);
46 appletJmolBinding = appletJmol;
49 public jalview.api.FeatureRenderer getFeatureRenderer(AlignmentViewPanel alignment)
51 AlignmentPanel ap = (AlignmentPanel)alignment;
52 if (appletJmolBinding.ap.av.showSequenceFeatures)
54 if (appletJmolBinding.fr == null)
56 appletJmolBinding.fr = new jalview.appletgui.FeatureRenderer(
57 appletJmolBinding.ap.av);
61 .transferSettings(appletJmolBinding.ap.seqPanel.seqCanvas
62 .getFeatureRenderer());
65 return appletJmolBinding.fr;
68 public jalview.api.SequenceRenderer getSequenceRenderer(AlignmentViewPanel alignment)
70 return new SequenceRenderer(((AlignmentPanel)alignment).av);
73 public void sendConsoleEcho(String strEcho)
75 if (appletJmolBinding.scriptWindow == null)
76 appletJmolBinding.showConsole(true);
78 appletJmolBinding.history.append("\n" + strEcho);
81 public void sendConsoleMessage(String strStatus)
83 if (appletJmolBinding.history != null && strStatus != null
84 && !strStatus.equals("Script completed"))
86 appletJmolBinding.history.append("\n" + strStatus);
90 public void showUrl(String url, String target)
92 appletJmolBinding.ap.alignFrame.showURL(url, target);
96 public void refreshGUI()
98 appletJmolBinding.updateTitleAndMenus();
101 public void updateColours(Object source)
103 AlignmentPanel ap = (AlignmentPanel) source;
104 colourBySequence(ap.av.getShowSequenceFeatures(), ap);
107 public void showUrl(String url)
111 appletJmolBinding.ap.av.applet.getAppletContext().showDocument(
112 new java.net.URL(url), "jmol");
113 } catch (java.net.MalformedURLException ex)
118 public void newJmolPopup(boolean translateLocale, String menuName,
122 jmolpopup = JmolPopup.newJmolPopup(viewer, translateLocale, menuName,
126 public void notifyScriptTermination(String strStatus, int msWalltime)
131 public void selectionChanged(BitSet arg0)
133 // TODO Auto-generated method stub
137 public void refreshPdbEntries()
139 // TODO Auto-generated method stub
144 public void showConsole(boolean show)
146 appletJmolBinding.showConsole(show);
150 protected JmolAppConsoleInterface createJmolConsole(JmolViewer viewer2,
151 Container consolePanel, String buttonsToShow)
153 return new AppletConsole(viewer2, consolePanel);
157 protected void releaseUIResources()
159 appletJmolBinding = null;
164 console.setVisible(false);
167 } catch (Exception x)
177 public void releaseReferences(Object svl)