|
@@ -1,12 +1,10 @@ |
1 |
1 |
|
package com.test.uidesign.client; |
2 |
2 |
|
|
3 |
|
- |
import org.litesoft.commonfoundation.typeutils.Objects; |
4 |
|
- |
import java.util.*; |
5 |
|
- |
|
6 |
3 |
|
import org.litesoft.GWT.client.*; |
7 |
4 |
|
import org.litesoft.GWT.client.widgets.*; |
8 |
5 |
|
import org.litesoft.GWT.forms.client.components.*; |
9 |
6 |
|
import org.litesoft.GWT.forms.client.components.impls.input.*; |
|
7 |
+ |
import org.litesoft.commonfoundation.typeutils.Objects; |
10 |
8 |
|
import org.litesoft.core.simpletypes.*; |
11 |
9 |
|
import org.litesoft.core.simpletypes.temporal.*; |
12 |
10 |
|
import org.litesoft.core.util.*; |
|
@@ -15,12 +13,12 @@ |
15 |
13 |
|
import com.google.gwt.user.client.ui.Button; |
16 |
14 |
|
import com.google.gwt.user.client.ui.*; |
17 |
15 |
|
|
18 |
|
- |
public class OrigFormComponents extends SizeableHorizontalPanel |
19 |
|
- |
{ |
|
16 |
+ |
import java.util.*; |
|
17 |
+ |
|
|
18 |
+ |
public class OrigFormComponents extends SizeableHorizontalPanel { |
20 |
19 |
|
private static final ResourceKeyNameURL ERROR_RESOURCE = new ResourceKeyNameURL( "VW2", "Volkswagen2", "common/images/misc/tmp/vw.jpg" ); |
21 |
20 |
|
|
22 |
|
- |
public OrigFormComponents() |
23 |
|
- |
{ |
|
21 |
+ |
public OrigFormComponents() { |
24 |
22 |
|
stretchable(); |
25 |
23 |
|
|
26 |
24 |
|
add( createPanel( "First Name", "My New Tooltip", // TextField |
|
@@ -41,8 +39,7 @@ |
41 |
39 |
|
String pPasswordFieldLabel, String pPasswordFieldTooltip, // |
42 |
40 |
|
String pComboBoxToolTip, // |
43 |
41 |
|
String pCheckBoxToolTip, // |
44 |
|
- |
String pRadioGroupLabel, String pRadioGroupToolTip, String[] pRadioGroupOptions ) |
45 |
|
- |
{ |
|
42 |
+ |
String pRadioGroupLabel, String pRadioGroupToolTip, String[] pRadioGroupOptions ) { |
46 |
43 |
|
SizeableVerticalPanel panel = new SizeableVerticalPanel().stretchable(); |
47 |
44 |
|
|
48 |
45 |
|
FormImageSelectBadDataType zBadDataType = |
|
@@ -50,11 +47,9 @@ |
50 |
47 |
|
panel.add( zBadDataType ); |
51 |
48 |
|
|
52 |
49 |
|
FormImageSelectURL zUrlPicker = new FormImageSelectURL( "URL Picker", null, null, false, 150, false, 150, false ); |
53 |
|
- |
zUrlPicker.addFormComponentListener( new MyListener( "ERROR" ) |
54 |
|
- |
{ |
|
50 |
+ |
zUrlPicker.addFormComponentListener( new MyListener( "ERROR" ) { |
55 |
51 |
|
|
56 |
|
- |
public void changeOccurred() |
57 |
|
- |
{ |
|
52 |
+ |
public void changeOccurred() { |
58 |
53 |
|
super.changeOccurred(); |
59 |
54 |
|
System.out.println( "'" + mCurValue + "'" ); |
60 |
55 |
|
//To change body of overridden methods use File | Settings | File Templates. |
|
@@ -85,11 +80,11 @@ |
85 |
80 |
|
panel.add( zCkBX_standalone ); |
86 |
81 |
|
|
87 |
82 |
|
final FormComboBox zCmBXfc = new FormComboBox( "Colors", null, pComboBoxToolTip ).addItems( new String[] // |
88 |
|
- |
{ // |
89 |
|
- |
"Red", // |
90 |
|
- |
"Green", // |
91 |
|
- |
"Blue", // |
92 |
|
- |
} ); |
|
83 |
+ |
{ // |
|
84 |
+ |
"Red", // |
|
85 |
+ |
"Green", // |
|
86 |
+ |
"Blue", // |
|
87 |
+ |
} ); |
93 |
88 |
|
zCmBXfc.addFormComponentListener( new MyListener( new StringKeyValuePair( "Green" ) ) ); |
94 |
89 |
|
panel.add( zCmBXfc ); |
95 |
90 |
|
|
|
@@ -168,10 +163,8 @@ |
168 |
163 |
|
// panel.add( new Spacer( 3 ) ); |
169 |
164 |
|
// |
170 |
165 |
|
final List<Enableable> zFormComponents = new ArrayList<Enableable>(); |
171 |
|
- |
for ( Object o : panel ) |
172 |
|
- |
{ |
173 |
|
- |
if ( o instanceof Enableable ) |
174 |
|
- |
{ |
|
166 |
+ |
for ( Object o : panel ) { |
|
167 |
+ |
if ( o instanceof Enableable ) { |
175 |
168 |
|
zFormComponents.add( (Enableable) o ); |
176 |
169 |
|
} |
177 |
170 |
|
} |
|
@@ -196,22 +189,16 @@ |
196 |
189 |
|
// panel.add( suggestBox ); |
197 |
190 |
|
// panel.add( new Spacer( 3 ) ); |
198 |
191 |
|
// |
199 |
|
- |
buttonSetEnabled.addClickListener( new ClickListener() |
200 |
|
- |
{ |
201 |
|
- |
public void onClick( Widget sender ) |
202 |
|
- |
{ |
203 |
|
- |
for ( Enableable zEnableable : zFormComponents ) |
204 |
|
- |
{ |
|
192 |
+ |
buttonSetEnabled.addClickListener( new ClickListener() { |
|
193 |
+ |
public void onClick( Widget sender ) { |
|
194 |
+ |
for ( Enableable zEnableable : zFormComponents ) { |
205 |
195 |
|
zEnableable.setEnabled( true ); |
206 |
196 |
|
} |
207 |
197 |
|
} |
208 |
198 |
|
} ); |
209 |
|
- |
buttonSetDisabled.addClickListener( new ClickListener() |
210 |
|
- |
{ |
211 |
|
- |
public void onClick( Widget sender ) |
212 |
|
- |
{ |
213 |
|
- |
for ( Enableable zEnableable : zFormComponents ) |
214 |
|
- |
{ |
|
199 |
+ |
buttonSetDisabled.addClickListener( new ClickListener() { |
|
200 |
+ |
public void onClick( Widget sender ) { |
|
201 |
+ |
for ( Enableable zEnableable : zFormComponents ) { |
215 |
202 |
|
zEnableable.setEnabled( false ); |
216 |
203 |
|
} |
217 |
204 |
|
// zFrmTA.disableTextArea(); |
|
@@ -276,31 +263,26 @@ |
276 |
263 |
|
return panel; |
277 |
264 |
|
} |
278 |
265 |
|
|
279 |
|
- |
private static class MyListener implements IFormComponent.Listener |
280 |
|
- |
{ |
|
266 |
+ |
private static class MyListener implements IFormComponent.Listener { |
281 |
267 |
|
protected IFormComponent mComponent; |
282 |
268 |
|
private Object mErrorValue; |
283 |
269 |
|
protected Object mOrigValue, mCurValue; |
284 |
270 |
|
private String mWhat; |
285 |
271 |
|
|
286 |
|
- |
public MyListener( Object pErrorValue ) |
287 |
|
- |
{ |
|
272 |
+ |
public MyListener( Object pErrorValue ) { |
288 |
273 |
|
mErrorValue = pErrorValue; |
289 |
274 |
|
} |
290 |
275 |
|
|
291 |
|
- |
public void add( IFormComponent pComponent ) |
292 |
|
- |
{ |
|
276 |
+ |
public void add( IFormComponent pComponent ) { |
293 |
277 |
|
mComponent = pComponent; |
294 |
278 |
|
mOrigValue = mComponent.getCurrentValue(); |
295 |
279 |
|
mWhat = Objects.justClassNameOf( mComponent ); |
296 |
280 |
|
} |
297 |
281 |
|
|
298 |
|
- |
public void remove( IFormComponent pComponent ) |
299 |
|
- |
{ |
|
282 |
+ |
public void remove( IFormComponent pComponent ) { |
300 |
283 |
|
} |
301 |
284 |
|
|
302 |
|
- |
public void changeOccurred() |
303 |
|
- |
{ |
|
285 |
+ |
public void changeOccurred() { |
304 |
286 |
|
mCurValue = mComponent.getCurrentValue(); |
305 |
287 |
|
// System.out.println( mWhat + " Change: '" + mCurValue + "'" ); |
306 |
288 |
|
printToStatusbar( mWhat + " Change: '" + mCurValue + "'" ); |
|
@@ -308,59 +290,50 @@ |
308 |
290 |
|
mComponent.setError( null ); |
309 |
291 |
|
} |
310 |
292 |
|
|
311 |
|
- |
public void blurOccurred() |
312 |
|
- |
{ |
|
293 |
+ |
public void blurOccurred() { |
313 |
294 |
|
// System.out.println( mWhat + " Blur" ); |
314 |
295 |
|
printToStatusbar( mWhat + " Blur" ); |
315 |
296 |
|
mComponent.setFocused( false ); |
316 |
297 |
|
mComponent.setError( Objects.areNonArraysEqual( mErrorValue, mCurValue ) ? "Error!" : null ); |
317 |
298 |
|
} |
318 |
299 |
|
|
319 |
|
- |
public void focusOccured() |
320 |
|
- |
{ |
|
300 |
+ |
public void focusOccured() { |
321 |
301 |
|
mComponent.setFocused( true ); |
322 |
302 |
|
// System.out.println( mWhat + " Focus" ); |
323 |
303 |
|
printToStatusbar( mWhat + " Focus" ); |
324 |
304 |
|
} |
325 |
305 |
|
|
326 |
|
- |
public void setCurrentValue( String pNewValue ) |
327 |
|
- |
{ |
|
306 |
+ |
public void setCurrentValue( String pNewValue ) { |
328 |
307 |
|
mComponent.setCurrentValue( pNewValue ); |
329 |
308 |
|
mCurValue = mOrigValue = mComponent.getCurrentValue(); |
330 |
309 |
|
mComponent.setValueChanged( false ); |
331 |
310 |
|
mComponent.setError( null ); |
332 |
311 |
|
} |
333 |
312 |
|
|
334 |
|
- |
public void enterPressed( KeyboardKeyModifier pModifiers ) |
335 |
|
- |
{ |
|
313 |
+ |
public void enterPressed( KeyboardKeyModifier pModifiers ) { |
336 |
314 |
|
} |
337 |
315 |
|
} |
338 |
316 |
|
|
339 |
|
- |
private static class MyDecimalFormatListener implements IFormComponent.Listener |
340 |
|
- |
{ |
|
317 |
+ |
private static class MyDecimalFormatListener implements IFormComponent.Listener { |
341 |
318 |
|
private IFormComponent mComponent; |
342 |
319 |
|
private Object mErrorValue; |
343 |
320 |
|
private Object mOrigValue, mCurValue; |
344 |
321 |
|
private String mWhat; |
345 |
322 |
|
|
346 |
|
- |
public MyDecimalFormatListener( Object pErrorValue ) |
347 |
|
- |
{ |
|
323 |
+ |
public MyDecimalFormatListener( Object pErrorValue ) { |
348 |
324 |
|
mErrorValue = pErrorValue; |
349 |
325 |
|
} |
350 |
326 |
|
|
351 |
|
- |
public void add( IFormComponent pComponent ) |
352 |
|
- |
{ |
|
327 |
+ |
public void add( IFormComponent pComponent ) { |
353 |
328 |
|
mComponent = pComponent; |
354 |
329 |
|
mOrigValue = mComponent.getCurrentValue(); |
355 |
330 |
|
mWhat = Objects.justClassNameOf( mComponent ); |
356 |
331 |
|
} |
357 |
332 |
|
|
358 |
|
- |
public void remove( IFormComponent pComponent ) |
359 |
|
- |
{ |
|
333 |
+ |
public void remove( IFormComponent pComponent ) { |
360 |
334 |
|
} |
361 |
335 |
|
|
362 |
|
- |
public void changeOccurred() |
363 |
|
- |
{ |
|
336 |
+ |
public void changeOccurred() { |
364 |
337 |
|
mCurValue = mComponent.getCurrentValue(); |
365 |
338 |
|
// System.out.println( mWhat + " Change: '" + mCurValue + "'" ); |
366 |
339 |
|
printToStatusbar( mWhat + " Change: '" + mCurValue + "'" ); |
|
@@ -368,8 +341,7 @@ |
368 |
341 |
|
mComponent.setError( null ); |
369 |
342 |
|
} |
370 |
343 |
|
|
371 |
|
- |
public void blurOccurred() |
372 |
|
- |
{ |
|
344 |
+ |
public void blurOccurred() { |
373 |
345 |
|
mComponent.setFocused( false ); |
374 |
346 |
|
|
375 |
347 |
|
mCurValue = mComponent.getCurrentValue(); |
|
@@ -382,51 +354,43 @@ |
382 |
354 |
|
// mComponent.setError( UtilsGwt.areNonArraysEqual( mErrorValue, mCurValue ) ? "Error!" : null ); |
383 |
355 |
|
} |
384 |
356 |
|
|
385 |
|
- |
public void focusOccured() |
386 |
|
- |
{ |
|
357 |
+ |
public void focusOccured() { |
387 |
358 |
|
mComponent.setFocused( true ); |
388 |
359 |
|
// System.out.println( mWhat + " Focus" ); |
389 |
360 |
|
printToStatusbar( mWhat + " Focus" ); |
390 |
361 |
|
} |
391 |
362 |
|
|
392 |
|
- |
public void setCurrentValue( String pNewValue ) |
393 |
|
- |
{ |
|
363 |
+ |
public void setCurrentValue( String pNewValue ) { |
394 |
364 |
|
mComponent.setCurrentValue( pNewValue ); |
395 |
365 |
|
mCurValue = mOrigValue = mComponent.getCurrentValue(); |
396 |
366 |
|
mComponent.setValueChanged( false ); |
397 |
367 |
|
mComponent.setError( null ); |
398 |
368 |
|
} |
399 |
369 |
|
|
400 |
|
- |
public void enterPressed( KeyboardKeyModifier pModifiers ) |
401 |
|
- |
{ |
|
370 |
+ |
public void enterPressed( KeyboardKeyModifier pModifiers ) { |
402 |
371 |
|
} |
403 |
372 |
|
} |
404 |
373 |
|
|
405 |
|
- |
private static class MyCurrencyFormatListener implements IFormComponent.Listener |
406 |
|
- |
{ |
|
374 |
+ |
private static class MyCurrencyFormatListener implements IFormComponent.Listener { |
407 |
375 |
|
private IFormComponent mComponent; |
408 |
376 |
|
private Object mErrorValue; |
409 |
377 |
|
private Object mOrigValue, mCurValue; |
410 |
378 |
|
private String mWhat; |
411 |
379 |
|
|
412 |
|
- |
public MyCurrencyFormatListener( Object pErrorValue ) |
413 |
|
- |
{ |
|
380 |
+ |
public MyCurrencyFormatListener( Object pErrorValue ) { |
414 |
381 |
|
mErrorValue = pErrorValue; |
415 |
382 |
|
} |
416 |
383 |
|
|
417 |
|
- |
public void add( IFormComponent pComponent ) |
418 |
|
- |
{ |
|
384 |
+ |
public void add( IFormComponent pComponent ) { |
419 |
385 |
|
mComponent = pComponent; |
420 |
386 |
|
mOrigValue = mComponent.getCurrentValue(); |
421 |
387 |
|
mWhat = Objects.justClassNameOf( mComponent ); |
422 |
388 |
|
} |
423 |
389 |
|
|
424 |
|
- |
public void remove( IFormComponent pComponent ) |
425 |
|
- |
{ |
|
390 |
+ |
public void remove( IFormComponent pComponent ) { |
426 |
391 |
|
} |
427 |
392 |
|
|
428 |
|
- |
public void changeOccurred() |
429 |
|
- |
{ |
|
393 |
+ |
public void changeOccurred() { |
430 |
394 |
|
mCurValue = mComponent.getCurrentValue(); |
431 |
395 |
|
// System.out.println( mWhat + " Change: '" + mCurValue + "'" ); |
432 |
396 |
|
printToStatusbar( mWhat + " Change: '" + mCurValue + "'" ); |
|
@@ -434,8 +398,7 @@ |
434 |
398 |
|
mComponent.setError( null ); |
435 |
399 |
|
} |
436 |
400 |
|
|
437 |
|
- |
public void blurOccurred() |
438 |
|
- |
{ |
|
401 |
+ |
public void blurOccurred() { |
439 |
402 |
|
mComponent.setFocused( false ); |
440 |
403 |
|
|
441 |
404 |
|
mCurValue = mComponent.getCurrentValue(); |
|
@@ -448,54 +411,48 @@ |
448 |
411 |
|
// mComponent.setError( UtilsGwt.areNonArraysEqual( mErrorValue, mCurValue ) ? "Error!" : null ); |
449 |
412 |
|
} |
450 |
413 |
|
|
451 |
|
- |
public void focusOccured() |
452 |
|
- |
{ |
|
414 |
+ |
public void focusOccured() { |
453 |
415 |
|
mComponent.setFocused( true ); |
454 |
416 |
|
// System.out.println( mWhat + " Focus" ); |
455 |
417 |
|
printToStatusbar( mWhat + " Focus" ); |
456 |
418 |
|
} |
457 |
419 |
|
|
458 |
|
- |
public void setCurrentValue( String pNewValue ) |
459 |
|
- |
{ |
|
420 |
+ |
public void setCurrentValue( String pNewValue ) { |
460 |
421 |
|
mComponent.setCurrentValue( pNewValue ); |
461 |
422 |
|
mCurValue = mOrigValue = mComponent.getCurrentValue(); |
462 |
423 |
|
mComponent.setValueChanged( false ); |
463 |
424 |
|
mComponent.setError( null ); |
464 |
425 |
|
} |
465 |
426 |
|
|
466 |
|
- |
public void enterPressed( KeyboardKeyModifier pModifiers ) |
467 |
|
- |
{ |
|
427 |
+ |
public void enterPressed( KeyboardKeyModifier pModifiers ) { |
468 |
428 |
|
} |
469 |
429 |
|
} |
470 |
430 |
|
|
471 |
|
- |
private static class MyResourceProvider implements ResourceKeyNameURLprovider |
472 |
|
- |
{ |
|
431 |
+ |
private static class MyResourceProvider implements ResourceKeyNameURLprovider { |
473 |
432 |
|
|
474 |
|
- |
public ResourceKeyNameURL[] getLocalResourceKeyNameURLs() |
475 |
|
- |
{ |
476 |
|
- |
return new ResourceKeyNameURL[]{new ResourceKeyNameURL( "AU", "Audi", "common/images/misc/tmp/audi.jpg" ),// |
477 |
|
- |
new ResourceKeyNameURL( "BM", "BMW", "common/images/misc/tmp/bmw.jpg" ),// |
478 |
|
- |
new ResourceKeyNameURL( "CH", "Chevrolet", "common/images/misc/tmp/chevy.jpg" ),// |
479 |
|
- |
new ResourceKeyNameURL( "FD", "Ford", "common/images/misc/tmp/ford.jpg" ),// |
480 |
|
- |
new ResourceKeyNameURL( "JA", "Jaguar", "common/images/misc/tmp/jag.jpg" ),// |
481 |
|
- |
new ResourceKeyNameURL( "MZ", "Mazda", "common/images/misc/tmp/mazda.jpg" ),// |
482 |
|
- |
new ResourceKeyNameURL( "MB", "Mercedes-Benz", "common/images/misc/tmp/mbenz.jpg" ),// |
483 |
|
- |
new ResourceKeyNameURL( "NS", "Nissan", "common/images/misc/tmp/nissan.jpg" ),// |
484 |
|
- |
new ResourceKeyNameURL( "TT", "Tata", "common/images/misc/tmp/tata.jpg" ),// |
485 |
|
- |
new ResourceKeyNameURL( "VW", "Volkswagen", "common/images/misc/tmp/vw.jpg" ),// |
486 |
|
- |
ERROR_RESOURCE,// |
|
433 |
+ |
public ResourceKeyNameURL[] getLocalResourceKeyNameURLs() { |
|
434 |
+ |
return new ResourceKeyNameURL[]{ |
|
435 |
+ |
new ResourceKeyNameURL( "AU", "Audi", "common/images/misc/tmp/audi.jpg" ),// |
|
436 |
+ |
new ResourceKeyNameURL( "BM", "BMW", "common/images/misc/tmp/bmw.jpg" ),// |
|
437 |
+ |
new ResourceKeyNameURL( "CH", "Chevrolet", "common/images/misc/tmp/chevy.jpg" ),// |
|
438 |
+ |
new ResourceKeyNameURL( "FD", "Ford", "common/images/misc/tmp/ford.jpg" ),// |
|
439 |
+ |
new ResourceKeyNameURL( "JA", "Jaguar", "common/images/misc/tmp/jag.jpg" ),// |
|
440 |
+ |
new ResourceKeyNameURL( "MZ", "Mazda", "common/images/misc/tmp/mazda.jpg" ),// |
|
441 |
+ |
new ResourceKeyNameURL( "MB", "Mercedes-Benz", "common/images/misc/tmp/mbenz.jpg" ),// |
|
442 |
+ |
new ResourceKeyNameURL( "NS", "Nissan", "common/images/misc/tmp/nissan.jpg" ),// |
|
443 |
+ |
new ResourceKeyNameURL( "TT", "Tata", "common/images/misc/tmp/tata.jpg" ),// |
|
444 |
+ |
new ResourceKeyNameURL( "VW", "Volkswagen", "common/images/misc/tmp/vw.jpg" ),// |
|
445 |
+ |
ERROR_RESOURCE,// |
487 |
446 |
|
}; |
488 |
447 |
|
} |
489 |
448 |
|
|
490 |
449 |
|
public void requestResourceKeyNameURLs( ResourceKeyNameURLsAvailableCallback pCallback ) |
491 |
|
- |
throws UnsupportedOperationException |
492 |
|
- |
{ |
|
450 |
+ |
throws UnsupportedOperationException { |
493 |
451 |
|
//To change body of implemented methods use File | Settings | File Templates. |
494 |
452 |
|
} |
495 |
453 |
|
} |
496 |
454 |
|
|
497 |
|
- |
private static void printToStatusbar( String pMessage ) |
498 |
|
- |
{ |
|
455 |
+ |
private static void printToStatusbar( String pMessage ) { |
499 |
456 |
|
String current = StatusBar.get(); |
500 |
457 |
|
StatusBar.set( pMessage + " | " + current ); |
501 |
458 |
|
} |