|
@@ -3,50 +3,54 @@ |
3 |
3 |
|
import com.google.gwt.core.client.*; |
4 |
4 |
|
import com.google.gwt.event.dom.client.*; |
5 |
5 |
|
import com.google.gwt.user.client.ui.*; |
6 |
|
- |
import com.temp.foundation.widgets.ActiveTextBox; |
|
6 |
+ |
import com.temp.foundation.widgets.*; |
|
7 |
+ |
import com.temp.foundation.widgets.support.*; |
7 |
8 |
|
|
8 |
|
- |
public class SampleApplication implements EntryPoint |
9 |
|
- |
{ |
10 |
|
- |
public void onModuleLoad() |
11 |
|
- |
{ |
12 |
|
- |
Button button = new Button( "Click me" ); |
13 |
|
- |
Label fieldLabel = new Label( "Name:" ); |
14 |
|
- |
Label errorLabel = new Label( "Error" ); |
15 |
|
- |
HTML stateLabel = new HTML( " " ); |
16 |
|
- |
TextBox field = new ActiveTextBox(); |
17 |
|
- |
field.addChangeHandler(new ChangeHandler() { |
|
9 |
+ |
public class SampleApplication implements EntryPoint { |
|
10 |
+ |
public void onModuleLoad() { |
|
11 |
+ |
Button button = new Button("Click me"); |
|
12 |
+ |
Label fieldLabel = new Label("Name:"); |
|
13 |
+ |
Label errorLabel = new Label("Error"); |
|
14 |
+ |
HTML stateLabel = new HTML(" "); |
|
15 |
+ |
ActiveTextBox field = new ActiveTextBox(); |
|
16 |
+ |
|
|
17 |
+ |
final InputWidgetChangeFilter<String> input = new InputWidgetChangeFilter<String>(new TextBoxBaseValueAdapter(field)); |
|
18 |
+ |
input.addChangeHandler(new ChangeHandler() { |
18 |
19 |
|
@Override |
19 |
20 |
|
public void onChange(ChangeEvent event) { |
20 |
|
- |
System.out.println( "Changed!" ); |
|
21 |
+ |
String value = input.getValue(); |
|
22 |
+ |
System.out.println("Change: " + input.isChanged() + " '" + value + "'"); |
|
23 |
+ |
if ("OK".equals(value)) { |
|
24 |
+ |
input.setValue(value); |
|
25 |
+ |
} |
21 |
26 |
|
} |
22 |
27 |
|
}); |
23 |
28 |
|
|
24 |
|
- |
button.addClickHandler( new ClickHandler() |
25 |
|
- |
{ |
26 |
|
- |
public void onClick( ClickEvent event ) |
27 |
|
- |
{ |
28 |
|
- |
System.out.println( "Clicked!" ); |
|
29 |
+ |
button.addClickHandler(new ClickHandler() { |
|
30 |
+ |
public void onClick(ClickEvent event) { |
|
31 |
+ |
input.setValue(input.getValue() + "!"); |
|
32 |
+ |
System.out.println("Clicked!"); |
29 |
33 |
|
} |
30 |
|
- |
} ); |
|
34 |
+ |
}); |
31 |
35 |
|
|
32 |
36 |
|
VerticalPanel zVPanel = new VerticalPanel(); |
33 |
|
- |
zVPanel.add( field ); |
34 |
|
- |
zVPanel.add( errorLabel ); |
|
37 |
+ |
zVPanel.add(field); |
|
38 |
+ |
zVPanel.add(errorLabel); |
35 |
39 |
|
|
36 |
40 |
|
HorizontalPanel zHPanel = new HorizontalPanel(); |
37 |
|
- |
zHPanel.add( fieldLabel ); |
38 |
|
- |
zHPanel.add( new HTML( " " ) ); |
39 |
|
- |
zHPanel.add( zVPanel ); |
40 |
|
- |
zHPanel.add( new HTML( " " ) ); |
41 |
|
- |
zHPanel.add( stateLabel ); |
|
41 |
+ |
zHPanel.add(fieldLabel); |
|
42 |
+ |
zHPanel.add(new HTML(" ")); |
|
43 |
+ |
zHPanel.add(zVPanel); |
|
44 |
+ |
zHPanel.add(new HTML(" ")); |
|
45 |
+ |
zHPanel.add(stateLabel); |
42 |
46 |
|
|
43 |
47 |
|
zVPanel = new VerticalPanel(); |
44 |
|
- |
zVPanel.add( new HTML( " " ) ); |
45 |
|
- |
zVPanel.add( zHPanel ); |
46 |
|
- |
zVPanel.add( new HTML( " " ) ); |
47 |
|
- |
zVPanel.add( button ); |
|
48 |
+ |
zVPanel.add(new HTML(" ")); |
|
49 |
+ |
zVPanel.add(zHPanel); |
|
50 |
+ |
zVPanel.add(new HTML(" ")); |
|
51 |
+ |
zVPanel.add(button); |
48 |
52 |
|
|
49 |
|
- |
RootPanel zRootPanel = RootPanel.get( "centeredWidget" ); |
50 |
|
- |
zRootPanel.add( zVPanel ); |
|
53 |
+ |
RootPanel zRootPanel = RootPanel.get("centeredWidget"); |
|
54 |
+ |
zRootPanel.add(zVPanel); |
51 |
55 |
|
} |
52 |
56 |
|
} |