6 import java.util.BitSet;
8 import jalview.bin.Cache;
9 import jalview.datamodel.PDBEntry;
10 import jalview.datamodel.SequenceI;
12 import org.jmol.popup.JmolPopup;
14 public class AppJmolBinding extends jalview.ext.jmol.JalviewJmolBinding
20 private AppJmol appJmolWindow;
22 public AppJmolBinding(AppJmol appJmol, PDBEntry[] pdbentry,
23 SequenceI[][] sequenceIs, String[][] chains, String protocol)
25 super(pdbentry, sequenceIs, chains, protocol);
26 appJmolWindow = appJmol;
29 FeatureRenderer fr = null;
32 public jalview.api.FeatureRenderer getFeatureRenderer()
34 if (appJmolWindow.ap.av.showSequenceFeatures)
38 fr = new FeatureRenderer(appJmolWindow.ap);
41 fr.transferSettings(appJmolWindow.ap.seqPanel.seqCanvas
42 .getFeatureRenderer());
49 public jalview.api.SequenceRenderer getSequenceRenderer()
51 return new SequenceRenderer(appJmolWindow.ap.av);
54 public void sendConsoleEcho(String strEcho)
56 if (appJmolWindow.scriptWindow != null)
58 appJmolWindow.scriptWindow.sendConsoleEcho(strEcho);
62 public void sendConsoleMessage(String strStatus)
64 if (appJmolWindow.scriptWindow != null && strStatus != null)
65 // && !strStatus.equals("Script completed"))
66 // should we squash the script completed string ?
68 appJmolWindow.scriptWindow.sendConsoleMessage(strStatus);
73 public void showUrl(String url, String target)
77 jalview.util.BrowserLauncher.openURL(url);
80 Cache.log.error("Failed to launch Jmol-associated url " + url, e);
81 // TODO: 2.6 : warn user if browser was not configured.
86 public void refreshGUI()
88 // appJmolWindow.repaint();
89 javax.swing.SwingUtilities.invokeLater(new Runnable() {
91 appJmolWindow.updateTitleAndMenus();
92 appJmolWindow.revalidate();
96 public void updateColours(Object source)
98 AlignmentPanel ap = (AlignmentPanel) source;
99 if (appJmolWindow.ap.alignFrame.getCurrentView() != ap.av)
102 colourBySequence(ap.av.getShowSequenceFeatures(), ap.av.alignment);
105 public void notifyScriptTermination(String strStatus, int msWalltime)
107 if (appJmolWindow.scriptWindow != null)
108 appJmolWindow.scriptWindow.notifyScriptTermination(strStatus,
112 public void showUrl(String url)
114 showUrl(url, "jmol");
117 public void newJmolPopup(boolean translateLocale, String menuName,
121 jmolpopup = JmolPopup.newJmolPopup(viewer, translateLocale, menuName,
125 public void selectionChanged(BitSet arg0)
127 // TODO Auto-generated method stub
131 public void refreshPdbEntries()
133 // TODO Auto-generated method stub
139 * add the given sequences to the mapping scope for the given pdb file handle
142 * - pdbFile identifier
144 * - set of sequences it can be mapped to
146 public void addSequenceForStructFile(String pdbFile, SequenceI[] seq)
148 for (int pe = 0; pe < pdbentry.length; pe++)
150 if (pdbentry[pe].getFile().equals(pdbFile))
152 addSequence(pe, seq);