Merge branch 'master' of https://source.jalview.org/git/jalviewjs.git
[jalviewjs.git] / site / j2s / java / applet / Applet.js
1 Clazz.declarePackage ("java.applet");
2 Clazz.load (["java.awt.Panel"], "java.applet.Applet", ["java.net.URL", "java.util.Locale"], function () {
3 c$ = Clazz.decorateAsClass (function () {
4 this.stub = null;
5 Clazz.instantialize (this, arguments);
6 }, java.applet, "Applet", java.awt.Panel);
7 Clazz.makeConstructor (c$, 
8 function () {
9 Clazz.superConstructor (this, java.applet.Applet, []);
10 this.setPanel ();
11 });
12 Clazz.defineMethod (c$, "setStub", 
13 function (stub) {
14 this.stub = stub;
15 }, "java.applet.AppletStub");
16 Clazz.defineMethod (c$, "isActive", 
17 function () {
18 if (this.stub != null) {
19 return this.stub.isActive ();
20 } else {
21 return false;
22 }});
23 Clazz.defineMethod (c$, "getDocumentBase", 
24 function () {
25 return this.stub.getDocumentBase ();
26 });
27 Clazz.defineMethod (c$, "getCodeBase", 
28 function () {
29 return this.stub.getCodeBase ();
30 });
31 Clazz.defineMethod (c$, "getParameter", 
32 function (name) {
33 return this.stub.getParameter (name);
34 }, "~S");
35 Clazz.defineMethod (c$, "getAppletContext", 
36 function () {
37 return this.stub.getAppletContext ();
38 });
39 Clazz.defineMethod (c$, "resize", 
40 function (width, height) {
41 var d = this.size ();
42 if ((d.width != width) || (d.height != height)) {
43 Clazz.superCall (this, java.applet.Applet, "resize", [width, height]);
44 if (this.stub != null) {
45 this.stub.appletResize (width, height);
46 }}}, "~N,~N");
47 Clazz.defineMethod (c$, "resize", 
48 function (d) {
49 this.resize (d.width, d.height);
50 }, "java.awt.Dimension");
51 Clazz.defineMethod (c$, "showStatus", 
52 function (msg) {
53 this.getAppletContext ().showStatus (msg);
54 }, "~S");
55 Clazz.defineMethod (c$, "getImage", 
56 function (url) {
57 return this.getAppletContext ().getImage (url);
58 }, "java.net.URL");
59 Clazz.defineMethod (c$, "getImage", 
60 function (url, name) {
61 try {
62 return this.getImage ( new java.net.URL (url, name));
63 } catch (e) {
64 if (Clazz.exceptionOf (e, java.net.MalformedURLException)) {
65 return null;
66 } else {
67 throw e;
68 }
69 }
70 }, "java.net.URL,~S");
71 Clazz.defineMethod (c$, "getAppletInfo", 
72 function () {
73 return null;
74 });
75 Clazz.defineMethod (c$, "getLocale", 
76 function () {
77 var locale = Clazz.superCall (this, java.applet.Applet, "getLocale", []);
78 if (locale == null) {
79 return java.util.Locale.getDefault ();
80 }return locale;
81 });
82 Clazz.defineMethod (c$, "getParameterInfo", 
83 function () {
84 return null;
85 });
86 Clazz.defineMethod (c$, "init", 
87 function () {
88 });
89 Clazz.defineMethod (c$, "start", 
90 function () {
91 });
92 Clazz.defineMethod (c$, "stop", 
93 function () {
94 });
95 Clazz.defineMethod (c$, "destroy", 
96 function () {
97 });
98 });