patched Jmol and code for embedding JmolAppConsole in a JPanel (JAL-638)
[jalview.git] / src / jalview / gui / AppJmolBinding.java
index 5727386..2a0e2a7 100644 (file)
@@ -5,11 +5,14 @@ package jalview.gui;
 
 import java.util.BitSet;
 
+import javax.swing.JPanel;
+
 import jalview.bin.Cache;
 import jalview.datamodel.PDBEntry;
 import jalview.datamodel.SequenceI;
 
 import org.jmol.popup.JmolPopup;
+import org.openscience.jmol.app.jmolpanel.AppConsole;
 
 public class AppJmolBinding extends jalview.ext.jmol.JalviewJmolBinding
 {
@@ -53,19 +56,19 @@ public class AppJmolBinding extends jalview.ext.jmol.JalviewJmolBinding
 
   public void sendConsoleEcho(String strEcho)
   {
-    if (appJmolWindow.scriptWindow != null)
+    if (console != null)
     {
-      appJmolWindow.scriptWindow.sendConsoleEcho(strEcho);
+      console.sendConsoleEcho(strEcho);
     }
   }
 
   public void sendConsoleMessage(String strStatus)
   {
-    if (appJmolWindow.scriptWindow != null && strStatus != null)
+    if (console != null && strStatus != null)
     // && !strStatus.equals("Script completed"))
     // should we squash the script completed string ?
     {
-      appJmolWindow.scriptWindow.sendConsoleMessage(strStatus);
+      console.sendConsoleMessage(strStatus);
     }
   }
 
@@ -104,9 +107,10 @@ public class AppJmolBinding extends jalview.ext.jmol.JalviewJmolBinding
 
   public void notifyScriptTermination(String strStatus, int msWalltime)
   {
-    if (appJmolWindow.scriptWindow != null)
-      appJmolWindow.scriptWindow.notifyScriptTermination(strStatus,
-              msWalltime);
+    // todo - script termination doesn't happen ?
+    //if (console != null)
+      //console.notifyScriptTermination(strStatus,
+      //        msWalltime);
   }
 
   public void showUrl(String url)
@@ -134,6 +138,9 @@ public class AppJmolBinding extends jalview.ext.jmol.JalviewJmolBinding
 
   }
 
+  public void showConsole(boolean b) {
+    appJmolWindow.showConsole(b);
+  }
 
   /**
    * add the given sequences to the mapping scope for the given pdb file handle
@@ -153,5 +160,4 @@ public class AppJmolBinding extends jalview.ext.jmol.JalviewJmolBinding
       }
     }
   }
-
 }
\ No newline at end of file