correct initing of JmolViewer to avoid security exception in unsigned applet moed
authorjprocter <Jim Procter>
Wed, 25 Aug 2010 14:13:52 +0000 (14:13 +0000)
committerjprocter <Jim Procter>
Wed, 25 Aug 2010 14:13:52 +0000 (14:13 +0000)
src/jalview/appletgui/AppletJmol.java
src/jalview/ext/jmol/JalviewJmolBinding.java

index 103d8cb..8606e22 100644 (file)
@@ -180,9 +180,9 @@ public class AppletJmol extends EmbmenuFrame implements
     this.add(renderPanel, BorderLayout.CENTER);
     try
     {
-      jmb.allocateViewer(renderPanel, "jalviewJmol",
+      jmb.allocateViewer(renderPanel, true, ap.av.applet.getName()+"_jmol_",
               ap.av.applet.getDocumentBase(), ap.av.applet.getCodeBase(),
-              "");
+              "-applet");
     } catch (Exception e)
     {
       System.err
index 44a9993..c2eceed 100644 (file)
@@ -20,6 +20,7 @@ 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.*;
 
@@ -526,7 +527,10 @@ public abstract class JalviewJmolBinding implements StructureListener,
     return modelFileNames;
   }
 
-  public Hashtable getRegistryInfo()
+  /**
+   * map from string to applet
+   */
+  public Map getRegistryInfo()
   {
     // TODO Auto-generated method stub
     return null;
@@ -1062,11 +1066,20 @@ public abstract class JalviewJmolBinding implements StructureListener,
    */
   public abstract void refreshGUI();
 
-  public void allocateViewer(Component renderPanel, String htmlName,
+
+  /**
+   * @param renderPanel
+   * @param jmolfileio - when true will initialise jmol's file IO system (should be false in applet context)
+   * @param htmlName
+   * @param documentBase
+   * @param codeBase
+   * @param commandOptions
+   */
+  public void allocateViewer(Component renderPanel, boolean jmolfileio, String htmlName,
           URL documentBase, URL codeBase, String commandOptions)
   {
     viewer = JmolViewer.allocateViewer(renderPanel,
-            new SmarterJmolAdapter(),
+            (jmolfileio ? new SmarterJmolAdapter() : null),
             htmlName + ((Object) this).toString(), documentBase, codeBase,
             commandOptions, this);
   }