|
@@ -18,8 +18,8 @@ |
18 |
18 |
|
{ |
19 |
19 |
|
// private static final ResourceKeyNameURL ERROR_RESOURCE = new ResourceKeyNameURL( "VW2", "Volkswagen2", "common/images/misc/tmp/vw.jpg" ); |
20 |
20 |
|
|
21 |
|
- |
private final List<Enableable> mFormComponents = new ArrayList<Enableable>(); |
22 |
|
- |
private Button mEnable, mDisable, mDialog; |
|
21 |
+ |
// private final List<Enableable> mFormComponents = new ArrayList<Enableable>(); |
|
22 |
+ |
// private Button mEnable, mDisable, mDialog; |
23 |
23 |
|
|
24 |
24 |
|
public PersonalInfoForm() |
25 |
25 |
|
{ |
|
@@ -27,8 +27,8 @@ |
27 |
27 |
|
|
28 |
28 |
|
HorizontalPanel zHPanel; |
29 |
29 |
|
|
30 |
|
- |
add( TestTable.create() ); |
31 |
|
- |
|
|
30 |
+ |
// add( TestTable.create() ); |
|
31 |
+ |
// |
32 |
32 |
|
// FormTextarea zFrmTA = new FormTextarea( "Comments are really long", null, "My New Tooltip", false, // |
33 |
33 |
|
// null, false, // |
34 |
34 |
|
// null, false ); |
|
@@ -37,18 +37,18 @@ |
37 |
37 |
|
|
38 |
38 |
|
add( zHPanel = new HorizontalPanel() ); |
39 |
39 |
|
|
40 |
|
- |
FormTimestampPicker zTimestampPicker = new FormTimestampPicker( "Timestamp", null, "My New Tooltip", TimeRes.ToMIN, "Cancel", "OK" ); |
41 |
|
- |
zTimestampPicker.addFormComponentListener( new MyListener( new SimpleTimestamp( 1960, 1, 2, 3, 4 ) ) ); |
42 |
|
- |
zHPanel.add( zTimestampPicker ); |
43 |
|
- |
|
44 |
|
- |
FormDatePicker zCalendar = new FormDatePicker( "Calendar", null, "Pick-a-Date", "Cancel", "Today", DateFormat.DEFAULT_YMD ); |
45 |
|
- |
zCalendar.addFormComponentListener( new MyListener( new CalendarYMD( 1957, 1, 4 ) ) ); |
46 |
|
- |
zHPanel.add( zCalendar ); |
47 |
|
- |
|
48 |
|
- |
FormTimePicker zTime = new FormTimePicker( "Time", null, "Pick-a-Time", TimeRes.ToMIN, "Cancel", "OK" ); |
49 |
|
- |
zTime.addFormComponentListener( new MyListener( new SimpleTime( 1, 2 ) ) ); |
50 |
|
- |
zHPanel.add( zTime ); |
51 |
|
- |
|
|
40 |
+ |
// FormTimestampPicker zTimestampPicker = new FormTimestampPicker( "Timestamp", null, "My New Tooltip", TimeRes.ToMIN, "Cancel", "OK" ); |
|
41 |
+ |
// zTimestampPicker.addFormComponentListener( new MyListener( new SimpleTimestamp( 1960, 1, 2, 3, 4 ) ) ); |
|
42 |
+ |
// zHPanel.add( zTimestampPicker ); |
|
43 |
+ |
// |
|
44 |
+ |
// FormDatePicker zCalendar = new FormDatePicker( "Calendar", null, "Pick-a-Date", "Cancel", "Today", new DateFormatControl( DateFormatControl.DEFAULT_DATE_FORMAT ) ); |
|
45 |
+ |
// zCalendar.addFormComponentListener( new MyListener( new SimpleDate( 1957, 1, 4 ) ) ); |
|
46 |
+ |
// zHPanel.add( zCalendar ); |
|
47 |
+ |
// |
|
48 |
+ |
// FormTimePicker zTime = new FormTimePicker( "Time", null, "Pick-a-Time", TimeRes.ToMIN, "Cancel", "OK" ); |
|
49 |
+ |
// zTime.addFormComponentListener( new MyListener( new SimpleTime( 1, 2 ) ) ); |
|
50 |
+ |
// zHPanel.add( zTime ); |
|
51 |
+ |
// |
52 |
52 |
|
FormComboBox zOptions = new FormComboBox( "Colors *", null, "Pick-a-color", "Red" ); |
53 |
53 |
|
zOptions.addFormComponentListener( new MyListener( "-Select-" ) ); |
54 |
54 |
|
zOptions.addItems( "-Select-", // |
|
@@ -62,6 +62,8 @@ |
62 |
62 |
|
// FormSuggestBox zSuggest = new FormSuggestBox( "Suggestions", null, "Type to filter content", null, null, createSuggestions() ); |
63 |
63 |
|
// zSuggest.addFormComponentListener( new MyListener( "ERROR" ) ); |
64 |
64 |
|
// |
|
65 |
+ |
// String[] zRadioGroupOptions = new String[]{"Option One", "Option Two is a really long, long option", "Option Three",}; |
|
66 |
+ |
// |
65 |
67 |
|
// FormTextField zTFfc = new FormTextField( "First Name", null, "My New Tooltip", null, null ); |
66 |
68 |
|
// zTFfc.addFormComponentListener( new MyListener( "ERROR" ) ); |
67 |
69 |
|
// |
|
@@ -78,17 +80,15 @@ |
78 |
80 |
|
// zHPanel.add( zPFfc ); |
79 |
81 |
|
// zHPanel.add( new Spacer( 10 ) ); |
80 |
82 |
|
// zHPanel.add( zTFnumeric ); |
81 |
|
- |
|
82 |
|
- |
String[] zRadioGroupOptions = new String[]{"Option One", "Option Two is a really long, long option", "Option Three",}; |
83 |
|
- |
|
84 |
|
- |
FormRadioGroup zRGfc = new FormRadioGroup( "Group Uno", null, "Radio Tooltip", zRadioGroupOptions ); |
85 |
|
- |
zRGfc.addFormComponentListener( new MyListener( "N/A" ) ); |
86 |
|
- |
add( zRGfc ); |
87 |
|
- |
|
88 |
|
- |
FormCheckBox zCheck = new FormCheckBox( "Option1", null, "Options Tooltip", false ); |
89 |
|
- |
zCheck.addFormComponentListener( new MyListener( null ) ); |
90 |
|
- |
add( zCheck ); |
91 |
|
- |
|
|
83 |
+ |
// |
|
84 |
+ |
// FormRadioGroup zRGfc = new FormRadioGroup( "Group Uno", null, "Radio Tooltip", zRadioGroupOptions ); |
|
85 |
+ |
// zRGfc.addFormComponentListener( new MyListener( "N/A" ) ); |
|
86 |
+ |
// add( zRGfc ); |
|
87 |
+ |
// |
|
88 |
+ |
// FormCheckBox zCheck = new FormCheckBox( "Option1", null, "Options Tooltip", false ); |
|
89 |
+ |
// zCheck.addFormComponentListener( new MyListener( null ) ); |
|
90 |
+ |
// add( zCheck ); |
|
91 |
+ |
// |
92 |
92 |
|
// SizeableBorderedHorizontalSplitPairPanel zHSP2 = new SizeableBorderedHorizontalSplitPairPanel().stretchable(); |
93 |
93 |
|
// zHSP2.add( createCurrentTasks() ); |
94 |
94 |
|
// zHSP2.add( createTree() ); |
|
@@ -100,228 +100,65 @@ |
100 |
100 |
|
//// zHSP.add( zFrmTA ); |
101 |
101 |
|
//// zHSP.add( zHSP2 ); |
102 |
102 |
|
// |
103 |
|
- |
collectEnableables( mFormComponents, this ); |
104 |
|
- |
|
105 |
|
- |
SizeableHorizontalPanel hBtnPanel = new SizeableHorizontalPanel().stretchableHorizontally(); |
106 |
|
- |
hBtnPanel.add( mEnable = Button.named( "Enable" ).green().text().add( new ClickHandler() |
107 |
|
- |
{ |
108 |
|
- |
@Override |
109 |
|
- |
public void onClick( ClickEvent event ) |
110 |
|
- |
{ |
111 |
|
- |
enableDisable( true, mDisable, mEnable ); |
112 |
|
- |
} |
113 |
|
- |
} ).create() ); |
114 |
|
- |
mEnable.disable(); |
115 |
|
- |
|
116 |
|
- |
hBtnPanel.add( mDisable = Button.named( "Disable" ).red().text().add( new ClickHandler() |
117 |
|
- |
{ |
118 |
|
- |
@Override |
119 |
|
- |
public void onClick( ClickEvent event ) |
120 |
|
- |
{ |
121 |
|
- |
enableDisable( false, mEnable, mDisable ); |
122 |
|
- |
} |
123 |
|
- |
} ).create() ); |
124 |
|
- |
hBtnPanel.add( new SizeableSpacer().stretchableHorizontally() ); |
125 |
|
- |
hBtnPanel.add( mDialog = ScreenBigButton.factory( "Dialog" ).add( new ClickHandler() |
126 |
|
- |
{ |
127 |
|
- |
@Override |
128 |
|
- |
public void onClick( ClickEvent event ) |
129 |
|
- |
{ |
130 |
|
- |
AlertManager.alert( "Test", "A Dialog", "The Body" ); |
131 |
|
- |
} |
132 |
|
- |
} ).create() ); |
133 |
|
- |
add( hBtnPanel ); |
|
103 |
+ |
// collectEnableables( mFormComponents, this ); |
|
104 |
+ |
// |
|
105 |
+ |
// SizeableHorizontalPanel hBtnPanel = new SizeableHorizontalPanel().stretchableHorizontally(); |
|
106 |
+ |
// hBtnPanel.add( mEnable = Button.named( "Enable" ).green().text().add( new ClickHandler() |
|
107 |
+ |
// { |
|
108 |
+ |
// @Override |
|
109 |
+ |
// public void onClick( ClickEvent event ) |
|
110 |
+ |
// { |
|
111 |
+ |
// enableDisable( true, mDisable, mEnable ); |
|
112 |
+ |
// } |
|
113 |
+ |
// } ).create() ); |
|
114 |
+ |
// mEnable.disable(); |
|
115 |
+ |
// |
|
116 |
+ |
// hBtnPanel.add( mDisable = Button.named( "Disable" ).red().text().add( new ClickHandler() |
|
117 |
+ |
// { |
|
118 |
+ |
// @Override |
|
119 |
+ |
// public void onClick( ClickEvent event ) |
|
120 |
+ |
// { |
|
121 |
+ |
// enableDisable( false, mEnable, mDisable ); |
|
122 |
+ |
// } |
|
123 |
+ |
// } ).create() ); |
|
124 |
+ |
// hBtnPanel.add( new SizeableSpacer().stretchableHorizontally() ); |
|
125 |
+ |
//// hBtnPanel.add( mDialog = ScreenBigButton.factory( "Dialog" ).add( new ClickHandler() |
|
126 |
+ |
//// { |
|
127 |
+ |
//// @Override |
|
128 |
+ |
//// public void onClick( ClickEvent event ) |
|
129 |
+ |
//// { |
|
130 |
+ |
//// AlertManager.alert( "Test", "A Dialog", "The Body" ); |
|
131 |
+ |
//// } |
|
132 |
+ |
//// } ).create() ); |
|
133 |
+ |
// add( hBtnPanel ); |
134 |
134 |
|
} |
135 |
135 |
|
|
136 |
|
- |
private void enableDisable( boolean pEnable, Enableable pButtonToEnable, Enableable pButtonToDisable ) |
137 |
|
- |
{ |
138 |
|
- |
pButtonToDisable.setEnabled( false ); |
139 |
|
- |
mDialog.setEnabled( pEnable ); |
140 |
|
- |
for ( Enableable zEnableable : mFormComponents ) |
141 |
|
- |
{ |
142 |
|
- |
zEnableable.setEnabled( pEnable ); |
143 |
|
- |
} |
144 |
|
- |
pButtonToEnable.setEnabled( true ); |
145 |
|
- |
} |
|
136 |
+ |
// private void enableDisable( boolean pEnable, Enableable pButtonToEnable, Enableable pButtonToDisable ) |
|
137 |
+ |
// { |
|
138 |
+ |
// pButtonToDisable.setEnabled( false ); |
|
139 |
+ |
// mDialog.setEnabled( pEnable ); |
|
140 |
+ |
// for ( Enableable zEnableable : mFormComponents ) |
|
141 |
+ |
// { |
|
142 |
+ |
// zEnableable.setEnabled( pEnable ); |
|
143 |
+ |
// } |
|
144 |
+ |
// pButtonToEnable.setEnabled( true ); |
|
145 |
+ |
// } |
146 |
146 |
|
|
147 |
|
- |
private List<String> createSuggestions() |
148 |
|
- |
{ |
149 |
|
- |
return Arrays.asList(// |
150 |
|
- |
"Afghanistan", // |
151 |
|
- |
"Albania", // |
152 |
|
- |
"Algeria", // |
153 |
|
- |
"Argentina", // |
154 |
|
- |
"Armenia", // |
155 |
|
- |
"Australia", // |
156 |
|
- |
"Austria", // |
157 |
|
- |
"Azerbaijan", // |
158 |
|
- |
"Bahamas", // |
159 |
|
- |
"Bahrain", // |
160 |
|
- |
"Bangladesh", // |
161 |
|
- |
"Barbados", // |
162 |
|
- |
"Belarus", // |
163 |
|
- |
"Belgium", // |
164 |
|
- |
"Belize", // |
165 |
|
- |
"Benin", // |
166 |
|
- |
"Bhutan", // |
167 |
|
- |
"Bolivia", // |
168 |
|
- |
"Bosnia", // |
169 |
|
- |
"Brazil", // |
170 |
|
- |
"Bulgaria", // |
171 |
|
- |
"Cambodia", // |
172 |
|
- |
"Cameroon", // |
173 |
|
- |
"Canada", // |
174 |
|
- |
"Chad", // |
175 |
|
- |
"Chile", // |
176 |
|
- |
"China", // |
177 |
|
- |
"Colombia", // |
178 |
|
- |
"Comoros", // |
179 |
|
- |
"Congo", // |
180 |
|
- |
"Costa Rica", // |
181 |
|
- |
"Croatia", // |
182 |
|
- |
"Cuba", // |
183 |
|
- |
"Cyprus", // |
184 |
|
- |
"Denmark", // |
185 |
|
- |
"Dominica", // |
186 |
|
- |
"Ecuador", // |
187 |
|
- |
"Egypt", // |
188 |
|
- |
"Eritrea", // |
189 |
|
- |
"Estonia", // |
190 |
|
- |
"Ethiopia", // |
191 |
|
- |
"Fiji", // |
192 |
|
- |
"Finland", // |
193 |
|
- |
"France", // |
194 |
|
- |
"Gabon", // |
195 |
|
- |
"Gambia", // |
196 |
|
- |
"Germany", // |
197 |
|
- |
"Ghana", // |
198 |
|
- |
"Greece", // |
199 |
|
- |
"Grenada", // |
200 |
|
- |
"Guatemala", // |
201 |
|
- |
"Guinea", // |
202 |
|
- |
"Guyana", // |
203 |
|
- |
"Haiti", // |
204 |
|
- |
"Honduras", // |
205 |
|
- |
"Hungary", // |
206 |
|
- |
"Iceland", // |
207 |
|
- |
"India", // |
208 |
|
- |
"Indonesia", // |
209 |
|
- |
"Iran", // |
210 |
|
- |
"Iraq", // |
211 |
|
- |
"Ireland", // |
212 |
|
- |
"Israel", // |
213 |
|
- |
"Italy", // |
214 |
|
- |
"Jamaica", // |
215 |
|
- |
"Japan", // |
216 |
|
- |
"Jordan", // |
217 |
|
- |
"Kazakhstan", // |
218 |
|
- |
"Kenya", // |
219 |
|
- |
"Kiribati", // |
220 |
|
- |
"Korea, North", // |
221 |
|
- |
"Korea, South", // |
222 |
|
- |
"Kuwait", // |
223 |
|
- |
"Kyrgyzstan", // |
224 |
|
- |
"Laos", // |
225 |
|
- |
"Latvia", // |
226 |
|
- |
"Lebanon", // |
227 |
|
- |
"Lesotho", // |
228 |
|
- |
"Liberia", // |
229 |
|
- |
"Libya", // |
230 |
|
- |
"Liechtenstein", // |
231 |
|
- |
"Lithuania", // |
232 |
|
- |
"Luxembourg", // |
233 |
|
- |
"Madagascar", // |
234 |
|
- |
"Malawi", // |
235 |
|
- |
"Malaysia", // |
236 |
|
- |
"Maldives", // |
237 |
|
- |
"Mali", // |
238 |
|
- |
"Malta", // |
239 |
|
- |
"Mauritania", // |
240 |
|
- |
"Mauritius", // |
241 |
|
- |
"Mexico", // |
242 |
|
- |
"Moldova", // |
243 |
|
- |
"Monaco", // |
244 |
|
- |
"Mongolia", // |
245 |
|
- |
"Montenegro", // |
246 |
|
- |
"Morocco", // |
247 |
|
- |
"Mozambique", // |
248 |
|
- |
"Myanmar", // |
249 |
|
- |
"Namibia", // |
250 |
|
- |
"Nepal", // |
251 |
|
- |
"Netherlands", // |
252 |
|
- |
"New Zealand", // |
253 |
|
- |
"Nicaragua", // |
254 |
|
- |
"Niger", // |
255 |
|
- |
"Nigeria", // |
256 |
|
- |
"Norway", // |
257 |
|
- |
"Oman", // |
258 |
|
- |
"Pakistan", // |
259 |
|
- |
"Palau", // |
260 |
|
- |
"Panama", // |
261 |
|
- |
"Paraguay", // |
262 |
|
- |
"Peru", // |
263 |
|
- |
"Philippines", // |
264 |
|
- |
"Poland", // |
265 |
|
- |
"Portugal", // |
266 |
|
- |
"Qatar", // |
267 |
|
- |
"Romania", // |
268 |
|
- |
"Russia", // |
269 |
|
- |
"Rwanda", // |
270 |
|
- |
"Samoa", // |
271 |
|
- |
"Saudi Arabia", // |
272 |
|
- |
"Senegal", // |
273 |
|
- |
"Serbia", // |
274 |
|
- |
"Seychelles", // |
275 |
|
- |
"Singapore", // |
276 |
|
- |
"Slovakia", // |
277 |
|
- |
"Slovenia", // |
278 |
|
- |
"Somalia", // |
279 |
|
- |
"South Africa", // |
280 |
|
- |
"Spain", // |
281 |
|
- |
"Sudan", // |
282 |
|
- |
"Suriname", // |
283 |
|
- |
"Swaziland", // |
284 |
|
- |
"Sweden", // |
285 |
|
- |
"Switzerland", // |
286 |
|
- |
"Syria", // |
287 |
|
- |
"Taiwan", // |
288 |
|
- |
"Tajikistan", // |
289 |
|
- |
"Tanzania", // |
290 |
|
- |
"Thailand", // |
291 |
|
- |
"Togo", // |
292 |
|
- |
"Tonga", // |
293 |
|
- |
"Tunisia", // |
294 |
|
- |
"Turkey", // |
295 |
|
- |
"Turkmenistan", // |
296 |
|
- |
"Uganda", // |
297 |
|
- |
"Ukraine", // |
298 |
|
- |
"United Arab Emirates", // |
299 |
|
- |
"United Kingdom", // |
300 |
|
- |
"United States", // |
301 |
|
- |
"Uruguay", // |
302 |
|
- |
"Uzbekistan", // |
303 |
|
- |
"Vanuatu", // |
304 |
|
- |
"Venezuela", // |
305 |
|
- |
"Vietnam", // |
306 |
|
- |
"Yemen", // |
307 |
|
- |
"Zambia", // |
308 |
|
- |
"Zimbabwe" ); |
309 |
|
- |
} |
310 |
147 |
|
|
311 |
|
- |
private void collectEnableables( List<Enableable> pFormComponents, HasWidgets pWidget ) |
312 |
|
- |
{ |
313 |
|
- |
for ( Widget zWidget : pWidget ) |
314 |
|
- |
{ |
315 |
|
- |
if ( (zWidget instanceof Enableable) && !(zWidget instanceof Button) ) |
316 |
|
- |
{ |
317 |
|
- |
pFormComponents.add( (Enableable) zWidget ); |
318 |
|
- |
} |
319 |
|
- |
if ( zWidget instanceof HasWidgets ) |
320 |
|
- |
{ |
321 |
|
- |
collectEnableables( pFormComponents, (HasWidgets) zWidget ); |
322 |
|
- |
} |
323 |
|
- |
} |
324 |
|
- |
} |
|
148 |
+ |
// private void collectEnableables( List<Enableable> pFormComponents, HasWidgets pWidget ) |
|
149 |
+ |
// { |
|
150 |
+ |
// for ( Widget zWidget : pWidget ) |
|
151 |
+ |
// { |
|
152 |
+ |
// if ( (zWidget instanceof Enableable) && !(zWidget instanceof Button) ) |
|
153 |
+ |
// { |
|
154 |
+ |
// pFormComponents.add( (Enableable) zWidget ); |
|
155 |
+ |
// } |
|
156 |
+ |
// if ( zWidget instanceof HasWidgets ) |
|
157 |
+ |
// { |
|
158 |
+ |
// collectEnableables( pFormComponents, (HasWidgets) zWidget ); |
|
159 |
+ |
// } |
|
160 |
+ |
// } |
|
161 |
+ |
// } |
325 |
162 |
|
|
326 |
163 |
|
private static class MyListener implements IFormComponent.Listener |
327 |
164 |
|
{ |
|
@@ -567,139 +404,139 @@ |
567 |
404 |
|
StatusBar.set( pMessage + " | " + current ); |
568 |
405 |
|
} |
569 |
406 |
|
|
570 |
|
- |
private TreeNode mTI2, mTI; |
571 |
|
- |
private int mAddIndex = 0; |
572 |
|
- |
|
573 |
|
- |
private void addTo( SizeableTree zTree ) |
574 |
|
- |
{ |
575 |
|
- |
switch ( (mAddIndex++ & 7) ) |
576 |
|
- |
{ |
577 |
|
- |
case 0: |
578 |
|
- |
mTI = zTree.addChild( augment( "One" ) ); |
579 |
|
- |
break; |
580 |
|
- |
case 1: |
581 |
|
- |
mTI2 = mTI.addChild( augment( "A" ) ); |
582 |
|
- |
mTI.addChild( augment( "B" ) ); |
583 |
|
- |
mTI.addChild( augment( "C" ) ); |
584 |
|
- |
break; |
585 |
|
- |
case 2: |
586 |
|
- |
mTI2.addChild( augment( "I" ) ); |
587 |
|
- |
mTI2.addChild( augment( "II" ) ); |
588 |
|
- |
mTI2.addChild( augment( "III" ) ); |
589 |
|
- |
mTI2.addChild( augment( "IV" ) ); |
590 |
|
- |
mTI2.addChild( augment( "V" ) ); |
591 |
|
- |
break; |
592 |
|
- |
case 3: |
593 |
|
- |
mTI = zTree.addChild( augment( "Two" ) ); |
594 |
|
- |
break; |
595 |
|
- |
case 4: |
596 |
|
- |
mTI.addChild( augment( "A" ) ); |
597 |
|
- |
mTI2 = mTI.addChild( augment( "B" ) ); |
598 |
|
- |
mTI.addChild( augment( "C" ) ); |
599 |
|
- |
break; |
600 |
|
- |
case 5: |
601 |
|
- |
mTI2.addChild( augment( "I" ) ); |
602 |
|
- |
mTI2.addChild( augment( "II" ) ); |
603 |
|
- |
mTI2.addChild( augment( "III" ) ); |
604 |
|
- |
mTI2.addChild( augment( "IV" ) ); |
605 |
|
- |
mTI2.addChild( augment( "V" ) ); |
606 |
|
- |
break; |
607 |
|
- |
case 6: |
608 |
|
- |
mTI = zTree.addChild( augment( "Three" ) ); |
609 |
|
- |
break; |
610 |
|
- |
case 7: |
611 |
|
- |
mTI.addChild( augment( "A" ) ); |
612 |
|
- |
mTI.addChild( augment( "B" ) ); |
613 |
|
- |
mTI2 = mTI.addChild( augment( "C" ) ); |
614 |
|
- |
mTI2.addChild( augment( "I" ) ); |
615 |
|
- |
mTI2.addChild( augment( "II" ) ); |
616 |
|
- |
mTI2.addChild( augment( "III" ) ); |
617 |
|
- |
mTI2.addChild( augment( "IV" ) ); |
618 |
|
- |
mTI2.addChild( augment( "V" ) ); |
619 |
|
- |
break; |
620 |
|
- |
} |
621 |
|
- |
} |
622 |
|
- |
|
623 |
|
- |
private String augment( String pBaseName ) |
624 |
|
- |
{ |
625 |
|
- |
return pBaseName + "-" + mAddIndex; |
626 |
|
- |
} |
627 |
|
- |
|
628 |
|
- |
private Widget createTree() |
629 |
|
- |
{ |
630 |
|
- |
Button zOpenAll = FolderOpenButton.factory().create(); |
631 |
|
- |
Button zCloseAll = FolderClosedButton.factory().create(); |
632 |
|
- |
final SizeableTree zTree = SizeableTree.withFolders(); |
633 |
|
- |
zTree.connectOpenCloseButtons( zOpenAll, zCloseAll ); |
634 |
|
- |
zTree.setAnimationEnabled( true ); |
635 |
|
- |
zTree.addTreeSelectionListener( new TreeSelectionListener() |
636 |
|
- |
{ |
637 |
|
- |
@Override |
638 |
|
- |
public void selected( Object pSelected ) |
639 |
|
- |
{ |
640 |
|
- |
System.out.println( "Tree Selected: " + pSelected ); |
641 |
|
- |
} |
642 |
|
- |
} ); |
643 |
|
- |
zTree.addTreeOpenCloseListener( new TreeOpenCloseListener() |
644 |
|
- |
{ |
645 |
|
- |
@Override |
646 |
|
- |
public void openStateChanged( Boolean pOpened ) |
647 |
|
- |
{ |
648 |
|
- |
System.out.println( "Tree Opened: " + pOpened + " - " + zTree.areAnyOpen() ); |
649 |
|
- |
} |
650 |
|
- |
} ); |
651 |
|
- |
|
652 |
|
- |
SizeableHorizontalPanel hPanel = new SizeableHorizontalPanel().stretchableHorizontally(); |
653 |
|
- |
hPanel.add( zOpenAll ); |
654 |
|
- |
hPanel.add( zCloseAll ); |
655 |
|
- |
hPanel.add( new Spacer( 10 ) ); |
656 |
|
- |
hPanel.add( new Label( "Some Text" ) ); |
657 |
|
- |
hPanel.add( Button.named( "Add" ).blue().text().add( new ClickHandler() |
658 |
|
- |
{ |
659 |
|
- |
@Override |
660 |
|
- |
public void onClick( ClickEvent event ) |
661 |
|
- |
{ |
662 |
|
- |
addTo( zTree ); |
663 |
|
- |
} |
664 |
|
- |
} ).create() ); |
665 |
|
- |
hPanel.add( Button.named( "Remove" ).blue().text().add( new ClickHandler() |
666 |
|
- |
{ |
667 |
|
- |
@Override |
668 |
|
- |
public void onClick( ClickEvent event ) |
669 |
|
- |
{ |
670 |
|
- |
if ( !zTree.isEmpty() ) |
671 |
|
- |
{ |
672 |
|
- |
Object zUserObject = zTree.getSelected(); |
673 |
|
- |
if ( zUserObject == null ) |
674 |
|
- |
{ |
675 |
|
- |
zUserObject = zTree.iterator().next(); |
676 |
|
- |
} |
677 |
|
- |
zTree.removeDescendant( zUserObject ); |
678 |
|
- |
} |
679 |
|
- |
} |
680 |
|
- |
} ).create() ); |
681 |
|
- |
hPanel.add( Button.named( "Remove1st" ).blue().text().add( new ClickHandler() |
682 |
|
- |
{ |
683 |
|
- |
@Override |
684 |
|
- |
public void onClick( ClickEvent event ) |
685 |
|
- |
{ |
686 |
|
- |
if ( !zTree.isEmpty() ) |
687 |
|
- |
{ |
688 |
|
- |
Object zUserObject = zTree.iterator().next(); |
689 |
|
- |
zTree.removeChild( zUserObject ); |
690 |
|
- |
} |
691 |
|
- |
} |
692 |
|
- |
} ).create() ); |
693 |
|
- |
|
694 |
|
- |
SizeableVerticalPanel vPanel = new SizeableVerticalPanel().stretchable(); |
695 |
|
- |
vPanel.add( hPanel ); |
696 |
|
- |
vPanel.add( zTree ); |
697 |
|
- |
|
698 |
|
- |
return vPanel; |
699 |
|
- |
} |
|
407 |
+ |
// private TreeNode mTI2, mTI; |
|
408 |
+ |
// private int mAddIndex = 0; |
|
409 |
+ |
// |
|
410 |
+ |
// private void addTo( SizeableTree zTree ) |
|
411 |
+ |
// { |
|
412 |
+ |
// switch ( (mAddIndex++ & 7) ) |
|
413 |
+ |
// { |
|
414 |
+ |
// case 0: |
|
415 |
+ |
// mTI = zTree.addChild( augment( "One" ) ); |
|
416 |
+ |
// break; |
|
417 |
+ |
// case 1: |
|
418 |
+ |
// mTI2 = mTI.addChild( augment( "A" ) ); |
|
419 |
+ |
// mTI.addChild( augment( "B" ) ); |
|
420 |
+ |
// mTI.addChild( augment( "C" ) ); |
|
421 |
+ |
// break; |
|
422 |
+ |
// case 2: |
|
423 |
+ |
// mTI2.addChild( augment( "I" ) ); |
|
424 |
+ |
// mTI2.addChild( augment( "II" ) ); |
|
425 |
+ |
// mTI2.addChild( augment( "III" ) ); |
|
426 |
+ |
// mTI2.addChild( augment( "IV" ) ); |
|
427 |
+ |
// mTI2.addChild( augment( "V" ) ); |
|
428 |
+ |
// break; |
|
429 |
+ |
// case 3: |
|
430 |
+ |
// mTI = zTree.addChild( augment( "Two" ) ); |
|
431 |
+ |
// break; |
|
432 |
+ |
// case 4: |
|
433 |
+ |
// mTI.addChild( augment( "A" ) ); |
|
434 |
+ |
// mTI2 = mTI.addChild( augment( "B" ) ); |
|
435 |
+ |
// mTI.addChild( augment( "C" ) ); |
|
436 |
+ |
// break; |
|
437 |
+ |
// case 5: |
|
438 |
+ |
// mTI2.addChild( augment( "I" ) ); |
|
439 |
+ |
// mTI2.addChild( augment( "II" ) ); |
|
440 |
+ |
// mTI2.addChild( augment( "III" ) ); |
|
441 |
+ |
// mTI2.addChild( augment( "IV" ) ); |
|
442 |
+ |
// mTI2.addChild( augment( "V" ) ); |
|
443 |
+ |
// break; |
|
444 |
+ |
// case 6: |
|
445 |
+ |
// mTI = zTree.addChild( augment( "Three" ) ); |
|
446 |
+ |
// break; |
|
447 |
+ |
// case 7: |
|
448 |
+ |
// mTI.addChild( augment( "A" ) ); |
|
449 |
+ |
// mTI.addChild( augment( "B" ) ); |
|
450 |
+ |
// mTI2 = mTI.addChild( augment( "C" ) ); |
|
451 |
+ |
// mTI2.addChild( augment( "I" ) ); |
|
452 |
+ |
// mTI2.addChild( augment( "II" ) ); |
|
453 |
+ |
// mTI2.addChild( augment( "III" ) ); |
|
454 |
+ |
// mTI2.addChild( augment( "IV" ) ); |
|
455 |
+ |
// mTI2.addChild( augment( "V" ) ); |
|
456 |
+ |
// break; |
|
457 |
+ |
// } |
|
458 |
+ |
// } |
|
459 |
+ |
// |
|
460 |
+ |
// private String augment( String pBaseName ) |
|
461 |
+ |
// { |
|
462 |
+ |
// return pBaseName + "-" + mAddIndex; |
|
463 |
+ |
// } |
|
464 |
+ |
// |
|
465 |
+ |
// private Widget createTree() |
|
466 |
+ |
// { |
|
467 |
+ |
// Button zOpenAll = FolderOpenButton.factory().create(); |
|
468 |
+ |
// Button zCloseAll = FolderClosedButton.factory().create(); |
|
469 |
+ |
// final SizeableTree zTree = SizeableTree.withFolders(); |
|
470 |
+ |
// zTree.connectOpenCloseButtons( zOpenAll, zCloseAll ); |
|
471 |
+ |
// zTree.setAnimationEnabled( true ); |
|
472 |
+ |
// zTree.addTreeSelectionListener( new TreeSelectionListener() |
|
473 |
+ |
// { |
|
474 |
+ |
// @Override |
|
475 |
+ |
// public void selected( Object pSelected ) |
|
476 |
+ |
// { |
|
477 |
+ |
// System.out.println( "Tree Selected: " + pSelected ); |
|
478 |
+ |
// } |
|
479 |
+ |
// } ); |
|
480 |
+ |
// zTree.addTreeOpenCloseListener( new TreeOpenCloseListener() |
|
481 |
+ |
// { |
|
482 |
+ |
// @Override |
|
483 |
+ |
// public void openStateChanged( Boolean pOpened ) |
|
484 |
+ |
// { |
|
485 |
+ |
// System.out.println( "Tree Opened: " + pOpened + " - " + zTree.areAnyOpen() ); |
|
486 |
+ |
// } |
|
487 |
+ |
// } ); |
|
488 |
+ |
// |
|
489 |
+ |
// SizeableHorizontalPanel hPanel = new SizeableHorizontalPanel().stretchableHorizontally(); |
|
490 |
+ |
// hPanel.add( zOpenAll ); |
|
491 |
+ |
// hPanel.add( zCloseAll ); |
|
492 |
+ |
// hPanel.add( new Spacer( 10 ) ); |
|
493 |
+ |
// hPanel.add( new Label( "Some Text" ) ); |
|
494 |
+ |
// hPanel.add( Button.named( "Add" ).blue().text().add( new ClickHandler() |
|
495 |
+ |
// { |
|
496 |
+ |
// @Override |
|
497 |
+ |
// public void onClick( ClickEvent event ) |
|
498 |
+ |
// { |
|
499 |
+ |
// addTo( zTree ); |
|
500 |
+ |
// } |
|
501 |
+ |
// } ).create() ); |
|
502 |
+ |
// hPanel.add( Button.named( "Remove" ).blue().text().add( new ClickHandler() |
|
503 |
+ |
// { |
|
504 |
+ |
// @Override |
|
505 |
+ |
// public void onClick( ClickEvent event ) |
|
506 |
+ |
// { |
|
507 |
+ |
// if ( !zTree.isEmpty() ) |
|
508 |
+ |
// { |
|
509 |
+ |
// Object zUserObject = zTree.getSelected(); |
|
510 |
+ |
// if ( zUserObject == null ) |
|
511 |
+ |
// { |
|
512 |
+ |
// zUserObject = zTree.iterator().next(); |
|
513 |
+ |
// } |
|
514 |
+ |
// zTree.removeDescendant( zUserObject ); |
|
515 |
+ |
// } |
|
516 |
+ |
// } |
|
517 |
+ |
// } ).create() ); |
|
518 |
+ |
// hPanel.add( Button.named( "Remove1st" ).blue().text().add( new ClickHandler() |
|
519 |
+ |
// { |
|
520 |
+ |
// @Override |
|
521 |
+ |
// public void onClick( ClickEvent event ) |
|
522 |
+ |
// { |
|
523 |
+ |
// if ( !zTree.isEmpty() ) |
|
524 |
+ |
// { |
|
525 |
+ |
// Object zUserObject = zTree.iterator().next(); |
|
526 |
+ |
// zTree.removeChild( zUserObject ); |
|
527 |
+ |
// } |
|
528 |
+ |
// } |
|
529 |
+ |
// } ).create() ); |
|
530 |
+ |
// |
|
531 |
+ |
// SizeableVerticalPanel vPanel = new SizeableVerticalPanel().stretchable(); |
|
532 |
+ |
// vPanel.add( hPanel ); |
|
533 |
+ |
// vPanel.add( zTree ); |
|
534 |
+ |
// |
|
535 |
+ |
// return vPanel; |
|
536 |
+ |
// } |
700 |
537 |
|
|
701 |
|
- |
private Widget createCurrentTasks() |
702 |
|
- |
{ |
703 |
|
- |
return new CurrentTasks(); |
704 |
|
- |
} |
|
538 |
+ |
// private Widget createCurrentTasks() |
|
539 |
+ |
// { |
|
540 |
+ |
// return new CurrentTasks(); |
|
541 |
+ |
// } |
705 |
542 |
|
} |