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 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, StructureSelectionManager sSm, PDBEntry[] pdbentry,
41 SequenceI[][] seq, String[][] chains, String protocol)
43 super(sSm, pdbentry, seq, chains, protocol);
44 appletJmolBinding = appletJmol;
47 public jalview.api.FeatureRenderer getFeatureRenderer(AlignmentViewPanel alignment)
49 AlignmentPanel ap = (AlignmentPanel)alignment;
50 if (appletJmolBinding.ap.av.showSequenceFeatures)
52 if (appletJmolBinding.fr == null)
54 appletJmolBinding.fr = new jalview.appletgui.FeatureRenderer(
55 appletJmolBinding.ap.av);
59 .transferSettings(appletJmolBinding.ap.seqPanel.seqCanvas
60 .getFeatureRenderer());
63 return appletJmolBinding.fr;
66 public jalview.api.SequenceRenderer getSequenceRenderer(AlignmentViewPanel alignment)
68 return new SequenceRenderer(((AlignmentPanel)alignment).av);
71 public void sendConsoleEcho(String strEcho)
73 if (appletJmolBinding.scriptWindow == null)
74 appletJmolBinding.showConsole(true);
76 appletJmolBinding.history.append("\n" + strEcho);
79 public void sendConsoleMessage(String strStatus)
81 if (appletJmolBinding.history != null && strStatus != null
82 && !strStatus.equals("Script completed"))
84 appletJmolBinding.history.append("\n" + strStatus);
88 public void showUrl(String url, String target)
90 appletJmolBinding.ap.alignFrame.showURL(url, target);
94 public void refreshGUI()
96 appletJmolBinding.updateTitleAndMenus();
99 public void updateColours(Object source)
101 AlignmentPanel ap = (AlignmentPanel) source;
102 colourBySequence(ap.av.getShowSequenceFeatures(), ap);
105 public void showUrl(String url)
109 appletJmolBinding.ap.av.applet.getAppletContext().showDocument(
110 new java.net.URL(url), "jmol");
111 } catch (java.net.MalformedURLException ex)
116 public void newJmolPopup(boolean translateLocale, String menuName,
120 jmolpopup = new JmolPopup();
121 jmolpopup.initialize(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 org.jmol.console.AppletConsole(viewer2, consolePanel);
153 JmolAppConsoleInterface appc = new org.jmol.console.AppletConsole().getAppConsole(viewer2);
158 protected void releaseUIResources()
160 appletJmolBinding = null;
165 console.setVisible(false);
168 } catch (Exception x)
178 public void releaseReferences(Object svl)
182 public void resizeInnerPanel(String data)
184 // TODO Auto-generated method stub