litesoft
@ 601
litesoft / trunk / GWT_Sandbox / FormEngine / src / org / litesoft / sampleapplication / sampleApplication / client / SampleApplication.java
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
package org.litesoft.sampleapplication.sampleApplication.client; import com.google.gwt.core.client.*; import com.google.gwt.event.dom.client.*; import com.google.gwt.user.client.ui.*; import com.temp.foundation.widgets.*; import com.temp.foundation.widgets.inputfieldsupport.*; import com.temp.foundation.widgets.support.*; import com.temp.shared.validators.*; public class SampleApplication implements EntryPoint { public void onModuleLoad() { Label fieldLabel = new Label( "Name:" ); Label errorLabel = new Label( "Error" ); HTML stateLabel = new HTML( " " ); ActiveTextBox field = new ActiveTextBox(); final InputWidgetValidator<String> validator = new InputWidgetValidator<String>( new TextBoxBaseValueAdapter( field ) ); final InputWidgetChangeFilter<String> input = new InputWidgetChangeFilter<String>( validator ); input.addChangeHandler( new ChangeHandler() { @Override public void onChange( ChangeEvent event ) { String value = input.getValue(); System.out.println( "Change: " + input.isChanged() + " '" + value + "'" ); if ( "OK".equals( value ) ) { input.setValue( value ); } } } ); validator.addErrorStateChangeHandler( new ChangeHandler() { @Override public void onChange( ChangeEvent event ) { String value = input.getValue(); System.out.println( "Valid: '" + value + "' | " + validator.getErrorData() ); } } ); validator.addValidators( RequiredValueValidator.INSTANCE, // new MaxLengthValueValidator( 9 ), // IdentifierValueValidator.INSTANCE ); Button buttonSetValue = new Button( "Set Value", new ClickHandler() { public void onClick( ClickEvent event ) { input.setValue( input.getValue() ); System.out.println( "Set Value!" ); } } ); Button buttonSetValueAsUser = new Button( "User Set Value", new ClickHandler() { public void onClick( ClickEvent event ) { input.setValueAsUser( input.getValue() + "!" ); System.out.println( "User Set Value!" ); } } ); VerticalPanel zFieldErrorPanel = new VerticalPanel(); zFieldErrorPanel.add( field ); zFieldErrorPanel.add( errorLabel ); VerticalPanel zVPanel = new VerticalPanel(); zVPanel.add( new HTML( " " ) ); zVPanel.add( horizontalWithSpacers( fieldLabel, zFieldErrorPanel, stateLabel ) ); zVPanel.add( new HTML( " " ) ); zVPanel.add( horizontalWithSpacers( buttonSetValue, buttonSetValueAsUser ) ); RootPanel zRootPanel = RootPanel.get( "centeredWidget" ); zRootPanel.add( zVPanel ); zVPanel.add( new HTML( " " ) ); zVPanel.add( new HTML( " " ) ); zVPanel.add( new WizardProgressIndicator(2,"Step1", "A Really Long 2nd Step", "S3") ); } private HorizontalPanel horizontalWithSpacers( Widget... widgets ) { HorizontalPanel zPanel = new HorizontalPanel(); zPanel.add( widgets[0] ); for ( int i = 1; i < widgets.length; i++ ) { zPanel.add( new HTML( " " ) ); zPanel.add( widgets[i] ); } return zPanel; } } |
Commits for litesoft/trunk/GWT_Sandbox/FormEngine/src/org/litesoft/sampleapplication/sampleApplication/client/SampleApplication.java
Revision | Author | Commited | Message |
---|---|---|---|
601 Diff | GeorgeS | Wed 08 Feb, 2012 01:52:17 +0000 | |
600 Diff | GeorgeS | Sun 05 Feb, 2012 18:55:58 +0000 | Sync-n |
595 Diff | GeorgeS | Sat 21 Jan, 2012 16:54:12 +0000 | |
594 Diff | GeorgeS | Sat 21 Jan, 2012 00:40:54 +0000 | |
592 Diff | GeorgeS | Fri 20 Jan, 2012 20:23:50 +0000 | |
590 Diff | GeorgeS | Thu 19 Jan, 2012 23:33:20 +0000 | New FormEngine |
589 | GeorgeS | Wed 18 Jan, 2012 19:16:02 +0000 | Unchecked & FE |