From: hansonr Date: Mon, 29 Jul 2019 08:31:05 +0000 (+0200) Subject: JAL-3379 Javascript applet.app X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=914dfa095b556666e54e42e5be90d399cc5ccd1e;p=jalview.git JAL-3379 Javascript applet.app --- diff --git a/src/jalview/bin/Jalview.java b/src/jalview/bin/Jalview.java index a67c5fd..6f902af 100755 --- a/src/jalview/bin/Jalview.java +++ b/src/jalview/bin/Jalview.java @@ -279,7 +279,11 @@ public class Jalview implements ApplicationSingletonI, JalviewJSApi { boolean isJS = Platform.isJS(); - if (!isJS) + if (isJS) + { + Platform.setAppClass(this); + } + else { System.setSecurityManager(null); } @@ -2018,3 +2022,4 @@ public class Jalview implements ApplicationSingletonI, JalviewJSApi } + diff --git a/src/jalview/util/Platform.java b/src/jalview/util/Platform.java index e7be77d..e53d2a9 100644 --- a/src/jalview/util/Platform.java +++ b/src/jalview/util/Platform.java @@ -807,5 +807,29 @@ public class Platform } } + /** + * Set the "app" property of the HTML5 applet object, for example, + * "testApplet.app", to point to the Jalview instance. This will be the object + * that page developers use that is similar to the original Java applet object + * that was accessed via LiveConnect. + * + * @param j + */ + public static void setAppClass(Object j) + { + if (!isJS()) + { + return; + } + @SuppressWarnings("unused") + Thread t = Thread.currentThread(); + /** + * Set up "testApplet.app" to be this instance + * + * @j2sNative + * + * try {self[t.name].app = j}catch(e){} + */ + } }