6 import java.awt.Container;
7 import java.awt.event.ComponentEvent;
8 import java.awt.event.ComponentListener;
9 import java.awt.event.ContainerEvent;
10 import java.awt.event.ContainerListener;
11 import java.util.BitSet;
13 import javax.swing.JPanel;
15 import jalview.bin.Cache;
16 import jalview.datamodel.PDBEntry;
17 import jalview.datamodel.SequenceI;
19 import org.jmol.api.JmolAppConsoleInterface;
20 import org.jmol.api.JmolViewer;
21 import org.jmol.popup.JmolPopup;
22 import org.openscience.jmol.app.jmolpanel.AppConsole;
24 public class AppJmolBinding extends jalview.ext.jmol.JalviewJmolBinding
30 private AppJmol appJmolWindow;
32 public AppJmolBinding(AppJmol appJmol, PDBEntry[] pdbentry,
33 SequenceI[][] sequenceIs, String[][] chains, String protocol)
35 super(pdbentry, sequenceIs, chains, protocol);
36 appJmolWindow = appJmol;
39 FeatureRenderer fr = null;
42 public jalview.api.FeatureRenderer getFeatureRenderer()
44 if (appJmolWindow.ap.av.showSequenceFeatures)
48 fr = new FeatureRenderer(appJmolWindow.ap);
51 fr.transferSettings(appJmolWindow.ap.seqPanel.seqCanvas
52 .getFeatureRenderer());
59 public jalview.api.SequenceRenderer getSequenceRenderer()
61 return new SequenceRenderer(appJmolWindow.ap.av);
64 public void sendConsoleEcho(String strEcho)
68 console.sendConsoleEcho(strEcho);
72 public void sendConsoleMessage(String strStatus)
74 if (console != null && strStatus != null)
75 // && !strStatus.equals("Script completed"))
76 // should we squash the script completed string ?
78 console.sendConsoleMessage(strStatus);
83 public void showUrl(String url, String target)
87 jalview.util.BrowserLauncher.openURL(url);
90 Cache.log.error("Failed to launch Jmol-associated url " + url, e);
91 // TODO: 2.6 : warn user if browser was not configured.
96 public void refreshGUI()
98 // appJmolWindow.repaint();
99 javax.swing.SwingUtilities.invokeLater(new Runnable() {
101 appJmolWindow.updateTitleAndMenus();
102 appJmolWindow.revalidate();
106 public void updateColours(Object source)
108 AlignmentPanel ap = (AlignmentPanel) source;
109 if (appJmolWindow.ap.alignFrame.getCurrentView() != ap.av)
112 colourBySequence(ap.av.getShowSequenceFeatures(), ap.av.alignment);
115 public void notifyScriptTermination(String strStatus, int msWalltime)
117 // todo - script termination doesn't happen ?
118 //if (console != null)
119 //console.notifyScriptTermination(strStatus,
123 public void showUrl(String url)
125 showUrl(url, "jmol");
128 public void newJmolPopup(boolean translateLocale, String menuName,
132 jmolpopup = JmolPopup.newJmolPopup(viewer, translateLocale, menuName,
136 public void selectionChanged(BitSet arg0)
138 // TODO Auto-generated method stub
142 public void refreshPdbEntries()
144 // TODO Auto-generated method stub
148 public void showConsole(boolean b) {
149 appJmolWindow.showConsole(b);
153 * add the given sequences to the mapping scope for the given pdb file handle
156 * - pdbFile identifier
158 * - set of sequences it can be mapped to
160 public void addSequenceForStructFile(String pdbFile, SequenceI[] seq)
162 for (int pe = 0; pe < pdbentry.length; pe++)
164 if (pdbentry[pe].getFile().equals(pdbFile))
166 addSequence(pe, seq);
172 protected JmolAppConsoleInterface createJmolConsole(JmolViewer viewer2,
173 Container consolePanel, String buttonsToShow)
175 return new AppConsole(viewer, consolePanel, buttonsToShow);