2 * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3 * Copyright (C) $$Year-Rel$$ 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.
23 import jalview.api.AlignmentViewPanel;
24 import jalview.bin.Cache;
25 import jalview.datamodel.PDBEntry;
26 import jalview.datamodel.SequenceI;
27 import jalview.ext.jmol.JalviewJmolBinding;
28 import jalview.structure.StructureSelectionManager;
30 import java.awt.Container;
33 import org.jmol.api.JmolAppConsoleInterface;
34 import org.jmol.java.BS;
35 import org.openscience.jmol.app.jmolpanel.console.AppConsole;
37 public class AppJmolBinding extends JalviewJmolBinding
39 private AppJmol appJmolWindow;
41 private FeatureRenderer fr = null;
43 public AppJmolBinding(AppJmol appJmol, StructureSelectionManager sSm,
44 PDBEntry[] pdbentry, SequenceI[][] sequenceIs, String[][] chains,
47 super(sSm, pdbentry, sequenceIs, chains, protocol);
48 appJmolWindow = appJmol;
52 public FeatureRenderer getFeatureRenderer(
53 AlignmentViewPanel alignment)
55 AlignmentPanel ap = (alignment == null) ? appJmolWindow.getAlignmentPanel()
56 : (AlignmentPanel) alignment;
57 if (ap.av.isShowSequenceFeatures())
61 fr = (jalview.gui.FeatureRenderer) ap.cloneFeatureRenderer();
65 ap.updateFeatureRenderer(fr);
73 public SequenceRenderer getSequenceRenderer(
74 AlignmentViewPanel alignment)
76 return new SequenceRenderer(((AlignmentPanel) alignment).av);
80 public void sendConsoleEcho(String strEcho)
84 console.sendConsoleEcho(strEcho);
89 public void sendConsoleMessage(String strStatus)
91 if (console != null && strStatus != null)
92 // && !strStatus.equals("Script completed"))
93 // should we squash the script completed string ?
95 console.sendConsoleMessage(strStatus);
100 public void showUrl(String url, String target)
104 jalview.util.BrowserLauncher.openURL(url);
105 } catch (Exception e)
107 Cache.log.error("Failed to launch Jmol-associated url " + url, e);
108 // TODO: 2.6 : warn user if browser was not configured.
113 public void refreshGUI()
115 // appJmolWindow.repaint();
116 javax.swing.SwingUtilities.invokeLater(new Runnable()
120 appJmolWindow.updateTitleAndMenus();
121 appJmolWindow.revalidate();
126 public void updateColours(Object source)
128 AlignmentPanel ap = (AlignmentPanel) source;
129 // ignore events from panels not used to colour this view
130 if (!appJmolWindow.isUsedforcolourby(ap))
134 if (!isLoadingFromArchive())
136 colourBySequence(ap);
141 public void notifyScriptTermination(String strStatus, int msWalltime)
143 // todo - script termination doesn't happen ?
144 // if (console != null)
145 // console.notifyScriptTermination(strStatus,
149 public void showUrl(String url)
151 showUrl(url, "jmol");
154 public void newJmolPopup(String menuName)
156 // jmolpopup = new JmolAwtPopup();
157 // jmolpopup.jpiInitialize((viewer), menuName);
161 public void selectionChanged(BS arg0)
163 // TODO Auto-generated method stub
168 public void refreshPdbEntries()
170 // TODO Auto-generated method stub
175 public void showConsole(boolean b)
177 appJmolWindow.showConsole(b);
181 protected JmolAppConsoleInterface createJmolConsole(
182 Container consolePanel, String buttonsToShow)
184 viewer.setJmolCallbackListener(this);
185 return new AppConsole(viewer, consolePanel, buttonsToShow);
189 protected void releaseUIResources()
191 appJmolWindow = null;
196 public void releaseReferences(Object svl)
198 if (svl instanceof SeqPanel)
200 appJmolWindow.removeAlignmentPanel(((SeqPanel) svl).ap);
205 public Map<String, Object> getJSpecViewProperty(String arg0)
207 // TODO Auto-generated method stub