JAL-3026 Jmol functioning; some issues
[jalview.git] / src / jalview / ext / jmol / JalviewJmolBinding.java
index ca82744..babebc5 100644 (file)
@@ -1351,7 +1351,17 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel
    */
   public abstract void showConsole(boolean show);
 
+  
+  public static Viewer getJmolData(JmolParser jmolParser)
+  {
+    return (Viewer) JmolViewer.allocateViewer(null, null, null, null, null,
+            "-x -o -n", jmolParser);
+  }
+
   /**
+   * 
+   * 
+   * 
    * @param renderPanel
    * @param jmolfileio
    *          - when true will initialise jmol's file IO system (should be false
@@ -1382,13 +1392,16 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel
    * @param consolePanel
    *          - panel to contain Jmol console
    * @param buttonsToShow
-   *          - buttons to show on the console, in ordr
+   *          - buttons to show on the console, in order
    */
   public void allocateViewer(Container renderPanel, boolean jmolfileio,
           String htmlName, URL documentBase, URL codeBase,
           String commandOptions, final Container consolePanel,
           String buttonsToShow)
   {
+    
+    System.err.println("Allocating Jmol Viewer: " + commandOptions);
+    
     if (commandOptions == null)
     {
       commandOptions = "";
@@ -1400,7 +1413,12 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel
 
     viewer.setJmolStatusListener(this); // extends JmolCallbackListener
 
-    console = null;//createJmolConsole(consolePanel, buttonsToShow);
+    try {
+      console = createJmolConsole(consolePanel, buttonsToShow);
+    } catch (Throwable e) {
+      System.err.println("Could not create Jmol application console. " + e.getMessage());
+      e.printStackTrace();
+    }
     if (consolePanel != null)
     {
       consolePanel.addComponentListener(this);
@@ -1412,6 +1430,9 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel
   protected abstract JmolAppConsoleInterface createJmolConsole(
           Container consolePanel, String buttonsToShow);
 
+  // BH 2018 -- Jmol console is not working due to problems with styled documents.
+  
+
   protected org.jmol.api.JmolAppConsoleInterface console = null;
 
   @Override
@@ -1425,7 +1446,14 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel
 
   private String jmolScript(String script)
   {
-    return viewer.scriptWait(script);
+    
+    System.err.println(">>Jmol>> " + script);
+    
+    String s = viewer.scriptWait(script);
+    
+    System.err.println("<<Jmol<< " + s);
+    
+    return s;
   }
 
   @Override
@@ -1488,4 +1516,5 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel
   {
     showConsole(false);
   }
+
 }