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.datamodel.PDBEntry;
24 import jalview.datamodel.SequenceI;
26 import org.jmol.api.JmolAppConsoleInterface;
27 import org.jmol.api.JmolViewer;
28 import org.jmol.applet.AppletConsole;
29 import org.jmol.popup.JmolPopup;
31 class AppletJmolBinding extends jalview.ext.jmol.JalviewJmolBinding
35 * Window that contains the bound Jmol instance
37 private AppletJmol appletJmolBinding;
39 public AppletJmolBinding(AppletJmol appletJmol, PDBEntry[] pdbentry,
40 SequenceI[][] seq, String[][] chains, String protocol)
42 super(pdbentry, seq, chains, protocol);
43 appletJmolBinding = appletJmol;
46 public jalview.api.FeatureRenderer getFeatureRenderer()
48 if (appletJmolBinding.ap.av.showSequenceFeatures)
50 if (appletJmolBinding.fr == null)
52 appletJmolBinding.fr = new jalview.appletgui.FeatureRenderer(
53 appletJmolBinding.ap.av);
57 .transferSettings(appletJmolBinding.ap.seqPanel.seqCanvas
58 .getFeatureRenderer());
61 return appletJmolBinding.fr;
64 public jalview.api.SequenceRenderer getSequenceRenderer()
66 return new SequenceRenderer(appletJmolBinding.ap.av);
69 public void sendConsoleEcho(String strEcho)
71 if (appletJmolBinding.scriptWindow == null)
72 appletJmolBinding.showConsole(true);
74 appletJmolBinding.history.append("\n" + strEcho);
77 public void sendConsoleMessage(String strStatus)
79 if (appletJmolBinding.history != null && strStatus != null
80 && !strStatus.equals("Script completed"))
82 appletJmolBinding.history.append("\n" + strStatus);
86 public void showUrl(String url, String target)
88 appletJmolBinding.ap.alignFrame.showURL(url, target);
92 public void refreshGUI()
94 appletJmolBinding.updateTitleAndMenus();
97 public void updateColours(Object source)
99 AlignmentPanel ap = (AlignmentPanel) source;
100 colourBySequence(ap.av.getShowSequenceFeatures(), ap.av.alignment);
103 public void showUrl(String url)
107 appletJmolBinding.ap.av.applet.getAppletContext().showDocument(
108 new java.net.URL(url), "jmol");
109 } catch (java.net.MalformedURLException ex)
114 public void newJmolPopup(boolean translateLocale, String menuName,
118 jmolpopup = JmolPopup.newJmolPopup(viewer, translateLocale, menuName,
122 public void notifyScriptTermination(String strStatus, int msWalltime)
127 public void selectionChanged(BitSet arg0)
129 // TODO Auto-generated method stub
133 public void refreshPdbEntries()
135 // TODO Auto-generated method stub
140 public void showConsole(boolean show)
142 appletJmolBinding.showConsole(show);
146 protected JmolAppConsoleInterface createJmolConsole(JmolViewer viewer2,
147 Container consolePanel, String buttonsToShow)
149 return new AppletConsole(viewer2, consolePanel);
153 protected void releaseUIResources()
155 appletJmolBinding = null;
160 console.setVisible(false);
163 } catch (Exception x)