JAL-1807 Bob's JalviewJS prototype first commit
[jalviewjs.git] / site / j2s / java / awt / event / InvocationEvent.js
1 Clazz.declarePackage ("java.awt.event");\r
2 Clazz.load (["java.awt.AWTEvent", "$.ActiveEvent"], "java.awt.event.InvocationEvent", ["java.lang.Exception"], function () {\r
3 c$ = Clazz.decorateAsClass (function () {\r
4 this.runnable = null;\r
5 this.notifier = null;\r
6 this.catchExceptions = false;\r
7 this.exception = null;\r
8 this.throwable = null;\r
9 this.when = 0;\r
10 Clazz.instantialize (this, arguments);\r
11 }, java.awt.event, "InvocationEvent", java.awt.AWTEvent, java.awt.ActiveEvent);\r
12 Clazz.makeConstructor (c$, \r
13 function (source, runnable) {\r
14 this.construct (source, runnable, null, false);\r
15 }, "~O,Runnable");\r
16 Clazz.makeConstructor (c$, \r
17 function (source, runnable, notifier, catchThrowables) {\r
18 this.construct (source, 1200, runnable, notifier, catchThrowables);\r
19 }, "~O,Runnable,~O,~B");\r
20 Clazz.makeConstructor (c$, \r
21 function (source, id, runnable, notifier, catchThrowables) {\r
22 Clazz.superConstructor (this, java.awt.event.InvocationEvent, [source, id]);\r
23 this.runnable = runnable;\r
24 this.notifier = notifier;\r
25 this.catchExceptions = catchThrowables;\r
26 this.when = System.currentTimeMillis ();\r
27 }, "~O,~N,Runnable,~O,~B");\r
28 Clazz.overrideMethod (c$, "dispatch", \r
29 function () {\r
30 if (this.catchExceptions) {\r
31 try {\r
32 this.runnable.run ();\r
33 } catch (t) {\r
34 if (Clazz.instanceOf (t, Exception)) {\r
35 this.exception = t;\r
36 }this.throwable = t;\r
37 }\r
38 } else {\r
39 this.runnable.run ();\r
40 }if (this.notifier != null) {\r
41 {\r
42 this.notifier.notifyAll ();\r
43 }}});\r
44 Clazz.defineMethod (c$, "getException", \r
45 function () {\r
46 return (this.catchExceptions) ? this.exception : null;\r
47 });\r
48 Clazz.defineMethod (c$, "getThrowable", \r
49 function () {\r
50 return (this.catchExceptions) ? this.throwable : null;\r
51 });\r
52 Clazz.defineMethod (c$, "getWhen", \r
53 function () {\r
54 return this.when;\r
55 });\r
56 Clazz.overrideMethod (c$, "paramString", \r
57 function () {\r
58 var typeStr;\r
59 switch (this.id) {\r
60 case 1200:\r
61 typeStr = "INVOCATION_DEFAULT";\r
62 break;\r
63 default:\r
64 typeStr = "unknown type";\r
65 }\r
66 return typeStr + ",runnable=" + this.runnable + ",notifier=" + this.notifier + ",catchExceptions=" + this.catchExceptions + ",when=" + this.when;\r
67 });\r
68 Clazz.defineStatics (c$,\r
69 "SWINGJS_INVOCATION_LOW", 1201,\r
70 "INVOCATION_FIRST", 1200,\r
71 "INVOCATION_DEFAULT", 1200,\r
72 "INVOCATION_LAST", 1201);\r
73 });\r