File tree Expand file tree Collapse file tree 12 files changed +52
-31
lines changed Expand file tree Collapse file tree 12 files changed +52
-31
lines changed Original file line number Diff line number Diff line change 20
20
* A callback object is provided for action to be executed after the class is
21
21
* loaded.
22
22
*
23
- * @author josson smith
23
+ * @author zhou renjian
24
24
*
25
25
* 2006-8-4
26
26
*/
Original file line number Diff line number Diff line change 18
18
* give convenience for <code>AClass</code> or <code>ASWTClass</code>
19
19
* to set and to get the class that is loaded.
20
20
*
21
- * @author josson smith
21
+ * @author zhou renjian
22
22
*
23
23
* 2006-8-4
24
24
*/
Original file line number Diff line number Diff line change 38
38
* This class can be considered as a bridge of Java's AJAX programming and
39
39
* JavaScript/Browser's AJAX programming.
40
40
*
41
- * @author josson smith
41
+ * @author zhou renjian
42
42
*
43
43
* 2006-2-11
44
44
*/
Original file line number Diff line number Diff line change 30
30
* 4 Loaded<br>
31
31
* The data transfer has been completed.<br>
32
32
*
33
- * @author josson smith
33
+ * @author zhou renjian
34
34
*
35
35
* 2006-2-11
36
36
*/
Original file line number Diff line number Diff line change 16
16
/**
17
17
* This adapter provides a default implementation of IXHRCallback.
18
18
*
19
- * @author josson smith
19
+ * @author zhou renjian
20
20
*
21
21
* 2006-2-11
22
22
*/
Original file line number Diff line number Diff line change 17
17
import java .net .URLEncoder ;
18
18
19
19
/**
20
- * @author josson smith
20
+ * @author zhou renjian
21
21
*
22
22
* 2006-10-10
23
23
*/
@@ -47,10 +47,21 @@ public static void switchToLocalJavaThreadMode() {
47
47
* runnable.ajaxIn ();
48
48
* net.sf.j2s.ajax.SimpleRPCRequest.ajaxRequest (runnable);
49
49
*/
50
- public static void request (SimpleRPCRunnable runnable ) {
50
+ public static void request (final SimpleRPCRunnable runnable ) {
51
51
runnable .ajaxIn ();
52
52
if (runningMode == MODE_LOCAL_JAVA_THREAD ) {
53
- new Thread (runnable ).start ();
53
+ new Thread (new Runnable () {
54
+ public void run () {
55
+ try {
56
+ runnable .ajaxRun ();
57
+ } catch (RuntimeException e ) {
58
+ e .printStackTrace (); // should never fail in Java thread mode!
59
+ runnable .ajaxFail ();
60
+ return ;
61
+ }
62
+ runnable .ajaxOut ();
63
+ }
64
+ }).start ();
54
65
} else {
55
66
ajaxRequest (runnable );
56
67
}
Original file line number Diff line number Diff line change 19
19
*
20
20
* 2006-10-10
21
21
*/
22
- public abstract class SimpleRPCRunnable extends SimpleSerializable implements Runnable {
22
+ public abstract class SimpleRPCRunnable extends SimpleSerializable {
23
23
24
24
public String getHttpURL () {
25
25
return "simplerpc" ; // url is relative to the servlet!
@@ -51,19 +51,4 @@ public String getHttpMethod() {
51
51
*/
52
52
public void ajaxFail () {};
53
53
54
- /**
55
- * @j2sNative
56
- * net.sf.j2s.ajax.ServletThread.call(this);
57
- */
58
- public void run () {
59
- // ajaxIn(); // ajaxIn should be run outside of #run directly
60
- try {
61
- ajaxRun ();
62
- } catch (RuntimeException e ) {
63
- e .printStackTrace (); // should never fail in Java thread mode!
64
- ajaxFail ();
65
- return ;
66
- }
67
- ajaxOut ();
68
- }
69
54
}
Original file line number Diff line number Diff line change 18
18
import org .eclipse .swt .widgets .Display ;
19
19
20
20
/**
21
- * @author josson smith
21
+ * @author zhou renjian
22
22
*
23
23
* 2006-10-10
24
24
*/
@@ -29,10 +29,35 @@ public class SimpleRPCSWTRequest extends SimpleRPCRequest {
29
29
* runnable.ajaxIn ();
30
30
* net.sf.j2s.ajax.SimpleRPCRequest.ajaxRequest (runnable);
31
31
*/
32
- public static void swtRequest (SimpleRPCRunnable runnable ) {
32
+ public static void swtRequest (final SimpleRPCRunnable runnable ) {
33
33
runnable .ajaxIn ();
34
34
if (runningMode == MODE_LOCAL_JAVA_THREAD ) {
35
- Display .getDefault ().asyncExec (runnable );
35
+ new Thread (new Runnable (){
36
+ public void run () {
37
+ try {
38
+ runnable .ajaxRun ();
39
+ } catch (RuntimeException e ) {
40
+ e .printStackTrace (); // should never fail in Java thread mode!
41
+ Display disp = Display .getDefault ();
42
+ if (disp != null ) {
43
+ disp .syncExec (new Runnable () {
44
+ public void run () {
45
+ runnable .ajaxFail ();
46
+ }
47
+ });
48
+ }
49
+ return ;
50
+ }
51
+ Display disp = Display .getDefault ();
52
+ if (disp != null ) {
53
+ disp .syncExec (new Runnable () {
54
+ public void run () {
55
+ runnable .ajaxOut ();
56
+ }
57
+ });
58
+ }
59
+ }
60
+ }).start ();
36
61
} else {
37
62
swtAJAXRequest (runnable );
38
63
}
Original file line number Diff line number Diff line change 22
22
import java .util .Set ;
23
23
24
24
/**
25
- * @author josson smith
25
+ * @author zhou renjian
26
26
*
27
27
* 2006-10-11
28
28
*/
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ public void run() {
33
33
* parameter as <code>AClass#load</code>. Or call <code>ASWTClass#shellLoad</code>
34
34
* or <code>ASWTClass#displayLoad</code> with extra Shell/Display argument.
35
35
*
36
- * @author josson smith
36
+ * @author zhou renjian
37
37
*
38
38
* 2006-8-4
39
39
*/
You can’t perform that action at this time.
0 commit comments