litesoft
Diff Revisions
588
vs
589
for /trunk/GWT_Sandbox/CS_IDEA/src/org/litesoft/sandbox/csapp/client/CSapp.java
|
@@ -1,5 +1,6 @@ |
1 |
1 |
|
package org.litesoft.sandbox.csapp.client; |
2 |
2 |
|
|
|
3 |
+ |
import org.litesoft.sandbox.csapp.client.dtos.*; |
3 |
4 |
|
import org.litesoft.sandbox.csapp.client.widgets.*; |
4 |
5 |
|
|
5 |
6 |
|
import com.google.gwt.core.client.*; |
|
@@ -12,6 +13,10 @@ |
12 |
13 |
|
*/ |
13 |
14 |
|
public class CSapp implements EntryPoint |
14 |
15 |
|
{ |
|
16 |
+ |
final CSappServiceAsync mService = GWT.create( CSappService.class ); |
|
17 |
+ |
|
|
18 |
+ |
private int mCalls; |
|
19 |
+ |
|
15 |
20 |
|
@Override |
16 |
21 |
|
public void onModuleLoad() |
17 |
22 |
|
{ |
|
@@ -25,7 +30,14 @@ |
25 |
30 |
|
{ |
26 |
31 |
|
if ( label.getText().equals( "" ) ) |
27 |
32 |
|
{ |
28 |
|
- |
CSappService.Async.INSTANCE.getMessage( "Hello, World!", new MyAsyncCallback( label ) ); |
|
33 |
+ |
if ( (++mCalls & 1) == 1 ) |
|
34 |
+ |
{ |
|
35 |
+ |
mService.getMessage( new Request1( "1-1", "1-2" ), new MyAsyncCallback<Response1>( label ) ); |
|
36 |
+ |
} |
|
37 |
+ |
else |
|
38 |
+ |
{ |
|
39 |
+ |
mService.getMessage( new Request2( "2-1", "2-2" ), new MyAsyncCallback<Response2>( label ) ); |
|
40 |
+ |
} |
29 |
41 |
|
} |
30 |
42 |
|
else |
31 |
43 |
|
{ |
|
@@ -44,7 +56,7 @@ |
44 |
56 |
|
RootPanel.get( "slot3" ).add( new MyPanel() ); |
45 |
57 |
|
} |
46 |
58 |
|
|
47 |
|
- |
private static class MyAsyncCallback implements AsyncCallback<String> |
|
59 |
+ |
private static class MyAsyncCallback<T> implements AsyncCallback<T> |
48 |
60 |
|
{ |
49 |
61 |
|
private Label label; |
50 |
62 |
|
|
|
@@ -54,9 +66,9 @@ |
54 |
66 |
|
} |
55 |
67 |
|
|
56 |
68 |
|
@Override |
57 |
|
- |
public void onSuccess( String result ) |
|
69 |
+ |
public void onSuccess( T result ) |
58 |
70 |
|
{ |
59 |
|
- |
label.getElement().setInnerHTML( result ); |
|
71 |
+ |
label.getElement().setInnerHTML( result.toString() ); |
60 |
72 |
|
} |
61 |
73 |
|
|
62 |
74 |
|
@Override |