JAL-1807 Bob
[jalviewjs.git] / site / j2s / swingjs / JSThread.js
1 Clazz.declarePackage ("swingjs");
2 Clazz.load (["java.lang.Thread", "swingjs.api.JSFunction"], "swingjs.JSThread", null, function () {
3 c$ = Clazz.decorateAsClass (function () {
4 this.isJS = false;
5 Clazz.instantialize (this, arguments);
6 }, swingjs, "JSThread", Thread, swingjs.api.JSFunction);
7 Clazz.makeConstructor (c$, 
8 function (group, name) {
9 Clazz.superConstructor (this, swingjs.JSThread, [group, name]);
10 {
11 this.isJS = true;
12 }}, "ThreadGroup,~S");
13 Clazz.overrideMethod (c$, "run", 
14 function () {
15 this.run1 (0);
16 });
17 Clazz.defineMethod (c$, "start", 
18 function () {
19 {
20 swingjs.JSToolkit.setTimeout(this, 1, 0);
21 }});
22 Clazz.defineMethod (c$, "sleepAndReturn", 
23 function (delay, state) {
24 if (!this.isJS) {
25 Thread.sleep (delay);
26 return false;
27 }var me = this;
28 var r = ((Clazz.isClassDefined ("swingjs.JSThread$1") ? 0 : swingjs.JSThread.$JSThread$1$ ()), Clazz.innerTypeInstance (swingjs.JSThread$1, this, Clazz.cloneFinals ("me", me, "state", state)));
29 {
30 setTimeout(
31 function() {java.awt.Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(new java.awt.event.InvocationEvent(me, r))},
32 delay
33 );
34 }return true;
35 }, "~N,~N");
36 c$.$JSThread$1$ = function () {
37 Clazz.pu$h(self.c$);
38 c$ = Clazz.declareAnonymous (swingjs, "JSThread$1", null, Runnable);
39 Clazz.overrideMethod (c$, "run", 
40 function () {
41 this.f$.me.run1 (this.f$.state);
42 });
43 c$ = Clazz.p0p ();
44 };
45 Clazz.defineStatics (c$,
46 "INIT", 0,
47 "LOOP", 1,
48 "DONE", 2);
49 });