litesoft
Diff Revisions
947
vs
948
for /trunk/GWT_Sandbox/Upload/src/org/litesoft/sandbox/csapp/client/CSapp.java
|
@@ -10,25 +10,18 @@ |
10 |
10 |
|
/** |
11 |
11 |
|
* Entry point classes define <code>onModuleLoad()</code> |
12 |
12 |
|
*/ |
13 |
|
- |
public class CSapp implements EntryPoint |
14 |
|
- |
{ |
|
13 |
+ |
public class CSapp implements EntryPoint { |
15 |
14 |
|
@Override |
16 |
|
- |
public void onModuleLoad() |
17 |
|
- |
{ |
|
15 |
+ |
public void onModuleLoad() { |
18 |
16 |
|
final Button button = new Button( "Click me" ); |
19 |
17 |
|
final Label label = new Label(); |
20 |
18 |
|
|
21 |
|
- |
button.addClickHandler( new ClickHandler() |
22 |
|
- |
{ |
|
19 |
+ |
button.addClickHandler( new ClickHandler() { |
23 |
20 |
|
@Override |
24 |
|
- |
public void onClick( ClickEvent event ) |
25 |
|
- |
{ |
26 |
|
- |
if ( label.getText().equals( "" ) ) |
27 |
|
- |
{ |
|
21 |
+ |
public void onClick( ClickEvent event ) { |
|
22 |
+ |
if ( label.getText().equals( "" ) ) { |
28 |
23 |
|
CSappService.Async.INSTANCE.getMessage( "Hello, World!", new MyAsyncCallback( label ) ); |
29 |
|
- |
} |
30 |
|
- |
else |
31 |
|
- |
{ |
|
24 |
+ |
} else { |
32 |
25 |
|
label.setText( "" ); |
33 |
26 |
|
} |
34 |
27 |
|
} |
|
@@ -44,24 +37,20 @@ |
44 |
37 |
|
RootPanel.get( "slot3" ).add( new MyPanel() ); |
45 |
38 |
|
} |
46 |
39 |
|
|
47 |
|
- |
private static class MyAsyncCallback implements AsyncCallback<String> |
48 |
|
- |
{ |
|
40 |
+ |
private static class MyAsyncCallback implements AsyncCallback<String> { |
49 |
41 |
|
private Label label; |
50 |
42 |
|
|
51 |
|
- |
public MyAsyncCallback( Label label ) |
52 |
|
- |
{ |
|
43 |
+ |
public MyAsyncCallback( Label label ) { |
53 |
44 |
|
this.label = label; |
54 |
45 |
|
} |
55 |
46 |
|
|
56 |
47 |
|
@Override |
57 |
|
- |
public void onSuccess( String result ) |
58 |
|
- |
{ |
|
48 |
+ |
public void onSuccess( String result ) { |
59 |
49 |
|
label.getElement().setInnerHTML( result ); |
60 |
50 |
|
} |
61 |
51 |
|
|
62 |
52 |
|
@Override |
63 |
|
- |
public void onFailure( Throwable throwable ) |
64 |
|
- |
{ |
|
53 |
+ |
public void onFailure( Throwable throwable ) { |
65 |
54 |
|
label.setText( "Failed to receive answer from server!" ); |
66 |
55 |
|
} |
67 |
56 |
|
} |