public BoundTextBox( final BaseSingleFieldConstraint c ) { setStyleName( "constraint-value-Editor" ); //NON-NLS if ( c.getValue() == null ) { setText( "" ); } else { setText( c.getValue() ); } String v = c.getValue(); if ( c.getValue() == null || v.length() < 7 ) { setVisibleLength( 8 ); } else { setVisibleLength( v.length() + 1 ); } addChangeHandler( new ChangeHandler() { public void onChange( ChangeEvent event ) { c.setValue( getText() ); } } ); addKeyUpHandler( new KeyUpHandler() { public void onKeyUp( KeyUpEvent event ) { int length = getText().length(); setVisibleLength( length > 0 ? length : 1 ); } } ); } }
public void onKeyUp( KeyUpEvent event ) { int length = getText().length(); setVisibleLength( length > 0 ? length : 1 ); } } );
public void onChange( ChangeEvent event ) { c.setValue( getText() ); } } );
/** * An editor for the retval "formula" (expression). */ private Widget returnValueEditor() { TextBox box = new BoundTextBox( constraint ); if ( this.readOnly ) { return new SmallLabel( box.getText() ); } String msg = Constants.INSTANCE.FormulaEvaluateToAValue(); Image img = new Image( GuidedRuleEditorResources.INSTANCE.images().functionAssets() ); img.setTitle( msg ); box.setTitle( msg ); box.addChangeHandler( new ChangeHandler() { public void onChange( ChangeEvent event ) { executeOnValueChangeCommand(); } } ); Widget ed = widgets( img, box ); return ed; }