From 6ff6b518cb8befa795ffd2d8942fc29aa7febb72 Mon Sep 17 00:00:00 2001 From: jprocter Date: Fri, 4 Nov 2011 15:28:14 +0000 Subject: [PATCH] (JAL-980) update binding for refactored Jmol constants and new interface methods --- src/jalview/appletgui/AppletJmolBinding.java | 18 +++-- src/jalview/ext/jmol/JalviewJmolBinding.java | 107 +++++++++++++++----------- src/jalview/gui/AppJmolBinding.java | 3 +- 3 files changed, 74 insertions(+), 54 deletions(-) diff --git a/src/jalview/appletgui/AppletJmolBinding.java b/src/jalview/appletgui/AppletJmolBinding.java index eca6406..3750c20 100644 --- a/src/jalview/appletgui/AppletJmolBinding.java +++ b/src/jalview/appletgui/AppletJmolBinding.java @@ -17,18 +17,16 @@ */ package jalview.appletgui; -import java.awt.Container; -import java.util.BitSet; - import jalview.api.AlignmentViewPanel; -import jalview.datamodel.AlignmentI; import jalview.datamodel.PDBEntry; import jalview.datamodel.SequenceI; import jalview.structure.StructureSelectionManager; +import java.awt.Container; +import java.util.BitSet; + import org.jmol.api.JmolAppConsoleInterface; import org.jmol.api.JmolViewer; -import org.jmol.applet.AppletConsole; import org.jmol.popup.JmolPopup; class AppletJmolBinding extends jalview.ext.jmol.JalviewJmolBinding @@ -119,7 +117,8 @@ class AppletJmolBinding extends jalview.ext.jmol.JalviewJmolBinding boolean asPopup) { - jmolpopup = JmolPopup.newJmolPopup(viewer, translateLocale, menuName, + jmolpopup = new JmolPopup(); + jmolpopup.initialize(viewer, translateLocale, menuName, asPopup); } @@ -177,5 +176,10 @@ class AppletJmolBinding extends jalview.ext.jmol.JalviewJmolBinding public void releaseReferences(Object svl) { } - + @Override + public void resizeInnerPanel(String data) + { + // TODO Auto-generated method stub + + } } diff --git a/src/jalview/ext/jmol/JalviewJmolBinding.java b/src/jalview/ext/jmol/JalviewJmolBinding.java index 1299ddc..0640b8c 100644 --- a/src/jalview/ext/jmol/JalviewJmolBinding.java +++ b/src/jalview/ext/jmol/JalviewJmolBinding.java @@ -17,32 +17,40 @@ */ package jalview.ext.jmol; -import java.io.File; -import java.net.URL; -import java.util.*; -import java.applet.Applet; -import java.awt.*; -import java.awt.event.*; - -import javax.swing.JPanel; - import jalview.api.AlignmentViewPanel; import jalview.api.FeatureRenderer; import jalview.api.SequenceRenderer; import jalview.api.SequenceStructureBinding; import jalview.api.StructureSelectionManagerProvider; -import jalview.datamodel.*; -import jalview.structure.*; -import jalview.io.*; +import jalview.datamodel.AlignmentI; +import jalview.datamodel.ColumnSelection; +import jalview.datamodel.PDBEntry; +import jalview.datamodel.SequenceI; +import jalview.io.AppletFormatAdapter; +import jalview.schemes.ColourSchemeI; +import jalview.schemes.ResidueProperties; +import jalview.structure.StructureListener; +import jalview.structure.StructureMapping; +import jalview.structure.StructureSelectionManager; + +import java.awt.Color; +import java.awt.Container; +import java.awt.event.ComponentEvent; +import java.awt.event.ComponentListener; +import java.io.File; +import java.net.URL; +import java.util.Enumeration; +import java.util.Hashtable; +import java.util.Map; +import java.util.Vector; -import org.jmol.api.*; import org.jmol.adapter.smarter.SmarterJmolAdapter; - -import org.jmol.popup.*; -import org.jmol.viewer.JmolConstants; -import org.jmol.viewer.Viewer; - -import jalview.schemes.*; +import org.jmol.api.JmolAppConsoleInterface; +import org.jmol.api.JmolSelectionListener; +import org.jmol.api.JmolStatusListener; +import org.jmol.api.JmolViewer; +import org.jmol.constant.EnumCallback; +import org.jmol.popup.JmolPopup; public abstract class JalviewJmolBinding implements StructureListener, JmolStatusListener, SequenceStructureBinding, @@ -940,47 +948,48 @@ public abstract class JalviewJmolBinding implements StructureListener, } - public void notifyCallback(int type, Object[] data) + @Override + public void notifyCallback(EnumCallback type, Object[] data) { try { switch (type) { - case JmolConstants.CALLBACK_LOADSTRUCT: + case LOADSTRUCT: notifyFileLoaded((String) data[1], (String) data[2], (String) data[3], (String) data[4], ((Integer) data[5]).intValue()); break; - case JmolConstants.CALLBACK_PICK: + case PICK: notifyAtomPicked(((Integer) data[2]).intValue(), (String) data[1], (String) data[0]); // also highlight in alignment - case JmolConstants.CALLBACK_HOVER: + case HOVER: notifyAtomHovered(((Integer) data[2]).intValue(), (String) data[1], (String) data[0]); break; - case JmolConstants.CALLBACK_SCRIPT: + case SCRIPT: notifyScriptTermination((String) data[2], ((Integer) data[3]).intValue()); break; - case JmolConstants.CALLBACK_ECHO: + case ECHO: sendConsoleEcho((String) data[1]); break; - case JmolConstants.CALLBACK_MESSAGE: + case MESSAGE: sendConsoleMessage((data == null) ? ((String) null) : (String) data[1]); break; - case JmolConstants.CALLBACK_ERROR: + case ERROR: // System.err.println("Ignoring error callback."); break; - case JmolConstants.CALLBACK_SYNC: - case JmolConstants.CALLBACK_RESIZE: + case SYNC: + case RESIZE: refreshGUI(); break; - case JmolConstants.CALLBACK_MEASURE: + case MEASURE: - case JmolConstants.CALLBACK_CLICK: + case CLICK: default: System.err.println("Unhandled callback " + type + " " + data[1].toString()); @@ -993,24 +1002,25 @@ public abstract class JalviewJmolBinding implements StructureListener, } } - public boolean notifyEnabled(int callbackPick) + @Override + public boolean notifyEnabled(EnumCallback callbackPick) { switch (callbackPick) { - case JmolConstants.CALLBACK_ECHO: - case JmolConstants.CALLBACK_LOADSTRUCT: - case JmolConstants.CALLBACK_MEASURE: - case JmolConstants.CALLBACK_MESSAGE: - case JmolConstants.CALLBACK_PICK: - case JmolConstants.CALLBACK_SCRIPT: - case JmolConstants.CALLBACK_HOVER: - case JmolConstants.CALLBACK_ERROR: + case ECHO: + case LOADSTRUCT: + case MEASURE: + case MESSAGE: + case PICK: + case SCRIPT: + case HOVER: + case ERROR: return true; - case JmolConstants.CALLBACK_RESIZE: - case JmolConstants.CALLBACK_SYNC: - case JmolConstants.CALLBACK_CLICK: - case JmolConstants.CALLBACK_ANIMFRAME: - case JmolConstants.CALLBACK_MINIMIZATION: + case RESIZE: + case SYNC: + case CLICK: + case ANIMFRAME: + case MINIMIZATION: } return false; } @@ -1542,5 +1552,10 @@ public abstract class JalviewJmolBinding implements StructureListener, { return ssm.printMapping(pdbfile); } - + @Override + public void resizeInnerPanel(String data) + { + // Jalview doesn't honour resize panel requests + + } } diff --git a/src/jalview/gui/AppJmolBinding.java b/src/jalview/gui/AppJmolBinding.java index 22776f2..3e243fc 100644 --- a/src/jalview/gui/AppJmolBinding.java +++ b/src/jalview/gui/AppJmolBinding.java @@ -152,7 +152,8 @@ public class AppJmolBinding extends jalview.ext.jmol.JalviewJmolBinding boolean asPopup) { - jmolpopup = JmolPopup.newJmolPopup(viewer, translateLocale, menuName, + jmolpopup = new JmolPopup(); + jmolpopup.initialize(viewer, translateLocale, menuName, asPopup); } -- 1.7.10.2