/** * An editor for formula * @return */ private Widget formulaEditor() { if ( this.readOnly ) { return new SmallLabel( assertValue() ); } final TextBox box = new TextBox(); box.addValueChangeHandler( new ValueChangeHandler<String>() { @Override public void onValueChange( ValueChangeEvent<String> event ) { value.setValue( event.getValue() ); executeOnChangeCommand(); } } ); //FireEvents as the box could assume a default value box.setValue( assertValue(), true ); attachDisplayLengthHandler( box ); return box; }
private void doTypeChosen( FormStylePopup form ) { doTypeChosen(); form.hide(); }
private void doTypeChosen() { makeDirty(); executeOnChangeCommand(); executeOnTemplateVariablesChange(); refresh(); }
root.add( choice() ); return; Widget box = wrap( templateKeyEditor() ); root.add( box ); return; Widget list = wrap( boundVariable() ); root.add( list ); return; Widget list = wrap( enumEditor() ); root.add( list ); return; Widget box = wrap( formulaEditor() ); root.add( box ); return; Widget box = wrap( literalEditor() ); root.add( box );
private Widget valueEditor( final ActionFieldValue val ) { DataModelOracle completions = this.getModeller().getSuggestionCompletions(); DropDownData enums = completions.getEnums( this.factType, val.getField(), FieldNatureUtil.toMap( this.model.getFieldValues() ) ); ActionValueEditor actionValueEditor = new ActionValueEditor( val, enums, this.getModeller(), this.getEventBus(), val.getType(), this.readOnly ); actionValueEditor.setOnChangeCommand( new Command() { public void execute() { setModified( true ); } } ); return actionValueEditor; }
private Widget enumEditor() { if ( this.readOnly ) { return new SmallLabel( assertValue() ); } EnumDropDown enumDropDown = new EnumDropDown( value.getValue(), new DropDownValueChanged() { public void valueChanged( String newText, String newValue ) { value.setValue( newValue ); executeOnChangeCommand(); makeDirty(); } }, enums ); return enumDropDown; }
private Widget valueEditor( final ActionFieldValue val ) { DataModelOracle completions = this.getModeller().getSuggestionCompletions(); String type = ""; if ( completions.isGlobalVariable( this.model.getVariable() ) ) { type = completions.getGlobalVariable( this.model.getVariable() ); } else { type = this.getModeller().getModel().getLHSBindingType( this.model.getVariable() ); /* * to take in account if the using a rhs bound variable */ if ( type == null && !this.readOnly ) { type = this.getModeller().getModel().getRHSBoundFact( this.model.getVariable() ).getFactType(); } } DropDownData enums = completions.getEnums( type, val.getField(), FieldNatureUtil.toMap( this.model.getFieldValues() ) ); ActionValueEditor actionValueEditor = new ActionValueEditor( val, enums, this.getModeller(), this.getEventBus(), val.getType(), this.readOnly ); actionValueEditor.setOnChangeCommand( new Command() { public void execute() { setModified( true ); } } ); return actionValueEditor; }
/** * An editor for Template Keys */ private Widget templateKeyEditor() { if ( this.readOnly ) { return new SmallLabel( assertValue() ); } TemplateKeyTextBox box = new TemplateKeyTextBox(); box.addValueChangeHandler( new ValueChangeHandler<String>() { @Override public void onValueChange( ValueChangeEvent<String> event ) { value.setValue( event.getValue() ); executeOnChangeCommand(); } } ); //FireEvents as the box could assume a default value box.setValue( assertValue(), true ); attachDisplayLengthHandler( box ); return box; }
private Widget literalEditor() { if ( this.readOnly ) { return new SmallLabel( assertValue() ); } //Date picker if ( DataType.TYPE_DATE.equals( value.getType() ) ) { final PopupDatePicker dp = new PopupDatePicker( false ); // Wire up update handler dp.addValueChangeHandler( new ValueChangeHandler<Date>() { public void onValueChange( ValueChangeEvent<Date> event ) { value.setValue( PopupDatePicker.convertToString( event ) ); } } ); dp.setValue( assertValue() ); return dp; } //Default editor for all other literals final TextBox box = TextBoxFactory.getTextBox( value.getType() ); box.setStyleName( "constraint-value-Editor" ); box.addChangeHandler( new ChangeHandler() { public void onChange( ChangeEvent event ) { value.setValue( box.getText() ); executeOnChangeCommand(); makeDirty(); } } ); box.setText( assertValue() ); attachDisplayLengthHandler( box ); return box; }