X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FAppJmolBinding.java;h=aa6a15923c780d8ee0f2e05ba51a3c1a00293240;hb=2ab7b9b152018bb808693218ad88dc3778166492;hp=eb15a651246d1705184426f7d4c8e8a8f18594a3;hpb=17e77c3f2949a0729322b4a8d907f3f34b6a9914;p=jalview.git diff --git a/src/jalview/gui/AppJmolBinding.java b/src/jalview/gui/AppJmolBinding.java index eb15a65..aa6a159 100644 --- a/src/jalview/gui/AppJmolBinding.java +++ b/src/jalview/gui/AppJmolBinding.java @@ -1,6 +1,6 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9) - * Copyright (C) 2015 The Jalview Authors + * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) + * Copyright (C) $$Year-Rel$$ The Jalview Authors * * This file is part of Jalview. * @@ -21,51 +21,31 @@ package jalview.gui; import jalview.api.AlignmentViewPanel; +import jalview.api.structures.JalviewStructureDisplayI; import jalview.bin.Cache; import jalview.datamodel.PDBEntry; import jalview.datamodel.SequenceI; import jalview.ext.jmol.JalviewJmolBinding; +import jalview.io.DataSourceType; import jalview.structure.StructureSelectionManager; import java.awt.Container; import java.util.Map; +import javax.swing.JComponent; + import org.jmol.api.JmolAppConsoleInterface; import org.jmol.java.BS; import org.openscience.jmol.app.jmolpanel.console.AppConsole; public class AppJmolBinding extends JalviewJmolBinding { - private AppJmol appJmolWindow; - - private FeatureRenderer fr = null; - public AppJmolBinding(AppJmol appJmol, StructureSelectionManager sSm, - PDBEntry[] pdbentry, SequenceI[][] sequenceIs, String[][] chains, - String protocol) - { - super(sSm, pdbentry, sequenceIs, chains, protocol); - appJmolWindow = appJmol; - } - - @Override - public FeatureRenderer getFeatureRenderer(AlignmentViewPanel alignment) + PDBEntry[] pdbentry, SequenceI[][] sequenceIs, + DataSourceType protocol) { - AlignmentPanel ap = (alignment == null) ? appJmolWindow - .getAlignmentPanel() : (AlignmentPanel) alignment; - if (ap.av.isShowSequenceFeatures()) - { - if (fr == null) - { - fr = (jalview.gui.FeatureRenderer) ap.cloneFeatureRenderer(); - } - else - { - ap.updateFeatureRenderer(fr); - } - } - - return fr; + super(sSm, pdbentry, sequenceIs, protocol); + setViewer(appJmol); } @Override @@ -113,19 +93,22 @@ public class AppJmolBinding extends JalviewJmolBinding // appJmolWindow.repaint(); javax.swing.SwingUtilities.invokeLater(new Runnable() { + @Override public void run() { - appJmolWindow.updateTitleAndMenus(); - appJmolWindow.revalidate(); + JalviewStructureDisplayI theViewer = getViewer(); + theViewer.updateTitleAndMenus(); + ((JComponent) theViewer).revalidate(); } }); } + @Override public void updateColours(Object source) { AlignmentPanel ap = (AlignmentPanel) source; // ignore events from panels not used to colour this view - if (!appJmolWindow.isUsedforcolourby(ap)) + if (!getViewer().isUsedForColourBy(ap)) { return; } @@ -144,6 +127,7 @@ public class AppJmolBinding extends JalviewJmolBinding // msWalltime); } + @Override public void showUrl(String url) { showUrl(url, "jmol"); @@ -172,21 +156,21 @@ public class AppJmolBinding extends JalviewJmolBinding @Override public void showConsole(boolean b) { - appJmolWindow.showConsole(b); + getViewer().showConsole(b); } @Override protected JmolAppConsoleInterface createJmolConsole( Container consolePanel, String buttonsToShow) { - viewer.setJmolCallbackListener(this); - return new AppConsole(viewer, consolePanel, buttonsToShow); + jmolViewer.setJmolCallbackListener(this); + return new AppConsole(jmolViewer, consolePanel, buttonsToShow); } @Override protected void releaseUIResources() { - appJmolWindow = null; + setViewer(null); closeConsole(); } @@ -195,7 +179,7 @@ public class AppJmolBinding extends JalviewJmolBinding { if (svl instanceof SeqPanel) { - appJmolWindow.removeAlignmentPanel(((SeqPanel) svl).ap); + getViewer().removeAlignmentPanel(((SeqPanel) svl).ap); } }