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, SequenceI[][] seq,
40 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(appletJmolBinding.ap.av);
55 appletJmolBinding.fr.transferSettings(appletJmolBinding.ap.seqPanel.seqCanvas.getFeatureRenderer());
58 return appletJmolBinding.fr;
61 public jalview.api.SequenceRenderer getSequenceRenderer()
63 return new SequenceRenderer(appletJmolBinding.ap.av);
66 public void sendConsoleEcho(String strEcho)
68 if (appletJmolBinding.scriptWindow == null)
69 appletJmolBinding.showConsole(true);
71 appletJmolBinding.history.append("\n" + strEcho);
74 public void sendConsoleMessage(String strStatus)
76 if (appletJmolBinding.history != null && strStatus != null
77 && !strStatus.equals("Script completed"))
79 appletJmolBinding.history.append("\n" + strStatus);
83 public void showUrl(String url, String target)
85 appletJmolBinding.ap.alignFrame.showURL(url, target);
89 public void refreshGUI()
91 appletJmolBinding.updateTitleAndMenus();
94 public void updateColours(Object source)
96 AlignmentPanel ap = (AlignmentPanel) source;
97 colourBySequence(ap.av.getShowSequenceFeatures(), ap.av.alignment);
100 public void showUrl(String url)
104 appletJmolBinding.ap.av.applet.getAppletContext().showDocument(new java.net.URL(url),
106 } catch (java.net.MalformedURLException ex)
111 public void newJmolPopup(boolean translateLocale, String menuName, boolean asPopup)
114 jmolpopup = JmolPopup.newJmolPopup(viewer,translateLocale, menuName,asPopup);
117 public void notifyScriptTermination(String strStatus, int msWalltime)
122 public void selectionChanged(BitSet arg0)
124 // TODO Auto-generated method stub
128 public void refreshPdbEntries()
130 // TODO Auto-generated method stub
135 public void showConsole(boolean show)
137 appletJmolBinding.showConsole(show);
141 protected JmolAppConsoleInterface createJmolConsole(JmolViewer viewer2,
142 Container consolePanel, String buttonsToShow)
144 return new AppletConsole(viewer2, consolePanel);
147 protected void releaseUIResources()
149 appletJmolBinding = null;
152 console.setVisible(false);
153 } catch (Error e) {} catch (Exception x) {};