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 java.awt.Container;
25 import java.util.List;
28 import javax.swing.JComponent;
30 import org.jmol.api.JmolAppConsoleInterface;
31 import org.openscience.jmol.app.jmolpanel.console.AppConsole;
33 import jalview.api.AlignmentViewPanel;
34 import jalview.api.structures.JalviewStructureDisplayI;
35 import jalview.bin.Cache;
36 import jalview.datamodel.PDBEntry;
37 import jalview.datamodel.SequenceI;
38 import jalview.ext.jmol.JalviewJmolBinding;
39 import jalview.io.DataSourceType;
40 import jalview.structure.StructureSelectionManager;
41 import jalview.util.Platform;
42 import javajs.util.BS;
44 public class AppJmolBinding extends JalviewJmolBinding
46 public AppJmolBinding(AppJmol appJmol, StructureSelectionManager sSm,
47 PDBEntry[] pdbentry, SequenceI[][] sequenceIs,
48 DataSourceType protocol)
50 super(sSm, pdbentry, sequenceIs, protocol);
55 public SequenceRenderer getSequenceRenderer(AlignmentViewPanel alignment)
57 return new SequenceRenderer(((AlignmentPanel) alignment).av);
61 public void sendConsoleEcho(String strEcho)
65 console.sendConsoleEcho(strEcho);
70 public void sendConsoleMessage(String strStatus)
72 if (console != null && strStatus != null)
73 // && !strStatus.equals("Script completed"))
74 // should we squash the script completed string ?
76 console.sendConsoleMessage(strStatus);
81 public void showUrl(String url, String target)
85 jalview.util.BrowserLauncher.openURL(url);
88 Cache.log.error("Failed to launch Jmol-associated url " + url, e);
89 // TODO: 2.6 : warn user if browser was not configured.
94 public void refreshGUI()
96 if (getMappedStructureCount() == 0)
101 // appJmolWindow.repaint();
102 javax.swing.SwingUtilities.invokeLater(new Runnable()
107 JalviewStructureDisplayI theViewer = getViewer();
108 // invokes colourbySequence() via seqColour_ActionPerformed()
109 theViewer.updateTitleAndMenus();
110 ((JComponent) theViewer).revalidate();
116 public void notifyScriptTermination(String strStatus, int msWalltime)
118 // todo - script termination doesn't happen ?
119 // if (console != null)
120 // console.notifyScriptTermination(strStatus,
125 public void showUrl(String url)
127 showUrl(url, "jmol");
130 public void newJmolPopup(String menuName)
132 // jmolpopup = new JmolAwtPopup();
133 // jmolpopup.jpiInitialize((viewer), menuName);
137 public void selectionChanged(BS arg0)
142 public void showConsole(boolean b)
144 getViewer().showConsole(b);
148 protected JmolAppConsoleInterface createJmolConsole(
149 Container consolePanel, String buttonsToShow)
151 jmolViewer.setJmolCallbackListener(this);
152 // BH comment: can't do this yet [for JS only, or generally?]
153 return Platform.isJS() ? null
154 : new AppConsole(jmolViewer, consolePanel, buttonsToShow);
158 protected void releaseUIResources()
165 public void releaseReferences(Object svl)
167 if (svl instanceof SeqPanel)
169 getViewer().removeAlignmentPanel(((SeqPanel) svl).ap);
174 public Map<String, Object> getJSpecViewProperty(String arg0)
176 // TODO Auto-generated method stub
180 @SuppressWarnings("unused")
181 public void cacheFiles(List<File> files)
189 Platform.cacheFileData(f);