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