2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2)
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
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.datamodel.PDBEntry;
25 import jalview.datamodel.SequenceI;
26 import jalview.structure.StructureSelectionManager;
28 import java.awt.Container;
29 import java.util.BitSet;
31 import org.jmol.api.JmolAppConsoleInterface;
32 import org.jmol.api.JmolViewer;
33 import org.jmol.popup.JmolPopup;
35 class AppletJmolBinding extends jalview.ext.jmol.JalviewJmolBinding
39 * Window that contains the bound Jmol instance
41 private AppletJmol appletJmolBinding;
43 public AppletJmolBinding(AppletJmol appletJmol,
44 StructureSelectionManager sSm, PDBEntry[] pdbentry,
45 SequenceI[][] seq, String[][] chains, String protocol)
47 super(sSm, pdbentry, seq, chains, protocol);
48 appletJmolBinding = appletJmol;
51 public jalview.api.FeatureRenderer getFeatureRenderer(
52 AlignmentViewPanel alignment)
54 AlignmentPanel ap = (AlignmentPanel) alignment;
55 if (appletJmolBinding.ap.av.showSequenceFeatures)
57 if (appletJmolBinding.fr == null)
59 appletJmolBinding.fr = new jalview.appletgui.FeatureRenderer(
60 appletJmolBinding.ap.av);
64 .transferSettings(appletJmolBinding.ap.seqPanel.seqCanvas
65 .getFeatureRenderer());
68 return appletJmolBinding.fr;
71 public jalview.api.SequenceRenderer getSequenceRenderer(
72 AlignmentViewPanel alignment)
74 return new SequenceRenderer(((AlignmentPanel) alignment).av);
77 public void sendConsoleEcho(String strEcho)
79 if (appletJmolBinding.scriptWindow == null)
80 appletJmolBinding.showConsole(true);
82 appletJmolBinding.history.append("\n" + strEcho);
85 public void sendConsoleMessage(String strStatus)
87 if (appletJmolBinding.history != null && strStatus != null
88 && !strStatus.equals("Script completed"))
90 appletJmolBinding.history.append("\n" + strStatus);
94 public void showUrl(String url, String target)
96 appletJmolBinding.ap.alignFrame.showURL(url, target);
100 public void refreshGUI()
102 appletJmolBinding.updateTitleAndMenus();
105 public void updateColours(Object source)
107 AlignmentPanel ap = (AlignmentPanel) source;
108 colourBySequence(ap.av.getShowSequenceFeatures(), ap);
111 public void showUrl(String url)
115 appletJmolBinding.ap.av.applet.getAppletContext().showDocument(
116 new java.net.URL(url), "jmol");
117 } catch (java.net.MalformedURLException ex)
122 public void newJmolPopup(boolean translateLocale, String menuName,
126 jmolpopup = new JmolPopup();
127 jmolpopup.initialize(viewer, translateLocale, menuName, asPopup);
130 public void notifyScriptTermination(String strStatus, int msWalltime)
135 public void selectionChanged(BitSet arg0)
137 // TODO Auto-generated method stub
141 public void refreshPdbEntries()
143 // TODO Auto-generated method stub
148 public void showConsole(boolean show)
150 appletJmolBinding.showConsole(show);
154 protected JmolAppConsoleInterface createJmolConsole(JmolViewer viewer2,
155 Container consolePanel, String buttonsToShow)
157 // return new org.jmol.console.AppletConsole(viewer2, consolePanel);
158 JmolAppConsoleInterface appc = new org.jmol.console.AppletConsole()
159 .getAppConsole(viewer2);
164 protected void releaseUIResources()
166 appletJmolBinding = null;
171 console.setVisible(false);
174 } catch (Exception x)
184 public void releaseReferences(Object svl)
189 public void resizeInnerPanel(String data)
191 // TODO Auto-generated method stub