From e683768e084c5e2999846de881b3903f62417919 Mon Sep 17 00:00:00 2001 From: jprocter Date: Mon, 13 Sep 2010 19:55:05 +0000 Subject: [PATCH] refactored to remove App reference in Applet (JAL-638) --- src/jalview/appletgui/AppletJmolBinding.java | 11 +++++++++++ src/jalview/appletgui/ExtJmol.java | 10 ++++++++++ src/jalview/ext/jmol/JalviewJmolBinding.java | 8 ++++++-- src/jalview/gui/AppJmolBinding.java | 10 ++++++++++ 4 files changed, 37 insertions(+), 2 deletions(-) diff --git a/src/jalview/appletgui/AppletJmolBinding.java b/src/jalview/appletgui/AppletJmolBinding.java index 3a2abcf..d6be32d 100644 --- a/src/jalview/appletgui/AppletJmolBinding.java +++ b/src/jalview/appletgui/AppletJmolBinding.java @@ -3,11 +3,14 @@ */ package jalview.appletgui; +import java.awt.Container; import java.util.BitSet; import jalview.datamodel.PDBEntry; import jalview.datamodel.SequenceI; +import org.jmol.api.JmolAppConsoleInterface; +import org.jmol.api.JmolViewer; import org.jmol.popup.JmolPopup; class AppletJmolBinding extends jalview.ext.jmol.JalviewJmolBinding @@ -119,4 +122,12 @@ class AppletJmolBinding extends jalview.ext.jmol.JalviewJmolBinding appletJmolBinding.showConsole(show); } + @Override + protected JmolAppConsoleInterface createJmolConsole(JmolViewer viewer2, + Container consolePanel, String buttonsToShow) + { + // TODO Auto-generated method stub + return null; + } + } \ No newline at end of file diff --git a/src/jalview/appletgui/ExtJmol.java b/src/jalview/appletgui/ExtJmol.java index b7fb311..63c1ca7 100644 --- a/src/jalview/appletgui/ExtJmol.java +++ b/src/jalview/appletgui/ExtJmol.java @@ -1,9 +1,11 @@ package jalview.appletgui; +import java.awt.Container; import java.util.BitSet; import java.util.Hashtable; import java.util.Vector; +import org.jmol.api.JmolAppConsoleInterface; import org.jmol.api.JmolViewer; import jalview.api.FeatureRenderer; @@ -128,4 +130,12 @@ public class ExtJmol extends JalviewJmolBinding // This never gets called because we haven't overriden the associated Jmol's console System.err.println("WARNING: unexpected call to ExtJmol's showConsole method. (showConsole="+show); } + + @Override + protected JmolAppConsoleInterface createJmolConsole(JmolViewer viewer2, + Container consolePanel, String buttonsToShow) + { + // TODO Auto-generated method stub + return null; + } } diff --git a/src/jalview/ext/jmol/JalviewJmolBinding.java b/src/jalview/ext/jmol/JalviewJmolBinding.java index c852a1a..8e72380 100644 --- a/src/jalview/ext/jmol/JalviewJmolBinding.java +++ b/src/jalview/ext/jmol/JalviewJmolBinding.java @@ -39,7 +39,6 @@ import org.jmol.adapter.smarter.SmarterJmolAdapter; import org.jmol.popup.*; import org.jmol.viewer.JmolConstants; import org.jmol.viewer.Viewer; -import org.openscience.jmol.app.jmolpanel.AppConsole; import jalview.schemes.*; @@ -1333,8 +1332,10 @@ public abstract class JalviewJmolBinding implements StructureListener, (jmolfileio ? new SmarterJmolAdapter() : null), htmlName + ((Object) this).toString(), documentBase, codeBase, commandOptions, this); - console = new AppConsole(viewer, null, consolePanel, + + console = createJmolConsole(viewer, consolePanel, buttonsToShow); + viewer.setConsole(new JmolAppConsoleInterface() { @Override @@ -1398,6 +1399,9 @@ public abstract class JalviewJmolBinding implements StructureListener, } + protected abstract JmolAppConsoleInterface createJmolConsole(JmolViewer viewer2, + Container consolePanel, String buttonsToShow); + protected org.jmol.api.JmolAppConsoleInterface console = null; public void setLoadingFromArchive(boolean loadingFromArchive) diff --git a/src/jalview/gui/AppJmolBinding.java b/src/jalview/gui/AppJmolBinding.java index 2a0e2a7..babffed 100644 --- a/src/jalview/gui/AppJmolBinding.java +++ b/src/jalview/gui/AppJmolBinding.java @@ -3,6 +3,7 @@ */ package jalview.gui; +import java.awt.Container; import java.util.BitSet; import javax.swing.JPanel; @@ -11,6 +12,8 @@ import jalview.bin.Cache; import jalview.datamodel.PDBEntry; import jalview.datamodel.SequenceI; +import org.jmol.api.JmolAppConsoleInterface; +import org.jmol.api.JmolViewer; import org.jmol.popup.JmolPopup; import org.openscience.jmol.app.jmolpanel.AppConsole; @@ -160,4 +163,11 @@ public class AppJmolBinding extends jalview.ext.jmol.JalviewJmolBinding } } } + + @Override + protected JmolAppConsoleInterface createJmolConsole(JmolViewer viewer2, + Container consolePanel, String buttonsToShow) + { + return new AppConsole(viewer, null, consolePanel, buttonsToShow); + } } \ No newline at end of file -- 1.7.10.2