2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.6)
3 * Copyright (C) 2010 J Procter, AM Waterhouse, 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;
28 import org.jmol.api.JmolAppConsoleInterface;
29 import org.jmol.api.JmolViewer;
30 import org.jmol.applet.AppletConsole;
31 import org.jmol.popup.JmolPopup;
33 class AppletJmolBinding extends jalview.ext.jmol.JalviewJmolBinding
37 * Window that contains the bound Jmol instance
39 private AppletJmol appletJmolBinding;
41 public AppletJmolBinding(AppletJmol appletJmol, PDBEntry[] pdbentry,
42 SequenceI[][] seq, String[][] chains, String protocol)
44 super(pdbentry, seq, chains, protocol);
45 appletJmolBinding = appletJmol;
48 public jalview.api.FeatureRenderer getFeatureRenderer(AlignmentViewPanel alignment)
50 AlignmentPanel ap = (AlignmentPanel)alignment;
51 if (appletJmolBinding.ap.av.showSequenceFeatures)
53 if (appletJmolBinding.fr == null)
55 appletJmolBinding.fr = new jalview.appletgui.FeatureRenderer(
56 appletJmolBinding.ap.av);
60 .transferSettings(appletJmolBinding.ap.seqPanel.seqCanvas
61 .getFeatureRenderer());
64 return appletJmolBinding.fr;
67 public jalview.api.SequenceRenderer getSequenceRenderer(AlignmentViewPanel alignment)
69 return new SequenceRenderer(((AlignmentPanel)alignment).av);
72 public void sendConsoleEcho(String strEcho)
74 if (appletJmolBinding.scriptWindow == null)
75 appletJmolBinding.showConsole(true);
77 appletJmolBinding.history.append("\n" + strEcho);
80 public void sendConsoleMessage(String strStatus)
82 if (appletJmolBinding.history != null && strStatus != null
83 && !strStatus.equals("Script completed"))
85 appletJmolBinding.history.append("\n" + strStatus);
89 public void showUrl(String url, String target)
91 appletJmolBinding.ap.alignFrame.showURL(url, target);
95 public void refreshGUI()
97 appletJmolBinding.updateTitleAndMenus();
100 public void updateColours(Object source)
102 AlignmentPanel ap = (AlignmentPanel) source;
103 colourBySequence(ap.av.getShowSequenceFeatures(), ap);
106 public void showUrl(String url)
110 appletJmolBinding.ap.av.applet.getAppletContext().showDocument(
111 new java.net.URL(url), "jmol");
112 } catch (java.net.MalformedURLException ex)
117 public void newJmolPopup(boolean translateLocale, String menuName,
121 jmolpopup = JmolPopup.newJmolPopup(viewer, translateLocale, menuName,
125 public void notifyScriptTermination(String strStatus, int msWalltime)
130 public void selectionChanged(BitSet arg0)
132 // TODO Auto-generated method stub
136 public void refreshPdbEntries()
138 // TODO Auto-generated method stub
143 public void showConsole(boolean show)
145 appletJmolBinding.showConsole(show);
149 protected JmolAppConsoleInterface createJmolConsole(JmolViewer viewer2,
150 Container consolePanel, String buttonsToShow)
152 return new AppletConsole(viewer2, consolePanel);
156 protected void releaseUIResources()
158 appletJmolBinding = null;
163 console.setVisible(false);
166 } catch (Exception x)
176 public void releaseReferences(Object svl)
178 // TODO Auto-generated method stub