From: jprocter Date: Wed, 25 Aug 2010 14:13:52 +0000 (+0000) Subject: correct initing of JmolViewer to avoid security exception in unsigned applet moed X-Git-Tag: Release_2_6~95 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=49b3cee21dcfbf55f628d9b1593a908ad76b5dfc;p=jalview.git correct initing of JmolViewer to avoid security exception in unsigned applet moed --- diff --git a/src/jalview/appletgui/AppletJmol.java b/src/jalview/appletgui/AppletJmol.java index 103d8cb..8606e22 100644 --- a/src/jalview/appletgui/AppletJmol.java +++ b/src/jalview/appletgui/AppletJmol.java @@ -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 diff --git a/src/jalview/ext/jmol/JalviewJmolBinding.java b/src/jalview/ext/jmol/JalviewJmolBinding.java index 44a9993..c2eceed 100644 --- a/src/jalview/ext/jmol/JalviewJmolBinding.java +++ b/src/jalview/ext/jmol/JalviewJmolBinding.java @@ -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); }