|
@@ -7,18 +7,15 @@ |
7 |
7 |
|
import org.litesoft.GWT.client.widgets.*; |
8 |
8 |
|
import org.litesoft.GWT.forms.client.components.*; |
9 |
9 |
|
import org.litesoft.GWT.forms.client.components.impls.input.*; |
10 |
|
- |
import org.litesoft.core.simpletypes.*; |
11 |
10 |
|
import org.litesoft.core.simpletypes.temporal.*; |
12 |
11 |
|
import org.litesoft.core.util.*; |
13 |
12 |
|
|
14 |
13 |
|
import com.google.gwt.event.dom.client.*; |
15 |
|
- |
import com.google.gwt.i18n.client.*; |
16 |
14 |
|
import com.google.gwt.user.client.ui.*; |
17 |
|
- |
import com.google.gwt.user.datepicker.client.*; |
18 |
15 |
|
|
19 |
16 |
|
public class PersonalInfoForm extends SizeableVerticalPanel |
20 |
17 |
|
{ |
21 |
|
- |
private static final ResourceKeyNameURL ERROR_RESOURCE = new ResourceKeyNameURL( "VW2", "Volkswagen2", "common/images/misc/tmp/vw.jpg" ); |
|
18 |
+ |
// private static final ResourceKeyNameURL ERROR_RESOURCE = new ResourceKeyNameURL( "VW2", "Volkswagen2", "common/images/misc/tmp/vw.jpg" ); |
22 |
19 |
|
|
23 |
20 |
|
private final List<Enableable> mFormComponents = new ArrayList<Enableable>(); |
24 |
21 |
|
private Button mEnable, mDisable, mDialog; |
|
@@ -27,94 +24,80 @@ |
27 |
24 |
|
{ |
28 |
25 |
|
stretchable(); |
29 |
26 |
|
|
30 |
|
- |
FormSuggestBox zSuggest = new FormSuggestBox( "Suggestions", null, "Type to filter content", null, null, createSuggestions() ); |
31 |
|
- |
zSuggest.addFormComponentListener( new MyListener( "ERROR" ) ); |
32 |
|
- |
|
33 |
|
- |
add( zSuggest ); |
34 |
|
- |
|
35 |
|
- |
// DOM.setStyleAttribute( getElement(), "backgroundColor", "#00D000" ); |
36 |
|
- |
String[] zRadioGroupOptions = new String[]{"Option One", "Option Two is a really long, long option", "Option Three",}; |
37 |
|
- |
|
38 |
|
- |
// final FormTextField zTFfc = new FormTextField( "First Name", null, "My New Tooltip", null, null ).setListener( new MyListener( "ERROR" ) ); |
39 |
|
- |
|
40 |
|
- |
FormTextField zTFfc = new FormTextField( "First Name", null, "My New Tooltip", null, null ); |
41 |
|
- |
zTFfc.addFormComponentListener( new MyListener( "ERROR" ) ); |
42 |
|
- |
|
43 |
|
- |
FormPasswordField zPFfc = new FormPasswordField( "Password", null, "A Tooltip 4 Password Field", null, null ); |
44 |
|
- |
zPFfc.addFormComponentListener( new MyListener( "ERROR" ) ); |
45 |
|
- |
|
46 |
|
- |
add( zTFfc ); |
47 |
|
- |
add( zPFfc ); |
48 |
|
- |
|
49 |
|
- |
// final FormRightAlignTextField zTFnumeric = new FormRightAlignTextField( "Security Code", null, "My New Tooltip", null, null ); |
50 |
|
- |
// final MyListener zTFnumericListener = new MyListener( zTFnumeric, "999" ); |
51 |
|
- |
// zTFnumeric.addFormComponentListener( zTFnumericListener ); |
52 |
|
- |
// add( zTFnumeric ); |
53 |
|
- |
|
54 |
|
- |
SizeableBorderedHorizontalSplitPairPanel zHSP = new SizeableBorderedHorizontalSplitPairPanel().stretchable(); |
55 |
|
- |
add( zHSP ); |
|
27 |
+ |
HorizontalPanel zHPanel; |
56 |
28 |
|
|
|
29 |
+ |
// TODO: Errors on FormTextArea!!! |
57 |
30 |
|
FormTextarea zFrmTA = new FormTextarea( "Comments are really long", null, "My New Tooltip", false, null, false, null, false ); |
58 |
31 |
|
zFrmTA.addFormComponentListener( new MyListener( "ERROR" ) ); |
59 |
|
- |
zHSP.add( zFrmTA ); |
60 |
|
- |
|
61 |
|
- |
SizeableBorderedHorizontalSplitPairPanel zHSP2 = new SizeableBorderedHorizontalSplitPairPanel().stretchable(); |
62 |
|
- |
zHSP.add( zHSP2 ); |
63 |
|
- |
zHSP2.add( createCurrentTasks() ); |
64 |
|
- |
zHSP2.add( createTree() ); |
65 |
|
- |
|
66 |
|
- |
HorizontalPanel zHPanel = new HorizontalPanel(); |
67 |
|
- |
add( zHPanel ); |
68 |
|
- |
|
69 |
|
- |
FormRadioGroup zRGfc = new FormRadioGroup( "Group Uno", null, "Radio Tooltip", // |
70 |
|
- |
zRadioGroupOptions ); |
71 |
|
- |
zRGfc.addFormComponentListener( new MyListener( "N/A" ) ); |
72 |
|
- |
zHPanel.add( zRGfc ); |
73 |
|
- |
|
74 |
|
- |
zHPanel.add( new Spacer( 10 ) ); |
75 |
|
- |
|
76 |
|
- |
zHPanel.add( new DatePicker() ); |
|
32 |
+ |
add( zFrmTA ); |
77 |
33 |
|
|
78 |
34 |
|
add( zHPanel = new HorizontalPanel() ); |
79 |
35 |
|
|
80 |
|
- |
FormTimestampPicker zTimestampPicker = new FormTimestampPicker( "Timestamp", null, "My New Tooltip", TimeRes.ToMIN, "Cancel", "OK" ); |
81 |
|
- |
zTimestampPicker.addFormComponentListener( new MyListener( new SimpleTimestamp( 1960, 1, 2, 3, 4 ) ) ); |
82 |
|
- |
zHPanel.add( zTimestampPicker ); |
83 |
|
- |
|
84 |
|
- |
FormDatePicker zCalendar = new FormDatePicker( "Calendar", null, "Pick-a-Date", "Cancel", "Today", new DateFormatControl( DateFormatControl.DEFAULT_DATE_FORMAT ) ); |
85 |
|
- |
zCalendar.addFormComponentListener( new MyListener( new SimpleDate( 1957, 1, 4 ) ) ); |
86 |
|
- |
zHPanel.add( zCalendar ); |
|
36 |
+ |
// TODO: Suspected Incubator Errors on FormTimestampPicker!!! |
|
37 |
+ |
// FormTimestampPicker zTimestampPicker = new FormTimestampPicker( "Timestamp", null, "My New Tooltip", TimeRes.ToMIN, "Cancel", "OK" ); |
|
38 |
+ |
// zTimestampPicker.addFormComponentListener( new MyListener( new SimpleTimestamp( 1960, 1, 2, 3, 4 ) ) ); |
|
39 |
+ |
// zHPanel.add( zTimestampPicker ); |
|
40 |
+ |
|
|
41 |
+ |
// TODO: Suspected Incubator Errors on FormDatePicker!!! |
|
42 |
+ |
// FormDatePicker zCalendar = new FormDatePicker( "Calendar", null, "Pick-a-Date", "Cancel", "Today", new DateFormatControl( DateFormatControl.DEFAULT_DATE_FORMAT ) ); |
|
43 |
+ |
// zCalendar.addFormComponentListener( new MyListener( new SimpleDate( 1957, 1, 4 ) ) ); |
|
44 |
+ |
// zHPanel.add( zCalendar ); |
87 |
45 |
|
|
88 |
46 |
|
FormTimePicker zTime = new FormTimePicker( "Time", null, "Pick-a-Time", TimeRes.ToMIN, "Cancel", "OK" ); |
89 |
47 |
|
zTime.addFormComponentListener( new MyListener( new SimpleTime( 1, 2 ) ) ); |
90 |
48 |
|
zHPanel.add( zTime ); |
91 |
49 |
|
|
92 |
|
- |
FormComboBox zOptions = new FormComboBox( "Colors *", null, "Pick-a-color", "Red" ); |
93 |
|
- |
zOptions.addFormComponentListener( new MyListener( "-Select-" ) ); |
94 |
|
- |
zOptions.addItems( "-Select-", // |
95 |
|
- |
"Red", // |
96 |
|
- |
"Green", // |
97 |
|
- |
"Blue" ); |
98 |
|
- |
zHPanel.add( zOptions ); |
99 |
|
- |
|
100 |
|
- |
// final FormSuggestBox zSuggest3 = new FormSuggestBox( "Suggestions", null, "Type to filter content", null, null, mSuggestions ); |
101 |
|
- |
// add(zSuggest3); |
102 |
|
- |
|
103 |
|
- |
FormCheckBox zCheck = new FormCheckBox( "Option1", null, "Options Tooltip", false ); |
104 |
|
- |
zCheck.addFormComponentListener( new MyListener( null ) ); |
105 |
|
- |
add( zCheck ); |
106 |
|
- |
|
107 |
50 |
|
// FormComboBox zOptions = new FormComboBox( "Colors *", null, "Pick-a-color", "Red" ); |
108 |
51 |
|
// zOptions.addFormComponentListener( new MyListener( "-Select-" ) ); |
109 |
|
- |
// zOptions.addItems( new String[] // |
110 |
|
- |
// { // |
111 |
|
- |
// "-Select-", // |
112 |
|
- |
// "Red", // |
113 |
|
- |
// "Green", // |
114 |
|
- |
// "Blue", // |
115 |
|
- |
// } ); |
116 |
|
- |
// add( zOptions ); |
117 |
|
- |
|
|
52 |
+ |
// zOptions.addItems( "-Select-", // |
|
53 |
+ |
// "Red", // |
|
54 |
+ |
// "Green", // |
|
55 |
+ |
// "Blue" ); |
|
56 |
+ |
// zHPanel.add( zOptions ); |
|
57 |
+ |
// |
|
58 |
+ |
// add( zHPanel = new HorizontalPanel() ); |
|
59 |
+ |
// |
|
60 |
+ |
// FormSuggestBox zSuggest = new FormSuggestBox( "Suggestions", null, "Type to filter content", null, null, createSuggestions() ); |
|
61 |
+ |
// zSuggest.addFormComponentListener( new MyListener( "ERROR" ) ); |
|
62 |
+ |
// |
|
63 |
+ |
// String[] zRadioGroupOptions = new String[]{"Option One", "Option Two is a really long, long option", "Option Three",}; |
|
64 |
+ |
// |
|
65 |
+ |
// FormTextField zTFfc = new FormTextField( "First Name", null, "My New Tooltip", null, null ); |
|
66 |
+ |
// zTFfc.addFormComponentListener( new MyListener( "ERROR" ) ); |
|
67 |
+ |
// |
|
68 |
+ |
// FormPasswordField zPFfc = new FormPasswordField( "Password", null, "A Tooltip 4 Password Field", null, null ); |
|
69 |
+ |
// zPFfc.addFormComponentListener( new MyListener( "ERROR" ) ); |
|
70 |
+ |
// |
|
71 |
+ |
// final FormRightAlignTextField zTFnumeric = new FormRightAlignTextField( "Security Code", null, "My New Tooltip", null, null ); |
|
72 |
+ |
// zTFnumeric.addFormComponentListener( new MyListener( "999" ) ); |
|
73 |
+ |
// |
|
74 |
+ |
// zHPanel.add( zSuggest ); |
|
75 |
+ |
// zHPanel.add( new Spacer( 10 ) ); |
|
76 |
+ |
// zHPanel.add( zTFfc ); |
|
77 |
+ |
// zHPanel.add( new Spacer( 10 ) ); |
|
78 |
+ |
// zHPanel.add( zPFfc ); |
|
79 |
+ |
// zHPanel.add( new Spacer( 10 ) ); |
|
80 |
+ |
// zHPanel.add( zTFnumeric ); |
|
81 |
+ |
// |
|
82 |
+ |
// FormRadioGroup zRGfc = new FormRadioGroup( "Group Uno", null, "Radio Tooltip", zRadioGroupOptions ); |
|
83 |
+ |
// zRGfc.addFormComponentListener( new MyListener( "N/A" ) ); |
|
84 |
+ |
// add( zRGfc ); |
|
85 |
+ |
// |
|
86 |
+ |
// FormCheckBox zCheck = new FormCheckBox( "Option1", null, "Options Tooltip", false ); |
|
87 |
+ |
// zCheck.addFormComponentListener( new MyListener( null ) ); |
|
88 |
+ |
// add( zCheck ); |
|
89 |
+ |
// |
|
90 |
+ |
// SizeableBorderedHorizontalSplitPairPanel zHSP2 = new SizeableBorderedHorizontalSplitPairPanel().stretchable(); |
|
91 |
+ |
// zHSP2.add( createCurrentTasks() ); |
|
92 |
+ |
// zHSP2.add( createTree() ); |
|
93 |
+ |
// add( zHSP2 ); |
|
94 |
+ |
// |
|
95 |
+ |
//// SizeableHorizontalSplitPairPanel zHSP = new SizeableHorizontalSplitPairPanel().stretchable(); |
|
96 |
+ |
//// add( zHSP ); |
|
97 |
+ |
//// |
|
98 |
+ |
//// zHSP.add( zFrmTA ); |
|
99 |
+ |
//// zHSP.add( zHSP2 ); |
|
100 |
+ |
// |
118 |
101 |
|
collectEnableables( mFormComponents, this ); |
119 |
102 |
|
|
120 |
103 |
|
SizeableHorizontalPanel hBtnPanel = new SizeableHorizontalPanel().stretchableHorizontally(); |
|
@@ -128,7 +111,6 @@ |
128 |
111 |
|
} ).create() ); |
129 |
112 |
|
mEnable.disable(); |
130 |
113 |
|
|
131 |
|
- |
// new RedButton( "Set Disabled", |
132 |
114 |
|
hBtnPanel.add( mDisable = Button.named( "Disable" ).red().text().add( new ClickHandler() |
133 |
115 |
|
{ |
134 |
116 |
|
@Override |
|
@@ -147,43 +129,6 @@ |
147 |
129 |
|
} |
148 |
130 |
|
} ).create() ); |
149 |
131 |
|
add( hBtnPanel ); |
150 |
|
- |
|
151 |
|
- |
add( new Spacer( 3 ) ); |
152 |
|
- |
|
153 |
|
- |
// final OurSuggestBox zSuggest2 = new OurSuggestBox( zOracle ); |
154 |
|
- |
// zSuggest2.addFocusListener( new FocusListener() |
155 |
|
- |
// { |
156 |
|
- |
// @Override |
157 |
|
- |
// public void onFocus( Widget sender ) |
158 |
|
- |
// { |
159 |
|
- |
// if ( !zSuggest2.isSuggestionListShowing() ) |
160 |
|
- |
// { |
161 |
|
- |
// System.out.println( "About to show" ); |
162 |
|
- |
// DeferredCommand.addCommand( new Command() |
163 |
|
- |
// { |
164 |
|
- |
// @Override public void execute() |
165 |
|
- |
// { |
166 |
|
- |
// if ( !zSuggest2.isSuggestionListShowing() ) |
167 |
|
- |
// { |
168 |
|
- |
// if ( UtilsCommon.noEmpty( zSuggest2.getText() ) == null ) |
169 |
|
- |
// { |
170 |
|
- |
// zSuggest2.showSuggestionList(); |
171 |
|
- |
// } |
172 |
|
- |
// } |
173 |
|
- |
// } |
174 |
|
- |
// } ); |
175 |
|
- |
// } |
176 |
|
- |
// } |
177 |
|
- |
// |
178 |
|
- |
// @Override |
179 |
|
- |
// public void onLostFocus( Widget sender ) |
180 |
|
- |
// { |
181 |
|
- |
// //To change body of implemented methods use File | Settings | File Templates. |
182 |
|
- |
// } |
183 |
|
- |
// } ); |
184 |
|
- |
// |
185 |
|
- |
// add( zSuggest2 ); |
186 |
|
- |
|
187 |
132 |
|
} |
188 |
133 |
|
|
189 |
134 |
|
private void enableDisable( boolean pEnable, Enableable pButtonToEnable, Enableable pButtonToDisable ) |
|
@@ -442,176 +387,176 @@ |
442 |
387 |
|
} |
443 |
388 |
|
} |
444 |
389 |
|
|
445 |
|
- |
private static class MyDecimalFormatListener implements IFormComponent.Listener |
446 |
|
- |
{ |
447 |
|
- |
private IFormComponent mComponent; |
448 |
|
- |
private Object mErrorValue; |
449 |
|
- |
private Object mOrigValue, mCurValue; |
450 |
|
- |
private String mWhat; |
451 |
|
- |
|
452 |
|
- |
public MyDecimalFormatListener( Object pErrorValue ) |
453 |
|
- |
{ |
454 |
|
- |
mErrorValue = pErrorValue; |
455 |
|
- |
} |
456 |
|
- |
|
457 |
|
- |
@Override |
458 |
|
- |
public void add( IFormComponent pComponent ) |
459 |
|
- |
{ |
460 |
|
- |
mComponent = pComponent; |
461 |
|
- |
mOrigValue = mComponent.getCurrentValue(); |
462 |
|
- |
mWhat = UtilsCommon.justClassNameOf( mComponent ); |
463 |
|
- |
} |
464 |
|
- |
|
465 |
|
- |
@Override |
466 |
|
- |
public void remove( IFormComponent pComponent ) |
467 |
|
- |
{ |
468 |
|
- |
} |
469 |
|
- |
|
470 |
|
- |
@Override |
471 |
|
- |
public void changeOccurred() |
472 |
|
- |
{ |
473 |
|
- |
mCurValue = mComponent.getCurrentValue(); |
474 |
|
- |
// System.out.println( mWhat + " Change: '" + mCurValue + "'" ); |
475 |
|
- |
printToStatusbar( mWhat + " Change: '" + mCurValue + "'" ); |
476 |
|
- |
mComponent.setValueChanged( !UtilsGwt.areNonArraysEqual( mOrigValue, mCurValue ) ); |
477 |
|
- |
mComponent.setError( null ); |
478 |
|
- |
} |
479 |
|
- |
|
480 |
|
- |
@Override |
481 |
|
- |
public void blurOccurred() |
482 |
|
- |
{ |
483 |
|
- |
mComponent.setFocused( false ); |
484 |
|
- |
|
485 |
|
- |
mCurValue = mComponent.getCurrentValue(); |
486 |
|
- |
String zStrVal = mCurValue.toString(); |
487 |
|
- |
NumberFormat zFormat = NumberFormat.getDecimalFormat(); |
|
390 |
+ |
// private static class MyDecimalFormatListener implements IFormComponent.Listener |
|
391 |
+ |
// { |
|
392 |
+ |
// private IFormComponent mComponent; |
|
393 |
+ |
// private Object mErrorValue; |
|
394 |
+ |
// private Object mOrigValue, mCurValue; |
|
395 |
+ |
// private String mWhat; |
|
396 |
+ |
// |
|
397 |
+ |
// public MyDecimalFormatListener( Object pErrorValue ) |
|
398 |
+ |
// { |
|
399 |
+ |
// mErrorValue = pErrorValue; |
|
400 |
+ |
// } |
|
401 |
+ |
// |
|
402 |
+ |
// @Override |
|
403 |
+ |
// public void add( IFormComponent pComponent ) |
|
404 |
+ |
// { |
|
405 |
+ |
// mComponent = pComponent; |
|
406 |
+ |
// mOrigValue = mComponent.getCurrentValue(); |
|
407 |
+ |
// mWhat = UtilsCommon.justClassNameOf( mComponent ); |
|
408 |
+ |
// } |
|
409 |
+ |
// |
|
410 |
+ |
// @Override |
|
411 |
+ |
// public void remove( IFormComponent pComponent ) |
|
412 |
+ |
// { |
|
413 |
+ |
// } |
|
414 |
+ |
// |
|
415 |
+ |
// @Override |
|
416 |
+ |
// public void changeOccurred() |
|
417 |
+ |
// { |
|
418 |
+ |
// mCurValue = mComponent.getCurrentValue(); |
|
419 |
+ |
//// System.out.println( mWhat + " Change: '" + mCurValue + "'" ); |
|
420 |
+ |
// printToStatusbar( mWhat + " Change: '" + mCurValue + "'" ); |
|
421 |
+ |
// mComponent.setValueChanged( !UtilsGwt.areNonArraysEqual( mOrigValue, mCurValue ) ); |
|
422 |
+ |
// mComponent.setError( null ); |
|
423 |
+ |
// } |
|
424 |
+ |
// |
|
425 |
+ |
// @Override |
|
426 |
+ |
// public void blurOccurred() |
|
427 |
+ |
// { |
|
428 |
+ |
// mComponent.setFocused( false ); |
|
429 |
+ |
// |
|
430 |
+ |
// mCurValue = mComponent.getCurrentValue(); |
|
431 |
+ |
// String zStrVal = mCurValue.toString(); |
|
432 |
+ |
// NumberFormat zFormat = NumberFormat.getDecimalFormat(); |
|
433 |
+ |
// |
|
434 |
+ |
//// double zDouble = Double.parseDouble( zStrVal ); |
|
435 |
+ |
//// String zFormattedValue = zFormat.format( zDouble ); |
|
436 |
+ |
//// mComponent.setCurrentValue( zFormattedValue ); |
|
437 |
+ |
//// mComponent.setError( UtilsGwt.areNonArraysEqual( mErrorValue, mCurValue ) ? "Error!" : null ); |
|
438 |
+ |
// } |
|
439 |
+ |
// |
|
440 |
+ |
// @Override |
|
441 |
+ |
// public void focusOccured() |
|
442 |
+ |
// { |
|
443 |
+ |
// mComponent.setFocused( true ); |
|
444 |
+ |
//// System.out.println( mWhat + " Focus" ); |
|
445 |
+ |
// printToStatusbar( mWhat + " Focus" ); |
|
446 |
+ |
// } |
|
447 |
+ |
// |
|
448 |
+ |
// public void setCurrentValue( String pNewValue ) |
|
449 |
+ |
// { |
|
450 |
+ |
// mComponent.setCurrentValue( pNewValue ); |
|
451 |
+ |
// mCurValue = mOrigValue = mComponent.getCurrentValue(); |
|
452 |
+ |
// mComponent.setValueChanged( false ); |
|
453 |
+ |
// mComponent.setError( null ); |
|
454 |
+ |
// } |
|
455 |
+ |
// |
|
456 |
+ |
// @Override |
|
457 |
+ |
// public void enterPressed( KeyboardKeyModifier pModifiers ) |
|
458 |
+ |
// { |
|
459 |
+ |
// } |
|
460 |
+ |
// } |
488 |
461 |
|
|
489 |
|
- |
// double zDouble = Double.parseDouble( zStrVal ); |
490 |
|
- |
// String zFormattedValue = zFormat.format( zDouble ); |
|
462 |
+ |
// private static class MyCurrencyFormatListener implements IFormComponent.Listener |
|
463 |
+ |
// { |
|
464 |
+ |
// private IFormComponent mComponent; |
|
465 |
+ |
// private Object mErrorValue; |
|
466 |
+ |
// private Object mOrigValue, mCurValue; |
|
467 |
+ |
// private String mWhat; |
|
468 |
+ |
// |
|
469 |
+ |
// public MyCurrencyFormatListener( Object pErrorValue ) |
|
470 |
+ |
// { |
|
471 |
+ |
// mErrorValue = pErrorValue; |
|
472 |
+ |
// } |
|
473 |
+ |
// |
|
474 |
+ |
// @Override |
|
475 |
+ |
// public void add( IFormComponent pComponent ) |
|
476 |
+ |
// { |
|
477 |
+ |
// mComponent = pComponent; |
|
478 |
+ |
// mOrigValue = mComponent.getCurrentValue(); |
|
479 |
+ |
// mWhat = UtilsCommon.justClassNameOf( mComponent ); |
|
480 |
+ |
// } |
|
481 |
+ |
// |
|
482 |
+ |
// @Override |
|
483 |
+ |
// public void remove( IFormComponent pComponent ) |
|
484 |
+ |
// { |
|
485 |
+ |
// } |
|
486 |
+ |
// |
|
487 |
+ |
// @Override |
|
488 |
+ |
// public void changeOccurred() |
|
489 |
+ |
// { |
|
490 |
+ |
// mCurValue = mComponent.getCurrentValue(); |
|
491 |
+ |
//// System.out.println( mWhat + " Change: '" + mCurValue + "'" ); |
|
492 |
+ |
// printToStatusbar( mWhat + " Change: '" + mCurValue + "'" ); |
|
493 |
+ |
// mComponent.setValueChanged( !UtilsGwt.areNonArraysEqual( mOrigValue, mCurValue ) ); |
|
494 |
+ |
// mComponent.setError( null ); |
|
495 |
+ |
// } |
|
496 |
+ |
// |
|
497 |
+ |
// @Override |
|
498 |
+ |
// public void blurOccurred() |
|
499 |
+ |
// { |
|
500 |
+ |
// mComponent.setFocused( false ); |
|
501 |
+ |
// |
|
502 |
+ |
// mCurValue = mComponent.getCurrentValue(); |
|
503 |
+ |
// String zStrVal = mCurValue.toString(); |
|
504 |
+ |
// NumberFormat zFormat = NumberFormat.getCurrencyFormat(); |
|
505 |
+ |
// |
|
506 |
+ |
// Double zDouble = Double.valueOf( zStrVal ); |
|
507 |
+ |
// String zFormattedValue = zFormat.format( zDouble.doubleValue() ); |
491 |
508 |
|
// mComponent.setCurrentValue( zFormattedValue ); |
492 |
|
- |
// mComponent.setError( UtilsGwt.areNonArraysEqual( mErrorValue, mCurValue ) ? "Error!" : null ); |
493 |
|
- |
} |
494 |
|
- |
|
495 |
|
- |
@Override |
496 |
|
- |
public void focusOccured() |
497 |
|
- |
{ |
498 |
|
- |
mComponent.setFocused( true ); |
499 |
|
- |
// System.out.println( mWhat + " Focus" ); |
500 |
|
- |
printToStatusbar( mWhat + " Focus" ); |
501 |
|
- |
} |
502 |
|
- |
|
503 |
|
- |
public void setCurrentValue( String pNewValue ) |
504 |
|
- |
{ |
505 |
|
- |
mComponent.setCurrentValue( pNewValue ); |
506 |
|
- |
mCurValue = mOrigValue = mComponent.getCurrentValue(); |
507 |
|
- |
mComponent.setValueChanged( false ); |
508 |
|
- |
mComponent.setError( null ); |
509 |
|
- |
} |
510 |
|
- |
|
511 |
|
- |
@Override |
512 |
|
- |
public void enterPressed( KeyboardKeyModifier pModifiers ) |
513 |
|
- |
{ |
514 |
|
- |
} |
515 |
|
- |
} |
516 |
|
- |
|
517 |
|
- |
private static class MyCurrencyFormatListener implements IFormComponent.Listener |
518 |
|
- |
{ |
519 |
|
- |
private IFormComponent mComponent; |
520 |
|
- |
private Object mErrorValue; |
521 |
|
- |
private Object mOrigValue, mCurValue; |
522 |
|
- |
private String mWhat; |
523 |
|
- |
|
524 |
|
- |
public MyCurrencyFormatListener( Object pErrorValue ) |
525 |
|
- |
{ |
526 |
|
- |
mErrorValue = pErrorValue; |
527 |
|
- |
} |
528 |
|
- |
|
529 |
|
- |
@Override |
530 |
|
- |
public void add( IFormComponent pComponent ) |
531 |
|
- |
{ |
532 |
|
- |
mComponent = pComponent; |
533 |
|
- |
mOrigValue = mComponent.getCurrentValue(); |
534 |
|
- |
mWhat = UtilsCommon.justClassNameOf( mComponent ); |
535 |
|
- |
} |
536 |
|
- |
|
537 |
|
- |
@Override |
538 |
|
- |
public void remove( IFormComponent pComponent ) |
539 |
|
- |
{ |
540 |
|
- |
} |
541 |
|
- |
|
542 |
|
- |
@Override |
543 |
|
- |
public void changeOccurred() |
544 |
|
- |
{ |
545 |
|
- |
mCurValue = mComponent.getCurrentValue(); |
546 |
|
- |
// System.out.println( mWhat + " Change: '" + mCurValue + "'" ); |
547 |
|
- |
printToStatusbar( mWhat + " Change: '" + mCurValue + "'" ); |
548 |
|
- |
mComponent.setValueChanged( !UtilsGwt.areNonArraysEqual( mOrigValue, mCurValue ) ); |
549 |
|
- |
mComponent.setError( null ); |
550 |
|
- |
} |
551 |
|
- |
|
552 |
|
- |
@Override |
553 |
|
- |
public void blurOccurred() |
554 |
|
- |
{ |
555 |
|
- |
mComponent.setFocused( false ); |
556 |
|
- |
|
557 |
|
- |
mCurValue = mComponent.getCurrentValue(); |
558 |
|
- |
String zStrVal = mCurValue.toString(); |
559 |
|
- |
NumberFormat zFormat = NumberFormat.getCurrencyFormat(); |
560 |
|
- |
|
561 |
|
- |
Double zDouble = Double.valueOf( zStrVal ); |
562 |
|
- |
String zFormattedValue = zFormat.format( zDouble.doubleValue() ); |
563 |
|
- |
mComponent.setCurrentValue( zFormattedValue ); |
564 |
|
- |
// mComponent.setError( UtilsGwt.areNonArraysEqual( mErrorValue, mCurValue ) ? "Error!" : null ); |
565 |
|
- |
} |
566 |
|
- |
|
567 |
|
- |
@Override |
568 |
|
- |
public void focusOccured() |
569 |
|
- |
{ |
570 |
|
- |
mComponent.setFocused( true ); |
571 |
|
- |
// System.out.println( mWhat + " Focus" ); |
572 |
|
- |
printToStatusbar( mWhat + " Focus" ); |
573 |
|
- |
} |
574 |
|
- |
|
575 |
|
- |
public void setCurrentValue( String pNewValue ) |
576 |
|
- |
{ |
577 |
|
- |
mComponent.setCurrentValue( pNewValue ); |
578 |
|
- |
mCurValue = mOrigValue = mComponent.getCurrentValue(); |
579 |
|
- |
mComponent.setValueChanged( false ); |
580 |
|
- |
mComponent.setError( null ); |
581 |
|
- |
} |
582 |
|
- |
|
583 |
|
- |
@Override |
584 |
|
- |
public void enterPressed( KeyboardKeyModifier pModifiers ) |
585 |
|
- |
{ |
586 |
|
- |
} |
587 |
|
- |
} |
588 |
|
- |
|
589 |
|
- |
private static class MyResourceProvider implements ResourceKeyNameURLprovider |
590 |
|
- |
{ |
591 |
|
- |
@Override |
592 |
|
- |
public ResourceKeyNameURL[] getLocalResourceKeyNameURLs() |
593 |
|
- |
{ |
594 |
|
- |
return new ResourceKeyNameURL[]{new ResourceKeyNameURL( "AU", "Audi", "common/images/misc/tmp/audi.jpg" ),// |
595 |
|
- |
new ResourceKeyNameURL( "BM", "BMW", "common/images/misc/tmp/bmw.jpg" ),// |
596 |
|
- |
new ResourceKeyNameURL( "CH", "Chevrolet", "common/images/misc/tmp/chevy.jpg" ),// |
597 |
|
- |
new ResourceKeyNameURL( "FD", "Ford", "common/images/misc/tmp/ford.jpg" ),// |
598 |
|
- |
new ResourceKeyNameURL( "JA", "Jaguar", "common/images/misc/tmp/jag.jpg" ),// |
599 |
|
- |
new ResourceKeyNameURL( "MZ", "Mazda", "common/images/misc/tmp/mazda.jpg" ),// |
600 |
|
- |
new ResourceKeyNameURL( "MB", "Mercedes-Benz", "common/images/misc/tmp/mbenz.jpg" ),// |
601 |
|
- |
new ResourceKeyNameURL( "NS", "Nissan", "common/images/misc/tmp/nissan.jpg" ),// |
602 |
|
- |
new ResourceKeyNameURL( "TT", "Tata", "common/images/misc/tmp/tata.jpg" ),// |
603 |
|
- |
new ResourceKeyNameURL( "VW", "Volkswagen", "common/images/misc/tmp/vw.jpg" ),// |
604 |
|
- |
ERROR_RESOURCE,// |
605 |
|
- |
}; |
606 |
|
- |
} |
|
509 |
+ |
//// mComponent.setError( UtilsGwt.areNonArraysEqual( mErrorValue, mCurValue ) ? "Error!" : null ); |
|
510 |
+ |
// } |
|
511 |
+ |
// |
|
512 |
+ |
// @Override |
|
513 |
+ |
// public void focusOccured() |
|
514 |
+ |
// { |
|
515 |
+ |
// mComponent.setFocused( true ); |
|
516 |
+ |
//// System.out.println( mWhat + " Focus" ); |
|
517 |
+ |
// printToStatusbar( mWhat + " Focus" ); |
|
518 |
+ |
// } |
|
519 |
+ |
// |
|
520 |
+ |
// public void setCurrentValue( String pNewValue ) |
|
521 |
+ |
// { |
|
522 |
+ |
// mComponent.setCurrentValue( pNewValue ); |
|
523 |
+ |
// mCurValue = mOrigValue = mComponent.getCurrentValue(); |
|
524 |
+ |
// mComponent.setValueChanged( false ); |
|
525 |
+ |
// mComponent.setError( null ); |
|
526 |
+ |
// } |
|
527 |
+ |
// |
|
528 |
+ |
// @Override |
|
529 |
+ |
// public void enterPressed( KeyboardKeyModifier pModifiers ) |
|
530 |
+ |
// { |
|
531 |
+ |
// } |
|
532 |
+ |
// } |
607 |
533 |
|
|
608 |
|
- |
@Override |
609 |
|
- |
public void requestResourceKeyNameURLs( ResourceKeyNameURLsAvailableCallback pCallback ) |
610 |
|
- |
throws UnsupportedOperationException |
611 |
|
- |
{ |
612 |
|
- |
//To change body of implemented methods use File | Settings | File Templates. |
613 |
|
- |
} |
614 |
|
- |
} |
|
534 |
+ |
// private static class MyResourceProvider implements ResourceKeyNameURLprovider |
|
535 |
+ |
// { |
|
536 |
+ |
// @Override |
|
537 |
+ |
// public ResourceKeyNameURL[] getLocalResourceKeyNameURLs() |
|
538 |
+ |
// { |
|
539 |
+ |
// return new ResourceKeyNameURL[]{new ResourceKeyNameURL( "AU", "Audi", "common/images/misc/tmp/audi.jpg" ),// |
|
540 |
+ |
// new ResourceKeyNameURL( "BM", "BMW", "common/images/misc/tmp/bmw.jpg" ),// |
|
541 |
+ |
// new ResourceKeyNameURL( "CH", "Chevrolet", "common/images/misc/tmp/chevy.jpg" ),// |
|
542 |
+ |
// new ResourceKeyNameURL( "FD", "Ford", "common/images/misc/tmp/ford.jpg" ),// |
|
543 |
+ |
// new ResourceKeyNameURL( "JA", "Jaguar", "common/images/misc/tmp/jag.jpg" ),// |
|
544 |
+ |
// new ResourceKeyNameURL( "MZ", "Mazda", "common/images/misc/tmp/mazda.jpg" ),// |
|
545 |
+ |
// new ResourceKeyNameURL( "MB", "Mercedes-Benz", "common/images/misc/tmp/mbenz.jpg" ),// |
|
546 |
+ |
// new ResourceKeyNameURL( "NS", "Nissan", "common/images/misc/tmp/nissan.jpg" ),// |
|
547 |
+ |
// new ResourceKeyNameURL( "TT", "Tata", "common/images/misc/tmp/tata.jpg" ),// |
|
548 |
+ |
// new ResourceKeyNameURL( "VW", "Volkswagen", "common/images/misc/tmp/vw.jpg" ),// |
|
549 |
+ |
// ERROR_RESOURCE,// |
|
550 |
+ |
// }; |
|
551 |
+ |
// } |
|
552 |
+ |
// |
|
553 |
+ |
// @Override |
|
554 |
+ |
// public void requestResourceKeyNameURLs( ResourceKeyNameURLsAvailableCallback pCallback ) |
|
555 |
+ |
// throws UnsupportedOperationException |
|
556 |
+ |
// { |
|
557 |
+ |
// //To change body of implemented methods use File | Settings | File Templates. |
|
558 |
+ |
// } |
|
559 |
+ |
// } |
615 |
560 |
|
|
616 |
561 |
|
private static void printToStatusbar( String pMessage ) |
617 |
562 |
|
{ |
|
@@ -687,14 +632,16 @@ |
687 |
632 |
|
zTree.setAnimationEnabled( true ); |
688 |
633 |
|
zTree.addTreeSelectionListener( new TreeSelectionListener() |
689 |
634 |
|
{ |
690 |
|
- |
@Override public void selected( Object pSelected ) |
|
635 |
+ |
@Override |
|
636 |
+ |
public void selected( Object pSelected ) |
691 |
637 |
|
{ |
692 |
638 |
|
System.out.println( "Tree Selected: " + pSelected ); |
693 |
639 |
|
} |
694 |
640 |
|
} ); |
695 |
641 |
|
zTree.addTreeOpenCloseListener( new TreeOpenCloseListener() |
696 |
642 |
|
{ |
697 |
|
- |
@Override public void openStateChanged( Boolean pOpened ) |
|
643 |
+ |
@Override |
|
644 |
+ |
public void openStateChanged( Boolean pOpened ) |
698 |
645 |
|
{ |
699 |
646 |
|
System.out.println( "Tree Opened: " + pOpened + " - " + zTree.areAnyOpen() ); |
700 |
647 |
|
} |
|
@@ -707,14 +654,16 @@ |
707 |
654 |
|
hPanel.add( new Label( "Some Text" ) ); |
708 |
655 |
|
hPanel.add( Button.named( "Add" ).blue().text().add( new ClickHandler() |
709 |
656 |
|
{ |
710 |
|
- |
@Override public void onClick( ClickEvent event ) |
|
657 |
+ |
@Override |
|
658 |
+ |
public void onClick( ClickEvent event ) |
711 |
659 |
|
{ |
712 |
660 |
|
addTo( zTree ); |
713 |
661 |
|
} |
714 |
662 |
|
} ).create() ); |
715 |
|
- |
hPanel.add( Button.named( "Remove" ).blue().text( ).add( new ClickHandler() |
|
663 |
+ |
hPanel.add( Button.named( "Remove" ).blue().text().add( new ClickHandler() |
716 |
664 |
|
{ |
717 |
|
- |
@Override public void onClick( ClickEvent event ) |
|
665 |
+ |
@Override |
|
666 |
+ |
public void onClick( ClickEvent event ) |
718 |
667 |
|
{ |
719 |
668 |
|
if ( !zTree.isEmpty() ) |
720 |
669 |
|
{ |
|
@@ -727,9 +676,10 @@ |
727 |
676 |
|
} |
728 |
677 |
|
} |
729 |
678 |
|
} ).create() ); |
730 |
|
- |
hPanel.add( Button.named( "Remove1st" ).blue().text( ).add( new ClickHandler() |
|
679 |
+ |
hPanel.add( Button.named( "Remove1st" ).blue().text().add( new ClickHandler() |
731 |
680 |
|
{ |
732 |
|
- |
@Override public void onClick( ClickEvent event ) |
|
681 |
+ |
@Override |
|
682 |
+ |
public void onClick( ClickEvent event ) |
733 |
683 |
|
{ |
734 |
684 |
|
if ( !zTree.isEmpty() ) |
735 |
685 |
|
{ |