2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
3 * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, 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 jalview.api.AlignmentViewPanel;
21 import jalview.datamodel.PDBEntry;
22 import jalview.datamodel.SequenceI;
23 import jalview.structure.StructureSelectionManager;
25 import java.awt.Container;
26 import java.util.BitSet;
28 import org.jmol.api.JmolAppConsoleInterface;
29 import org.jmol.api.JmolViewer;
30 import org.jmol.popup.JmolPopup;
32 class AppletJmolBinding extends jalview.ext.jmol.JalviewJmolBinding
36 * Window that contains the bound Jmol instance
38 private AppletJmol appletJmolBinding;
40 public AppletJmolBinding(AppletJmol appletJmol,
41 StructureSelectionManager sSm, PDBEntry[] pdbentry,
42 SequenceI[][] seq, String[][] chains, String protocol)
44 super(sSm, pdbentry, seq, chains, protocol);
45 appletJmolBinding = appletJmol;
48 public jalview.api.FeatureRenderer getFeatureRenderer(
49 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(
69 AlignmentViewPanel alignment)
71 return new SequenceRenderer(((AlignmentPanel) alignment).av);
74 public void sendConsoleEcho(String strEcho)
76 if (appletJmolBinding.scriptWindow == null)
77 appletJmolBinding.showConsole(true);
79 appletJmolBinding.history.append("\n" + strEcho);
82 public void sendConsoleMessage(String strStatus)
84 if (appletJmolBinding.history != null && strStatus != null
85 && !strStatus.equals("Script completed"))
87 appletJmolBinding.history.append("\n" + strStatus);
91 public void showUrl(String url, String target)
93 appletJmolBinding.ap.alignFrame.showURL(url, target);
97 public void refreshGUI()
99 appletJmolBinding.updateTitleAndMenus();
102 public void updateColours(Object source)
104 AlignmentPanel ap = (AlignmentPanel) source;
105 colourBySequence(ap.av.getShowSequenceFeatures(), ap);
108 public void showUrl(String url)
112 appletJmolBinding.ap.av.applet.getAppletContext().showDocument(
113 new java.net.URL(url), "jmol");
114 } catch (java.net.MalformedURLException ex)
119 public void newJmolPopup(boolean translateLocale, String menuName,
123 jmolpopup = new JmolPopup();
124 jmolpopup.initialize(viewer, translateLocale, menuName, asPopup);
127 public void notifyScriptTermination(String strStatus, int msWalltime)
132 public void selectionChanged(BitSet arg0)
134 // TODO Auto-generated method stub
138 public void refreshPdbEntries()
140 // TODO Auto-generated method stub
145 public void showConsole(boolean show)
147 appletJmolBinding.showConsole(show);
151 protected JmolAppConsoleInterface createJmolConsole(JmolViewer viewer2,
152 Container consolePanel, String buttonsToShow)
154 // return new org.jmol.console.AppletConsole(viewer2, consolePanel);
155 JmolAppConsoleInterface appc = new org.jmol.console.AppletConsole()
156 .getAppConsole(viewer2);
161 protected void releaseUIResources()
163 appletJmolBinding = null;
168 console.setVisible(false);
171 } catch (Exception x)
181 public void releaseReferences(Object svl)
186 public void resizeInnerPanel(String data)
188 // TODO Auto-generated method stub