Merge branch 'master' of https://source.jalview.org/git/jalviewjs.git
[jalviewjs.git] / site / j2s / swingjs / JSAppletPanel.js
index 29689dc..998fa86 100644 (file)
-Clazz.declarePackage ("swingjs");\r
-Clazz.load (["java.applet.AppletContext", "$.AppletStub", "java.awt.Panel", "swingjs.api.JSInterface", "java.awt.Dimension"], "swingjs.JSAppletPanel", ["java.lang.InstantiationException", "java.net.URL", "java.awt.BorderLayout", "$.Font", "$.Toolkit", "javax.swing.JApplet", "jssun.applet.AppletEvent", "$.AppletEventMulticaster", "swingjs.JSAppletThread", "$.JSGraphics2D", "$.JSMouse", "$.JSThreadGroup", "$.JSToolkit", "$.JSUtil", "swingjs.api.Interface"], function () {\r
-c$ = Clazz.decorateAsClass (function () {\r
-this.params = null;\r
-this.html5Applet = null;\r
-this.fullName = null;\r
-this.appletCodeBase = null;\r
-this.appletIdiomaBase = null;\r
-this.appletDocumentBase = null;\r
-this.maximumSize = 2147483647;\r
-this.appletName = null;\r
-this.syncId = null;\r
-this.testAsync = false;\r
-this.async = false;\r
-this.strJavaVersion = null;\r
-this.strJavaVendor = null;\r
-this.display = null;\r
-this.canvas = null;\r
-this.jsgraphics = null;\r
-this.applet = null;\r
-this.defaultAppletSize = null;\r
-this.currentAppletSize = null;\r
-this.nextStatus = 0;\r
-this.status = 0;\r
-this.listeners = null;\r
-this.mouse = null;\r
-Clazz.instantialize (this, arguments);\r
-}, swingjs, "JSAppletPanel", java.awt.Panel, [java.applet.AppletStub, java.applet.AppletContext, swingjs.api.JSInterface]);\r
-Clazz.prepareFields (c$, function () {\r
-this.defaultAppletSize =  new java.awt.Dimension (10, 10);\r
-this.currentAppletSize =  new java.awt.Dimension (10, 10);\r
-});\r
-Clazz.makeConstructor (c$, \r
-function (params) {\r
-Clazz.superConstructor (this, swingjs.JSAppletPanel, []);\r
-this.setPanel ();\r
-this.set (params);\r
-}, "java.util.Hashtable");\r
-Clazz.defineMethod (c$, "set", \r
- function (params) {\r
-System.out.println ("JSAppletPanel initializing");\r
-this.params = params;\r
-this.htmlName = swingjs.JSUtil.split ("" + this.getParameter ("name"), "_object")[0];\r
-this.appletName = swingjs.JSUtil.split (this.htmlName + "_", "_")[0];\r
-this.syncId = this.getParameter ("syncId");\r
-this.fullName = this.htmlName + "__" + this.syncId + "__";\r
-params.put ("fullName", this.fullName);\r
-var o = params.get ("codePath");\r
-if (o == null) o = "../java/";\r
-this.appletCodeBase = o.toString ();\r
-this.appletIdiomaBase = this.appletCodeBase.substring (0, this.appletCodeBase.lastIndexOf ("/", this.appletCodeBase.length - 2) + 1) + "idioma";\r
-o = params.get ("documentBase");\r
-this.appletDocumentBase = (o == null ? "" : o.toString ());\r
-if (params.containsKey ("maximumSize")) Math.max ((params.get ("maximumSize")).intValue (), 100);\r
-this.async = (this.testAsync || params.containsKey ("async"));\r
-var applet = null;\r
-var javaver = "?";\r
-{\r
-if(self.Jmol) { applet =\r
-Jmol._applets[this.htmlName.split("_object")[0]]; javaver =\r
-Jmol._version; }\r
-}this.html5Applet = applet;\r
-this.strJavaVersion = javaver;\r
-this.strJavaVendor = "Java2Script/Java 1.6 (HTML5)";\r
-this.display = params.get ("display");\r
-this.threadGroup =  new swingjs.JSThreadGroup (this.appletName);\r
-this.myThread =  new swingjs.JSAppletThread (this, this.threadGroup, this.appletName);\r
-(this.threadGroup).setHtmlApplet (this.html5Applet);\r
-{\r
-Jmol._applets[this.appletName + "_thread"] =\r
-java.lang.Thread.thisThread = this.myThread;\r
-}this.appContext = swingjs.JSToolkit.createNewAppContext ();\r
-java.awt.Toolkit.getDefaultToolkit ();\r
-try {\r
-java.net.URL.setURLStreamHandlerFactory (swingjs.api.Interface.getInstance ("JU.AjaxURLStreamHandlerFactory", false));\r
-} catch (e) {\r
-}\r
-System.out.println ("JSAppletPanel initialized");\r
-}, "java.util.Hashtable");\r
-Clazz.defineMethod (c$, "start", \r
-function () {\r
-if (this.status == 0) this.myThread.start ();\r
- else this.showStatus ("already started");\r
-});\r
-Clazz.defineMethod (c$, "addAppletListener", \r
-function (l) {\r
-this.listeners = jssun.applet.AppletEventMulticaster.add (this.listeners, l);\r
-}, "jssun.applet.AppletListener");\r
-Clazz.defineMethod (c$, "removeAppletListener", \r
-function (l) {\r
-this.listeners = jssun.applet.AppletEventMulticaster.remove (this.listeners, l);\r
-}, "jssun.applet.AppletListener");\r
-Clazz.defineMethod (c$, "dispatchAppletEvent", \r
-function (id, argument) {\r
-if (this.listeners != null) {\r
-var evt =  new jssun.applet.AppletEvent (this, id, argument);\r
-this.listeners.appletStateChanged (evt);\r
-}}, "~N,~O");\r
-Clazz.defineMethod (c$, "getCode", \r
- function () {\r
-return this.getParameter ("code");\r
-});\r
-Clazz.defineMethod (c$, "getCanvas", \r
- function () {\r
-return (this.canvas == null ? (this.canvas = this.html5Applet._getHtml5Canvas ()) : this.canvas);\r
-});\r
-Clazz.overrideMethod (c$, "isActive", \r
-function () {\r
-return true;\r
-});\r
-Clazz.overrideMethod (c$, "appletResize", \r
-function (width, height) {\r
-var currentSize =  new java.awt.Dimension (this.currentAppletSize.width, this.currentAppletSize.height);\r
-this.currentAppletSize.width = width;\r
-this.currentAppletSize.height = height;\r
-this.applet.setBounds (0, 0, this.getWidth (), this.getHeight ());\r
-this.applet.getRootPane ().setBounds (0, 0, this.getWidth (), this.getHeight ());\r
-this.applet.getContentPane ().setBounds (0, 0, this.getWidth (), this.getHeight ());\r
-(this.applet.getContentPane ()).revalidate ();\r
-this.dispatchAppletEvent (51234, currentSize);\r
-}, "~N,~N");\r
-Clazz.overrideMethod (c$, "getDocumentBase", \r
-function () {\r
-try {\r
-return  new java.net.URL (this.params.get ("documentBase"));\r
-} catch (e) {\r
-if (Clazz.exceptionOf (e, java.net.MalformedURLException)) {\r
-return null;\r
-} else {\r
-throw e;\r
-}\r
-}\r
-});\r
-Clazz.overrideMethod (c$, "getCodeBase", \r
-function () {\r
-try {\r
-return  new java.net.URL (this.params.get ("codePath"));\r
-} catch (e) {\r
-if (Clazz.exceptionOf (e, java.net.MalformedURLException)) {\r
-return null;\r
-} else {\r
-throw e;\r
-}\r
-}\r
-});\r
-Clazz.overrideMethod (c$, "getParameter", \r
-function (name) {\r
-var s = this.params.get (name);\r
-System.out.println ("get parameter: " + name + " = " + s);\r
-return (s == null ? null : "" + s);\r
-}, "~S");\r
-Clazz.overrideMethod (c$, "getAppletContext", \r
-function () {\r
-return this;\r
-});\r
-Clazz.defineMethod (c$, "getHeight", \r
-function () {\r
-return this.html5Applet._getHeight ();\r
-});\r
-Clazz.defineMethod (c$, "getWidth", \r
-function () {\r
-return this.html5Applet._getWidth ();\r
-});\r
-Clazz.defineMethod (c$, "setBounds", \r
-function (x, y, width, height) {\r
-this.reshape (x, y, width, height);\r
-this.currentAppletSize.width = width;\r
-this.currentAppletSize.height = height;\r
-}, "~N,~N,~N,~N");\r
-Clazz.overrideMethod (c$, "getImage", \r
-function (url) {\r
-return null;\r
-}, "java.net.URL");\r
-Clazz.overrideMethod (c$, "getApplet", \r
-function (name) {\r
-var applet = null;\r
-{\r
-applet = Jmol._applets[name]; applet && (applet =\r
-applet._applet);\r
-}return applet;\r
-}, "~S");\r
-Clazz.overrideMethod (c$, "getApplets", \r
-function () {\r
-return null;\r
-});\r
-Clazz.defineMethod (c$, "showDocument", \r
-function (url) {\r
-{\r
-window.open(url.toString());\r
-}}, "java.net.URL");\r
-Clazz.defineMethod (c$, "showDocument", \r
-function (url, target) {\r
-{\r
-window.open(url.toString(), target);\r
-}}, "java.net.URL,~S");\r
-Clazz.defineMethod (c$, "showStatus", \r
-function (status) {\r
-swingjs.JSToolkit.log (status);\r
-{\r
-Clazz._LoaderProgressMonitor.showStatus(status, true);\r
-}}, "~S");\r
-Clazz.overrideMethod (c$, "cacheFileByName", \r
-function (fileName, isAdd) {\r
-return 0;\r
-}, "~S,~B");\r
-Clazz.overrideMethod (c$, "cachePut", \r
-function (key, data) {\r
-}, "~S,~O");\r
-Clazz.overrideMethod (c$, "destroy", \r
-function () {\r
-});\r
-Clazz.overrideMethod (c$, "getFullName", \r
-function () {\r
-return this.fullName;\r
-});\r
-Clazz.overrideMethod (c$, "openFileAsyncSpecial", \r
-function (fileName, flags) {\r
-}, "~S,~N");\r
-Clazz.defineMethod (c$, "processMouseEvent", \r
-function (id, x, y, modifiers, time) {\r
-this.getMouse ().processEvent (id, x, y, modifiers, time);\r
-return false;\r
-}, "~N,~N,~N,~N,~N");\r
-Clazz.defineMethod (c$, "getMouse", \r
- function () {\r
-return (this.mouse == null ? this.mouse =  new swingjs.JSMouse (this) : this.mouse);\r
-});\r
-Clazz.overrideMethod (c$, "processTwoPointGesture", \r
-function (touches) {\r
-this.getMouse ().processTwoPointGesture (touches);\r
-}, "~A");\r
-Clazz.overrideMethod (c$, "setDisplay", \r
-function (canvas) {\r
-this.canvas = canvas;\r
-}, "swingjs.api.HTML5Canvas");\r
-Clazz.overrideMethod (c$, "setScreenDimension", \r
-function (width, height) {\r
-this.setGraphics (this.jsgraphics = null);\r
-if (this.applet != null) this.applet.resize (width, height);\r
-}, "~N,~N");\r
-Clazz.overrideMethod (c$, "setStatusDragDropped", \r
-function (mode, x, y, fileName) {\r
-return false;\r
-}, "~N,~N,~N,~S");\r
-Clazz.overrideMethod (c$, "startHoverWatcher", \r
-function (enable) {\r
-}, "~B");\r
-Clazz.overrideMethod (c$, "paint", \r
-function (g) {\r
-this.applet.paint (this.setGraphics (g));\r
-}, "java.awt.Graphics");\r
-Clazz.defineMethod (c$, "setGraphics", \r
- function (g) {\r
-return (g == null ? this.getGraphics () : g);\r
-}, "java.awt.Graphics");\r
-Clazz.overrideMethod (c$, "getGraphics", \r
-function () {\r
-if (this.jsgraphics == null) {\r
-this.jsgraphics =  new swingjs.JSGraphics2D (this.getCanvas ());\r
-this.jsgraphics.setWindowParameters (this.getWidth (), this.getHeight ());\r
-}return this.jsgraphics;\r
-});\r
-Clazz.defineMethod (c$, "showAppletStatus", \r
- function (status) {\r
-this.getAppletContext ().showStatus (this.htmlName + " " + status);\r
-}, "~S");\r
-Clazz.defineMethod (c$, "showAppletException", \r
- function (t) {\r
-{\r
-this.showAppletStatus("error " + (t.getMessage ?\r
-t.getMessage() : t)); t.printStackTrace &&\r
-t.printStackTrace();\r
-}this.repaint ();\r
-}, "Throwable");\r
-Clazz.defineMethod (c$, "run1", \r
-function (mode) {\r
-var ok = false;\r
-switch (mode) {\r
-case 0:\r
-this.currentAppletSize.width = this.defaultAppletSize.width = this.getWidth ();\r
-this.currentAppletSize.height = this.defaultAppletSize.height = this.getHeight ();\r
-this.setLayout ( new java.awt.BorderLayout ());\r
-this.nextStatus = 1;\r
-ok = true;\r
-break;\r
-case 1:\r
-switch (this.nextStatus) {\r
-case 1:\r
-if (this.status != 0) {\r
-this.showAppletStatus ("notdisposed");\r
-this.status = 7;\r
-break;\r
-}System.out.println ("JSAppletPanel runloader");\r
-this.runLoader ();\r
-this.nextStatus = 2;\r
-ok = true;\r
-break;\r
-case 2:\r
-if (this.status != 1 && this.status != 5) {\r
-this.showAppletStatus ("notloaded");\r
-break;\r
-}System.out.println ("JSAppletPanel init");\r
-this.setFont ( new java.awt.Font ("Dialog", 0, 12));\r
-this.applet.resize (this.defaultAppletSize);\r
-this.applet.init ();\r
-this.validate ();\r
-this.status = 2;\r
-this.showAppletStatus ("initialized");\r
-this.nextStatus = 3;\r
-ok = true;\r
-break;\r
-case 3:\r
-if (this.status != 2 && this.status != 4) {\r
-this.showAppletStatus ("notstarted");\r
-this.status = 7;\r
-break;\r
-}this.applet.getRootPane ().addNotify ();\r
-System.out.println ("JSAppletPanel start" + this.currentAppletSize);\r
-this.applet.resize (this.currentAppletSize);\r
-this.applet.start ();\r
-this.status = 3;\r
-this.showAppletStatus ("started");\r
-this.nextStatus = 35;\r
-ok = true;\r
-break;\r
-case 35:\r
-swingjs.JSToolkit.readyCallback (this.appletName, this.fullName, this.applet, this);\r
-break;\r
-case 4:\r
-if (this.status == 3) {\r
-this.status = 4;\r
-this.applet.setVisible (false);\r
-this.applet.stop ();\r
-this.showAppletStatus ("stopped");\r
-} else {\r
-this.showAppletStatus ("notstopped");\r
-this.status = 7;\r
-}break;\r
-case 5:\r
-if (this.status == 4 || this.status == 2) {\r
-this.status = 5;\r
-this.applet.destroy ();\r
-this.showAppletStatus ("destroyed");\r
-} else {\r
-this.showAppletStatus ("notdestroyed");\r
-this.status = 7;\r
-}break;\r
-case 75:\r
-if (this.status == 5 || this.status == 1) {\r
-this.showAppletStatus ("notdisposed");\r
-this.status = 7;\r
-} else {\r
-this.status = 0;\r
-this.removeChild (this.applet);\r
-this.applet = null;\r
-this.showAppletStatus ("disposed");\r
-}break;\r
-case 6:\r
-break;\r
-default:\r
-System.out.println ("unrecognized JSAppletPanel status: " + this.nextStatus);\r
-break;\r
-}\r
-break;\r
-default:\r
-System.out.println ("unrecognized JSAppletThread mode: " + mode);\r
-break;\r
-}\r
-return (ok ? 1 : 2);\r
-}, "~N");\r
-Clazz.defineMethod (c$, "runLoader", \r
- function () {\r
-this.dispatchAppletEvent (51235, null);\r
-this.status = 1;\r
-var code = this.getCode ();\r
-try {\r
-if (code == null) {\r
-System.err.println ("runloader.err-- \"code\" must be specified.");\r
-throw  new InstantiationException ("\"code\" must be specified.");\r
-}this.applet = swingjs.JSToolkit.getInstance (code);\r
-if (this.applet == null) {\r
-System.out.println (code + " could not be launched");\r
-this.status = 7;\r
-} else if (!(Clazz.instanceOf (this.applet, javax.swing.JApplet))) {\r
-System.out.println (code + " is not a JApplet!?");\r
-this.status = 7;\r
-}} catch (e$$) {\r
-if (Clazz.exceptionOf (e$$, InstantiationException)) {\r
-var e = e$$;\r
-{\r
-this.status = 7;\r
-this.showAppletException (e);\r
-return;\r
-}\r
-} else if (Clazz.exceptionOf (e$$, Exception)) {\r
-var e = e$$;\r
-{\r
-this.status = 7;\r
-this.showAppletException (e);\r
-return;\r
-}\r
-} else if (Clazz.exceptionOf (e$$, ThreadDeath)) {\r
-var e = e$$;\r
-{\r
-this.status = 7;\r
-this.showAppletStatus ("death");\r
-return;\r
-}\r
-} else if (Clazz.exceptionOf (e$$, Error)) {\r
-var e = e$$;\r
-{\r
-this.status = 7;\r
-this.showAppletException (e);\r
-return;\r
-}\r
-} else {\r
-throw e$$;\r
-}\r
-} finally {\r
-this.dispatchAppletEvent (51236, null);\r
-}\r
-if (this.applet != null) {\r
-this.applet.setStub (this);\r
-this.applet.setVisible (false);\r
-this.add ("Center", this.applet);\r
-this.applet.setDispatcher ();\r
-this.applet.addNotify ();\r
-this.showAppletStatus ("loaded");\r
-this.validate ();\r
-}});\r
-Clazz.defineMethod (c$, "getUI", \r
-function () {\r
-return null;\r
-});\r
-Clazz.overrideMethod (c$, "repaintImpl", \r
-function (tm, x, y, width, height) {\r
-if (this.applet.isVisible () && this.applet.getWidth () > 0 && this.applet.getHeight () > 0) {\r
-this.applet.getContentPane ().repaint (tm, x, y, width, height);\r
-}}, "~N,~N,~N,~N,~N");\r
-Clazz.defineStatics (c$,\r
-"APPLET_UNINITIALIZED", 0,\r
-"APPLET_LOAD", 1,\r
-"APPLET_INIT", 2,\r
-"APPLET_START", 3,\r
-"APPLET_READY", 35,\r
-"APPLET_STOP", 4,\r
-"APPLET_DESTROY", 5,\r
-"APPLET_QUIT", 6,\r
-"APPLET_ERROR", 7,\r
-"APPLET_DISPOSE", 75,\r
-"APPLET_RESIZE", 51234,\r
-"APPLET_LOADING", 51235,\r
-"APPLET_LOADING_COMPLETED", 51236);\r
-});\r
+Clazz.declarePackage ("swingjs");
+Clazz.load (["java.applet.AppletContext", "$.AppletStub", "java.awt.Panel", "swingjs.api.JSInterface", "java.awt.Dimension"], "swingjs.JSAppletPanel", ["java.lang.InstantiationException", "java.net.URL", "java.awt.BorderLayout", "$.Font", "$.Toolkit", "javax.swing.JApplet", "jssun.applet.AppletEvent", "$.AppletEventMulticaster", "swingjs.JSAppletThread", "$.JSGraphics2D", "$.JSMouse", "$.JSThreadGroup", "$.JSToolkit", "$.JSUtil", "swingjs.api.Interface"], function () {
+c$ = Clazz.decorateAsClass (function () {
+this.params = null;
+this.html5Applet = null;
+this.fullName = null;
+this.appletCodeBase = null;
+this.appletIdiomaBase = null;
+this.appletDocumentBase = null;
+this.maximumSize = 2147483647;
+this.appletName = null;
+this.syncId = null;
+this.testAsync = false;
+this.async = false;
+this.strJavaVersion = null;
+this.strJavaVendor = null;
+this.display = null;
+this.canvas = null;
+this.jsgraphics = null;
+this.applet = null;
+this.defaultAppletSize = null;
+this.currentAppletSize = null;
+this.nextStatus = 0;
+this.status = 0;
+this.listeners = null;
+this.mouse = null;
+Clazz.instantialize (this, arguments);
+}, swingjs, "JSAppletPanel", java.awt.Panel, [java.applet.AppletStub, java.applet.AppletContext, swingjs.api.JSInterface]);
+Clazz.prepareFields (c$, function () {
+this.defaultAppletSize =  new java.awt.Dimension (10, 10);
+this.currentAppletSize =  new java.awt.Dimension (10, 10);
+});
+Clazz.makeConstructor (c$, 
+function (params) {
+Clazz.superConstructor (this, swingjs.JSAppletPanel, []);
+this.setPanel ();
+this.set (params);
+}, "java.util.Hashtable");
+Clazz.defineMethod (c$, "set", 
+ function (params) {
+System.out.println ("JSAppletPanel initializing");
+this.params = params;
+this.htmlName = swingjs.JSUtil.split ("" + this.getParameter ("name"), "_object")[0];
+this.appletName = swingjs.JSUtil.split (this.htmlName + "_", "_")[0];
+this.syncId = this.getParameter ("syncId");
+this.fullName = this.htmlName + "__" + this.syncId + "__";
+params.put ("fullName", this.fullName);
+var o = params.get ("codePath");
+if (o == null) o = "../java/";
+this.appletCodeBase = o.toString ();
+this.appletIdiomaBase = this.appletCodeBase.substring (0, this.appletCodeBase.lastIndexOf ("/", this.appletCodeBase.length - 2) + 1) + "idioma";
+o = params.get ("documentBase");
+this.appletDocumentBase = (o == null ? "" : o.toString ());
+if (params.containsKey ("maximumSize")) Math.max ((params.get ("maximumSize")).intValue (), 100);
+this.async = (this.testAsync || params.containsKey ("async"));
+var applet = null;
+var javaver = "?";
+{
+if(self.Jmol) { applet =
+Jmol._applets[this.htmlName.split("_object")[0]]; javaver =
+Jmol._version; }
+}this.html5Applet = applet;
+this.strJavaVersion = javaver;
+this.strJavaVendor = "Java2Script/Java 1.6 (HTML5)";
+this.display = params.get ("display");
+this.threadGroup =  new swingjs.JSThreadGroup (this.appletName);
+this.myThread =  new swingjs.JSAppletThread (this, this.threadGroup, this.appletName);
+(this.threadGroup).setHtmlApplet (this.html5Applet);
+{
+Jmol._applets[this.appletName + "_thread"] =
+java.lang.Thread.thisThread = this.myThread;
+}this.appContext = swingjs.JSToolkit.createNewAppContext ();
+java.awt.Toolkit.getDefaultToolkit ();
+try {
+java.net.URL.setURLStreamHandlerFactory (swingjs.api.Interface.getInstance ("JU.AjaxURLStreamHandlerFactory", false));
+} catch (e) {
+}
+System.out.println ("JSAppletPanel initialized");
+}, "java.util.Hashtable");
+Clazz.defineMethod (c$, "start", 
+function () {
+if (this.status == 0) this.myThread.start ();
+ else this.showStatus ("already started");
+});
+Clazz.defineMethod (c$, "addAppletListener", 
+function (l) {
+this.listeners = jssun.applet.AppletEventMulticaster.add (this.listeners, l);
+}, "jssun.applet.AppletListener");
+Clazz.defineMethod (c$, "removeAppletListener", 
+function (l) {
+this.listeners = jssun.applet.AppletEventMulticaster.remove (this.listeners, l);
+}, "jssun.applet.AppletListener");
+Clazz.defineMethod (c$, "dispatchAppletEvent", 
+function (id, argument) {
+if (this.listeners != null) {
+var evt =  new jssun.applet.AppletEvent (this, id, argument);
+this.listeners.appletStateChanged (evt);
+}}, "~N,~O");
+Clazz.defineMethod (c$, "getCode", 
+ function () {
+return this.getParameter ("code");
+});
+Clazz.defineMethod (c$, "getCanvas", 
+ function () {
+return (this.canvas == null ? (this.canvas = this.html5Applet._getHtml5Canvas ()) : this.canvas);
+});
+Clazz.overrideMethod (c$, "isActive", 
+function () {
+return true;
+});
+Clazz.overrideMethod (c$, "appletResize", 
+function (width, height) {
+var currentSize =  new java.awt.Dimension (this.currentAppletSize.width, this.currentAppletSize.height);
+this.currentAppletSize.width = width;
+this.currentAppletSize.height = height;
+this.applet.setBounds (0, 0, this.getWidth (), this.getHeight ());
+this.applet.getRootPane ().setBounds (0, 0, this.getWidth (), this.getHeight ());
+this.applet.getContentPane ().setBounds (0, 0, this.getWidth (), this.getHeight ());
+(this.applet.getContentPane ()).revalidate ();
+this.dispatchAppletEvent (51234, currentSize);
+}, "~N,~N");
+Clazz.overrideMethod (c$, "getDocumentBase", 
+function () {
+try {
+return  new java.net.URL (this.params.get ("documentBase"));
+} catch (e) {
+if (Clazz.exceptionOf (e, java.net.MalformedURLException)) {
+return null;
+} else {
+throw e;
+}
+}
+});
+Clazz.overrideMethod (c$, "getCodeBase", 
+function () {
+try {
+return  new java.net.URL (this.params.get ("codePath"));
+} catch (e) {
+if (Clazz.exceptionOf (e, java.net.MalformedURLException)) {
+return null;
+} else {
+throw e;
+}
+}
+});
+Clazz.overrideMethod (c$, "getParameter", 
+function (name) {
+var s = this.params.get (name);
+System.out.println ("get parameter: " + name + " = " + s);
+return (s == null ? null : "" + s);
+}, "~S");
+Clazz.overrideMethod (c$, "getAppletContext", 
+function () {
+return this;
+});
+Clazz.defineMethod (c$, "getHeight", 
+function () {
+return this.html5Applet._getHeight ();
+});
+Clazz.defineMethod (c$, "getWidth", 
+function () {
+return this.html5Applet._getWidth ();
+});
+Clazz.defineMethod (c$, "setBounds", 
+function (x, y, width, height) {
+this.reshape (x, y, width, height);
+this.currentAppletSize.width = width;
+this.currentAppletSize.height = height;
+}, "~N,~N,~N,~N");
+Clazz.overrideMethod (c$, "getImage", 
+function (url) {
+return null;
+}, "java.net.URL");
+Clazz.overrideMethod (c$, "getApplet", 
+function (name) {
+var applet = null;
+{
+applet = Jmol._applets[name]; applet && (applet =
+applet._applet);
+}return applet;
+}, "~S");
+Clazz.overrideMethod (c$, "getApplets", 
+function () {
+return null;
+});
+Clazz.defineMethod (c$, "showDocument", 
+function (url) {
+{
+window.open(url.toString());
+}}, "java.net.URL");
+Clazz.defineMethod (c$, "showDocument", 
+function (url, target) {
+{
+window.open(url.toString(), target);
+}}, "java.net.URL,~S");
+Clazz.defineMethod (c$, "showStatus", 
+function (status) {
+swingjs.JSToolkit.log (status);
+{
+Clazz._LoaderProgressMonitor.showStatus(status, true);
+}}, "~S");
+Clazz.overrideMethod (c$, "cacheFileByName", 
+function (fileName, isAdd) {
+return 0;
+}, "~S,~B");
+Clazz.overrideMethod (c$, "cachePut", 
+function (key, data) {
+}, "~S,~O");
+Clazz.overrideMethod (c$, "destroy", 
+function () {
+});
+Clazz.overrideMethod (c$, "getFullName", 
+function () {
+return this.fullName;
+});
+Clazz.overrideMethod (c$, "openFileAsyncSpecial", 
+function (fileName, flags) {
+}, "~S,~N");
+Clazz.defineMethod (c$, "processMouseEvent", 
+function (id, x, y, modifiers, time) {
+this.getMouse ().processEvent (id, x, y, modifiers, time);
+return false;
+}, "~N,~N,~N,~N,~N");
+Clazz.defineMethod (c$, "getMouse", 
+ function () {
+return (this.mouse == null ? this.mouse =  new swingjs.JSMouse (this) : this.mouse);
+});
+Clazz.overrideMethod (c$, "processTwoPointGesture", 
+function (touches) {
+this.getMouse ().processTwoPointGesture (touches);
+}, "~A");
+Clazz.overrideMethod (c$, "setDisplay", 
+function (canvas) {
+this.canvas = canvas;
+}, "swingjs.api.HTML5Canvas");
+Clazz.overrideMethod (c$, "setScreenDimension", 
+function (width, height) {
+this.setGraphics (this.jsgraphics = null);
+if (this.applet != null) this.applet.resize (width, height);
+}, "~N,~N");
+Clazz.overrideMethod (c$, "setStatusDragDropped", 
+function (mode, x, y, fileName) {
+return false;
+}, "~N,~N,~N,~S");
+Clazz.overrideMethod (c$, "startHoverWatcher", 
+function (enable) {
+}, "~B");
+Clazz.overrideMethod (c$, "paint", 
+function (g) {
+this.applet.paint (this.setGraphics (g));
+}, "java.awt.Graphics");
+Clazz.defineMethod (c$, "setGraphics", 
+ function (g) {
+return (g == null ? this.getGraphics () : g);
+}, "java.awt.Graphics");
+Clazz.overrideMethod (c$, "getGraphics", 
+function () {
+if (this.jsgraphics == null) {
+this.jsgraphics =  new swingjs.JSGraphics2D (this.getCanvas ());
+this.jsgraphics.setWindowParameters (this.getWidth (), this.getHeight ());
+}return this.jsgraphics;
+});
+Clazz.defineMethod (c$, "showAppletStatus", 
+ function (status) {
+this.getAppletContext ().showStatus (this.htmlName + " " + status);
+}, "~S");
+Clazz.defineMethod (c$, "showAppletException", 
+ function (t) {
+{
+this.showAppletStatus("error " + (t.getMessage ?
+t.getMessage() : t)); t.printStackTrace &&
+t.printStackTrace();
+}this.repaint ();
+}, "Throwable");
+Clazz.defineMethod (c$, "run1", 
+function (mode) {
+var ok = false;
+switch (mode) {
+case 0:
+this.currentAppletSize.width = this.defaultAppletSize.width = this.getWidth ();
+this.currentAppletSize.height = this.defaultAppletSize.height = this.getHeight ();
+this.setLayout ( new java.awt.BorderLayout ());
+this.nextStatus = 1;
+ok = true;
+break;
+case 1:
+switch (this.nextStatus) {
+case 1:
+if (this.status != 0) {
+this.showAppletStatus ("notdisposed");
+this.status = 7;
+break;
+}System.out.println ("JSAppletPanel runloader");
+this.runLoader ();
+this.nextStatus = 2;
+ok = true;
+break;
+case 2:
+if (this.status != 1 && this.status != 5) {
+this.showAppletStatus ("notloaded");
+break;
+}System.out.println ("JSAppletPanel init");
+this.setFont ( new java.awt.Font ("Dialog", 0, 12));
+this.applet.resize (this.defaultAppletSize);
+this.applet.init ();
+this.validate ();
+this.status = 2;
+this.showAppletStatus ("initialized");
+this.nextStatus = 3;
+ok = true;
+break;
+case 3:
+if (this.status != 2 && this.status != 4) {
+this.showAppletStatus ("notstarted");
+this.status = 7;
+break;
+}this.applet.getRootPane ().addNotify ();
+System.out.println ("JSAppletPanel start" + this.currentAppletSize);
+this.applet.resize (this.currentAppletSize);
+this.applet.start ();
+this.status = 3;
+this.showAppletStatus ("started");
+this.nextStatus = 35;
+ok = true;
+break;
+case 35:
+swingjs.JSToolkit.readyCallback (this.appletName, this.fullName, this.applet, this);
+break;
+case 4:
+if (this.status == 3) {
+this.status = 4;
+this.applet.setVisible (false);
+this.applet.stop ();
+this.showAppletStatus ("stopped");
+} else {
+this.showAppletStatus ("notstopped");
+this.status = 7;
+}break;
+case 5:
+if (this.status == 4 || this.status == 2) {
+this.status = 5;
+this.applet.destroy ();
+this.showAppletStatus ("destroyed");
+} else {
+this.showAppletStatus ("notdestroyed");
+this.status = 7;
+}break;
+case 75:
+if (this.status == 5 || this.status == 1) {
+this.showAppletStatus ("notdisposed");
+this.status = 7;
+} else {
+this.status = 0;
+this.removeChild (this.applet);
+this.applet = null;
+this.showAppletStatus ("disposed");
+}break;
+case 6:
+break;
+default:
+System.out.println ("unrecognized JSAppletPanel status: " + this.nextStatus);
+break;
+}
+break;
+default:
+System.out.println ("unrecognized JSAppletThread mode: " + mode);
+break;
+}
+return (ok ? 1 : 2);
+}, "~N");
+Clazz.defineMethod (c$, "runLoader", 
+ function () {
+this.dispatchAppletEvent (51235, null);
+this.status = 1;
+var code = this.getCode ();
+try {
+if (code == null) {
+System.err.println ("runloader.err-- \"code\" must be specified.");
+throw  new InstantiationException ("\"code\" must be specified.");
+}this.applet = swingjs.JSToolkit.getInstance (code);
+if (this.applet == null) {
+System.out.println (code + " could not be launched");
+this.status = 7;
+} else if (!(Clazz.instanceOf (this.applet, javax.swing.JApplet))) {
+System.out.println (code + " is not a JApplet!?");
+this.status = 7;
+}} catch (e$$) {
+if (Clazz.exceptionOf (e$$, InstantiationException)) {
+var e = e$$;
+{
+this.status = 7;
+this.showAppletException (e);
+return;
+}
+} else if (Clazz.exceptionOf (e$$, Exception)) {
+var e = e$$;
+{
+this.status = 7;
+this.showAppletException (e);
+return;
+}
+} else if (Clazz.exceptionOf (e$$, ThreadDeath)) {
+var e = e$$;
+{
+this.status = 7;
+this.showAppletStatus ("death");
+return;
+}
+} else if (Clazz.exceptionOf (e$$, Error)) {
+var e = e$$;
+{
+this.status = 7;
+this.showAppletException (e);
+return;
+}
+} else {
+throw e$$;
+}
+} finally {
+this.dispatchAppletEvent (51236, null);
+}
+if (this.applet != null) {
+this.applet.setStub (this);
+this.applet.setVisible (false);
+this.add ("Center", this.applet);
+this.applet.setDispatcher ();
+this.applet.addNotify ();
+this.showAppletStatus ("loaded");
+this.validate ();
+}});
+Clazz.defineMethod (c$, "getUI", 
+function () {
+return null;
+});
+Clazz.overrideMethod (c$, "repaintImpl", 
+function (tm, x, y, width, height) {
+if (this.applet.isVisible () && this.applet.getWidth () > 0 && this.applet.getHeight () > 0) {
+this.applet.getContentPane ().repaint (tm, x, y, width, height);
+}}, "~N,~N,~N,~N,~N");
+Clazz.defineStatics (c$,
+"APPLET_UNINITIALIZED", 0,
+"APPLET_LOAD", 1,
+"APPLET_INIT", 2,
+"APPLET_START", 3,
+"APPLET_READY", 35,
+"APPLET_STOP", 4,
+"APPLET_DESTROY", 5,
+"APPLET_QUIT", 6,
+"APPLET_ERROR", 7,
+"APPLET_DISPOSE", 75,
+"APPLET_RESIZE", 51234,
+"APPLET_LOADING", 51235,
+"APPLET_LOADING_COMPLETED", 51236);
+});