(JAL-980) update binding for refactored Jmol constants and new interface methods
authorjprocter <jprocter@compbio.dundee.ac.uk>
Fri, 4 Nov 2011 15:28:14 +0000 (15:28 +0000)
committerjprocter <jprocter@compbio.dundee.ac.uk>
Fri, 4 Nov 2011 15:28:14 +0000 (15:28 +0000)
src/jalview/appletgui/AppletJmolBinding.java
src/jalview/ext/jmol/JalviewJmolBinding.java
src/jalview/gui/AppJmolBinding.java

index eca6406..3750c20 100644 (file)
  */
 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
+    
+  }
 }
index 1299ddc..0640b8c 100644 (file)
  */\r
 package jalview.ext.jmol;\r
 \r
-import java.io.File;\r
-import java.net.URL;\r
-import java.util.*;\r
-import java.applet.Applet;\r
-import java.awt.*;\r
-import java.awt.event.*;\r
-\r
-import javax.swing.JPanel;\r
-\r
 import jalview.api.AlignmentViewPanel;\r
 import jalview.api.FeatureRenderer;\r
 import jalview.api.SequenceRenderer;\r
 import jalview.api.SequenceStructureBinding;\r
 import jalview.api.StructureSelectionManagerProvider;\r
-import jalview.datamodel.*;\r
-import jalview.structure.*;\r
-import jalview.io.*;\r
+import jalview.datamodel.AlignmentI;\r
+import jalview.datamodel.ColumnSelection;\r
+import jalview.datamodel.PDBEntry;\r
+import jalview.datamodel.SequenceI;\r
+import jalview.io.AppletFormatAdapter;\r
+import jalview.schemes.ColourSchemeI;\r
+import jalview.schemes.ResidueProperties;\r
+import jalview.structure.StructureListener;\r
+import jalview.structure.StructureMapping;\r
+import jalview.structure.StructureSelectionManager;\r
+\r
+import java.awt.Color;\r
+import java.awt.Container;\r
+import java.awt.event.ComponentEvent;\r
+import java.awt.event.ComponentListener;\r
+import java.io.File;\r
+import java.net.URL;\r
+import java.util.Enumeration;\r
+import java.util.Hashtable;\r
+import java.util.Map;\r
+import java.util.Vector;\r
 \r
-import org.jmol.api.*;\r
 import org.jmol.adapter.smarter.SmarterJmolAdapter;\r
-\r
-import org.jmol.popup.*;\r
-import org.jmol.viewer.JmolConstants;\r
-import org.jmol.viewer.Viewer;\r
-\r
-import jalview.schemes.*;\r
+import org.jmol.api.JmolAppConsoleInterface;\r
+import org.jmol.api.JmolSelectionListener;\r
+import org.jmol.api.JmolStatusListener;\r
+import org.jmol.api.JmolViewer;\r
+import org.jmol.constant.EnumCallback;\r
+import org.jmol.popup.JmolPopup;\r
 \r
 public abstract class JalviewJmolBinding implements StructureListener,\r
         JmolStatusListener, SequenceStructureBinding,\r
@@ -940,47 +948,48 @@ public abstract class JalviewJmolBinding implements StructureListener,
 \r
   }\r
 \r
-  public void notifyCallback(int type, Object[] data)\r
+  @Override\r
+  public void notifyCallback(EnumCallback type, Object[] data)\r
   {\r
     try\r
     {\r
       switch (type)\r
       {\r
-      case JmolConstants.CALLBACK_LOADSTRUCT:\r
+      case LOADSTRUCT:\r
         notifyFileLoaded((String) data[1], (String) data[2],\r
                 (String) data[3], (String) data[4],\r
                 ((Integer) data[5]).intValue());\r
 \r
         break;\r
-      case JmolConstants.CALLBACK_PICK:\r
+      case PICK:\r
         notifyAtomPicked(((Integer) data[2]).intValue(), (String) data[1],\r
                 (String) data[0]);\r
         // also highlight in alignment\r
-      case JmolConstants.CALLBACK_HOVER:\r
+      case HOVER:\r
         notifyAtomHovered(((Integer) data[2]).intValue(), (String) data[1],\r
                 (String) data[0]);\r
         break;\r
-      case JmolConstants.CALLBACK_SCRIPT:\r
+      case SCRIPT:\r
         notifyScriptTermination((String) data[2],\r
                 ((Integer) data[3]).intValue());\r
         break;\r
-      case JmolConstants.CALLBACK_ECHO:\r
+      case ECHO:\r
         sendConsoleEcho((String) data[1]);\r
         break;\r
-      case JmolConstants.CALLBACK_MESSAGE:\r
+      case MESSAGE:\r
         sendConsoleMessage((data == null) ? ((String) null)\r
                 : (String) data[1]);\r
         break;\r
-      case JmolConstants.CALLBACK_ERROR:\r
+      case ERROR:\r
         // System.err.println("Ignoring error callback.");\r
         break;\r
-      case JmolConstants.CALLBACK_SYNC:\r
-      case JmolConstants.CALLBACK_RESIZE:\r
+      case SYNC:\r
+      case RESIZE:\r
         refreshGUI();\r
         break;\r
-      case JmolConstants.CALLBACK_MEASURE:\r
+      case MEASURE:\r
 \r
-      case JmolConstants.CALLBACK_CLICK:\r
+      case CLICK:\r
       default:\r
         System.err.println("Unhandled callback " + type + " "\r
                 + data[1].toString());\r
@@ -993,24 +1002,25 @@ public abstract class JalviewJmolBinding implements StructureListener,
     }\r
   }\r
 \r
-  public boolean notifyEnabled(int callbackPick)\r
+  @Override\r
+  public boolean notifyEnabled(EnumCallback callbackPick)\r
   {\r
     switch (callbackPick)\r
     {\r
-    case JmolConstants.CALLBACK_ECHO:\r
-    case JmolConstants.CALLBACK_LOADSTRUCT:\r
-    case JmolConstants.CALLBACK_MEASURE:\r
-    case JmolConstants.CALLBACK_MESSAGE:\r
-    case JmolConstants.CALLBACK_PICK:\r
-    case JmolConstants.CALLBACK_SCRIPT:\r
-    case JmolConstants.CALLBACK_HOVER:\r
-    case JmolConstants.CALLBACK_ERROR:\r
+    case ECHO:\r
+    case LOADSTRUCT:\r
+    case MEASURE:\r
+    case MESSAGE:\r
+    case PICK:\r
+    case SCRIPT:\r
+    case HOVER:\r
+    case ERROR:\r
       return true;\r
-    case JmolConstants.CALLBACK_RESIZE:\r
-    case JmolConstants.CALLBACK_SYNC:\r
-    case JmolConstants.CALLBACK_CLICK:\r
-    case JmolConstants.CALLBACK_ANIMFRAME:\r
-    case JmolConstants.CALLBACK_MINIMIZATION:\r
+    case RESIZE:\r
+    case SYNC:\r
+    case CLICK:\r
+    case ANIMFRAME:\r
+    case MINIMIZATION:\r
     }\r
     return false;\r
   }\r
@@ -1542,5 +1552,10 @@ public abstract class JalviewJmolBinding implements StructureListener,
   {\r
     return ssm.printMapping(pdbfile);\r
   }\r
-\r
+  @Override\r
+  public void resizeInnerPanel(String data)\r
+  {\r
+    // Jalview doesn't honour resize panel requests\r
+    \r
+  }\r
 }\r
index 22776f2..3e243fc 100644 (file)
@@ -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);
   }