private Widget valueEditor( final SingleFieldConstraint c ) { //Create a new ConstraintValueEditor ConstraintValueEditor constraintValueEditor = new ConstraintValueEditor( c, pattern.getConstraintList(), this.getModeller(), this.getEventBus(), this.readOnly ); constraintValueEditor.setOnValueChangeCommand( new Command() { public void execute() { setModified( true ); refreshConstraintValueEditorsDropDownData( c ); } } ); //Keep a reference to the value editors so they can be refreshed for dependent enums constraintValueEditors.put( c, constraintValueEditor ); return constraintValueEditor; }
private void doTypeChosen( final FormStylePopup form ) { doTypeChosen(); form.hide(); }
private void doTypeChosen() { executeOnValueChangeCommand(); executeOnTemplateVariablesChange(); refreshEditor(); }
getDropDownData(); case SingleFieldConstraint.TYPE_LITERAL: case SingleFieldConstraint.TYPE_ENUM: constraintWidget = wrap( literalEditor() ); break; case SingleFieldConstraint.TYPE_RET_VALUE: constraintWidget = wrap( returnValueEditor() ); break; case SingleFieldConstraint.TYPE_EXPR_BUILDER_VALUE: constraintWidget = wrap( expressionEditor() ); break; case SingleFieldConstraint.TYPE_VARIABLE: constraintWidget = wrap( variableEditor() ); break; case BaseSingleFieldConstraint.TYPE_TEMPLATE: constraintWidget = wrap( templateKeyEditor() ); break; default:
CustomFormConfiguration customFormConfiguration = getWorkingSetManager().getCustomFormConfiguration( modeller.getPath(), factType, fieldName ); return new SmallLabel( assertValue() ); box.setText( assertValue() ); attachDisplayLengthHandler( box ); return box; dp.setValue( assertValue() ); return dp; box.setText( assertValue() ); attachDisplayLengthHandler( box ); return box;
final BaseSingleFieldConstraint con ) { CustomFormConfiguration customFormConfiguration = getWorkingSetManager().getCustomFormConfiguration( modeller.getPath(), factType, fieldName ); widgets( lit, new InfoPopup( Constants.INSTANCE.LiteralValue(), Constants.INSTANCE.LiteralValTip() ) ) ); widgets( templateKeyButton, new InfoPopup( templateKeyLabel, Constants.INSTANCE.LiteralValTip() ) ) ); List<String> applicableBindingsInScope = getApplicableBindingsInScope( bindingsInScope ); if ( applicableBindingsInScope.size() > 0 ) { widgets( variable, new InfoPopup( Constants.INSTANCE.ABoundVariable(), Constants.INSTANCE.BoundVariableTip() ) ) ); widgets( formula, new InfoPopup( Constants.INSTANCE.AFormula(), Constants.INSTANCE.FormulaExpressionTip() ) ) ); widgets( expression, new InfoPopup( Constants.INSTANCE.ExpressionEditor(), Constants.INSTANCE.ExpressionEditor() ) ) );
/** * An editor for Template Keys */ private Widget templateKeyEditor() { if ( this.readOnly ) { return new SmallLabel( assertValue() ); } TemplateKeyTextBox box = new TemplateKeyTextBox(); box.setStyleName( "constraint-value-Editor" ); box.addValueChangeHandler( new ValueChangeHandler<String>() { @Override public void onValueChange( ValueChangeEvent<String> event ) { constraint.setValue( event.getValue() ); executeOnValueChangeCommand(); } } ); //FireEvents as the box could assume a default value box.setValue( assertValue(), true ); attachDisplayLengthHandler( box ); return box; }
private Widget connectiveValueEditor( final BaseSingleFieldConstraint con ) { return new ConstraintValueEditor( con, pattern.getConstraintList(), this.modeller, this.eventBus, isReadOnly ); }
/** * Refresh the displayed drop-down */ public void refreshDropDownData() { if ( this.dropDownData == null ) { return; } if ( this.constraintWidget instanceof HorizontalPanel ) { HorizontalPanel hp = (HorizontalPanel) this.constraintWidget; for ( int iChildIndex = 0; iChildIndex < hp.getWidgetCount(); iChildIndex++ ) { Widget w = hp.getWidget( iChildIndex ); if ( w instanceof EnumDropDown ) { EnumDropDown edd = (EnumDropDown) w; edd.setDropDownData( constraint.getValue(), getDropDownData() ); } } } }
private Widget variableEditor() { if ( this.readOnly ) { return new SmallLabel( this.constraint.getValue() ); } final ListBox box = new ListBox(); box.addItem( Constants.INSTANCE.Choose() ); List<String> bindingsInScope = this.model.getBoundVariablesInScope( this.constraint ); List<String> applicableBindingsInScope = getApplicableBindingsInScope( bindingsInScope ); for ( String var : applicableBindingsInScope ) { box.addItem( var ); if ( this.constraint.getValue() != null && this.constraint.getValue().equals( var ) ) { box.setSelectedIndex( box.getItemCount() - 1 ); } } box.addChangeHandler( new ChangeHandler() { public void onChange( ChangeEvent event ) { executeOnValueChangeCommand(); int selectedIndex = box.getSelectedIndex(); if ( selectedIndex > 0 ) { constraint.setValue( box.getItemText( selectedIndex ) ); } else { constraint.setValue( null ); } } } ); return box; }