2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.0b1)
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 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/>.
17 * The Jalview Authors are detailed in the 'AUTHORS' file.
19 package jalview.appletgui;
21 import jalview.api.AlignmentViewPanel;
22 import jalview.datamodel.PDBEntry;
23 import jalview.datamodel.SequenceI;
24 import jalview.structure.StructureSelectionManager;
26 import java.awt.Container;
27 import java.util.BitSet;
29 import org.jmol.api.JmolAppConsoleInterface;
30 import org.jmol.api.JmolViewer;
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,
42 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(
50 AlignmentViewPanel alignment)
52 AlignmentPanel ap = (AlignmentPanel) alignment;
53 if (appletJmolBinding.ap.av.showSequenceFeatures)
55 if (appletJmolBinding.fr == null)
57 appletJmolBinding.fr = new jalview.appletgui.FeatureRenderer(
58 appletJmolBinding.ap.av);
62 .transferSettings(appletJmolBinding.ap.seqPanel.seqCanvas
63 .getFeatureRenderer());
66 return appletJmolBinding.fr;
69 public jalview.api.SequenceRenderer getSequenceRenderer(
70 AlignmentViewPanel alignment)
72 return new SequenceRenderer(((AlignmentPanel) alignment).av);
75 public void sendConsoleEcho(String strEcho)
77 if (appletJmolBinding.scriptWindow == null)
78 appletJmolBinding.showConsole(true);
80 appletJmolBinding.history.append("\n" + strEcho);
83 public void sendConsoleMessage(String strStatus)
85 if (appletJmolBinding.history != null && strStatus != null
86 && !strStatus.equals("Script completed"))
88 appletJmolBinding.history.append("\n" + strStatus);
92 public void showUrl(String url, String target)
94 appletJmolBinding.ap.alignFrame.showURL(url, target);
98 public void refreshGUI()
100 appletJmolBinding.updateTitleAndMenus();
103 public void updateColours(Object source)
105 AlignmentPanel ap = (AlignmentPanel) source;
106 colourBySequence(ap.av.getShowSequenceFeatures(), ap);
109 public void showUrl(String url)
113 appletJmolBinding.ap.av.applet.getAppletContext().showDocument(
114 new java.net.URL(url), "jmol");
115 } catch (java.net.MalformedURLException ex)
120 public void newJmolPopup(boolean translateLocale, String menuName,
124 jmolpopup = new JmolPopup();
125 jmolpopup.initialize(viewer, translateLocale, menuName, asPopup);
128 public void notifyScriptTermination(String strStatus, int msWalltime)
133 public void selectionChanged(BitSet arg0)
135 // TODO Auto-generated method stub
139 public void refreshPdbEntries()
141 // TODO Auto-generated method stub
146 public void showConsole(boolean show)
148 appletJmolBinding.showConsole(show);
152 protected JmolAppConsoleInterface createJmolConsole(JmolViewer viewer2,
153 Container consolePanel, String buttonsToShow)
155 // return new org.jmol.console.AppletConsole(viewer2, consolePanel);
156 JmolAppConsoleInterface appc = new org.jmol.console.AppletConsole()
157 .getAppConsole(viewer2);
162 protected void releaseUIResources()
164 appletJmolBinding = null;
169 console.setVisible(false);
172 } catch (Exception x)
182 public void releaseReferences(Object svl)
187 public void resizeInnerPanel(String data)
189 // TODO Auto-generated method stub