From 914dfa095b556666e54e42e5be90d399cc5ccd1e Mon Sep 17 00:00:00 2001 From: hansonr Date: Mon, 29 Jul 2019 10:31:05 +0200 Subject: [PATCH] JAL-3379 Javascript applet.app --- src/jalview/bin/Jalview.java | 7 ++++++- src/jalview/util/Platform.java | 24 ++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) 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){} + */ + } } -- 1.7.10.2