6 import java.awt.Container;
7 import java.util.BitSet;
9 import javax.swing.JPanel;
11 import jalview.bin.Cache;
12 import jalview.datamodel.PDBEntry;
13 import jalview.datamodel.SequenceI;
15 import org.jmol.api.JmolAppConsoleInterface;
16 import org.jmol.api.JmolViewer;
17 import org.jmol.popup.JmolPopup;
18 import org.openscience.jmol.app.jmolpanel.AppConsole;
20 public class AppJmolBinding extends jalview.ext.jmol.JalviewJmolBinding
26 private AppJmol appJmolWindow;
28 public AppJmolBinding(AppJmol appJmol, PDBEntry[] pdbentry,
29 SequenceI[][] sequenceIs, String[][] chains, String protocol)
31 super(pdbentry, sequenceIs, chains, protocol);
32 appJmolWindow = appJmol;
35 FeatureRenderer fr = null;
38 public jalview.api.FeatureRenderer getFeatureRenderer()
40 if (appJmolWindow.ap.av.showSequenceFeatures)
44 fr = new FeatureRenderer(appJmolWindow.ap);
47 fr.transferSettings(appJmolWindow.ap.seqPanel.seqCanvas
48 .getFeatureRenderer());
55 public jalview.api.SequenceRenderer getSequenceRenderer()
57 return new SequenceRenderer(appJmolWindow.ap.av);
60 public void sendConsoleEcho(String strEcho)
64 console.sendConsoleEcho(strEcho);
68 public void sendConsoleMessage(String strStatus)
70 if (console != null && strStatus != null)
71 // && !strStatus.equals("Script completed"))
72 // should we squash the script completed string ?
74 console.sendConsoleMessage(strStatus);
79 public void showUrl(String url, String target)
83 jalview.util.BrowserLauncher.openURL(url);
86 Cache.log.error("Failed to launch Jmol-associated url " + url, e);
87 // TODO: 2.6 : warn user if browser was not configured.
92 public void refreshGUI()
94 // appJmolWindow.repaint();
95 javax.swing.SwingUtilities.invokeLater(new Runnable() {
97 appJmolWindow.updateTitleAndMenus();
98 appJmolWindow.revalidate();
102 public void updateColours(Object source)
104 AlignmentPanel ap = (AlignmentPanel) source;
105 if (appJmolWindow.ap.alignFrame.getCurrentView() != ap.av)
108 colourBySequence(ap.av.getShowSequenceFeatures(), ap.av.alignment);
111 public void notifyScriptTermination(String strStatus, int msWalltime)
113 // todo - script termination doesn't happen ?
114 //if (console != null)
115 //console.notifyScriptTermination(strStatus,
119 public void showUrl(String url)
121 showUrl(url, "jmol");
124 public void newJmolPopup(boolean translateLocale, String menuName,
128 jmolpopup = JmolPopup.newJmolPopup(viewer, translateLocale, menuName,
132 public void selectionChanged(BitSet arg0)
134 // TODO Auto-generated method stub
138 public void refreshPdbEntries()
140 // TODO Auto-generated method stub
144 public void showConsole(boolean b) {
145 appJmolWindow.showConsole(b);
149 * add the given sequences to the mapping scope for the given pdb file handle
152 * - pdbFile identifier
154 * - set of sequences it can be mapped to
156 public void addSequenceForStructFile(String pdbFile, SequenceI[] seq)
158 for (int pe = 0; pe < pdbentry.length; pe++)
160 if (pdbentry[pe].getFile().equals(pdbFile))
162 addSequence(pe, seq);
168 protected JmolAppConsoleInterface createJmolConsole(JmolViewer viewer2,
169 Container consolePanel, String buttonsToShow)
171 return new AppConsole(viewer, null, consolePanel, buttonsToShow);