private DropDownData getDropDownData() { //Set applicable flags and reference data depending upon type if ( DataType.TYPE_BOOLEAN.equals( this.fieldType ) ) { this.isDropDownDataEnum = false; this.dropDownData = DropDownData.create( new String[]{ "true", "false" } ); } else { this.isDropDownDataEnum = true; final Map<String, String> currentValueMap = new HashMap<String, String>(); if ( constraintList != null && constraintList.getConstraints() != null ) { for ( FieldConstraint con : constraintList.getConstraints() ) { if ( con instanceof SingleFieldConstraint ) { SingleFieldConstraint sfc = (SingleFieldConstraint) con; String fieldName = sfc.getFieldName(); currentValueMap.put( fieldName, sfc.getValue() ); } } } this.dropDownData = sce.getEnums( this.factType, fieldName, currentValueMap ); } return dropDownData; }
private void visitSingleFieldConstraint( SingleFieldConstraint sfc ) { InterpolationVariable var = new InterpolationVariable( sfc.getValue(), sfc.getFieldType(), factPattern.getFactType(), sfc.getFieldName() ); if ( BaseSingleFieldConstraint.TYPE_TEMPLATE == sfc.getConstraintValueType() && !vars.containsKey( var ) ) { vars.put( var, vars.size() ); } //Visit Connection constraints if ( sfc.getConnectives() != null ) { for ( int i = 0; i < sfc.getConnectives().length; i++ ) { final ConnectiveConstraint cc = sfc.getConnectives()[ i ]; InterpolationVariable ccVar = new InterpolationVariable( cc.getValue(), cc.getFieldType(), factPattern.getFactType(), cc.getFieldName() ); if ( BaseSingleFieldConstraint.TYPE_TEMPLATE == cc.getConstraintValueType() && !vars.containsKey( ccVar ) ) { vars.put( ccVar, vars.size() ); } } } }
/** * This provides an inline formula editor, not unlike a spreadsheet does. */ private Widget predicateEditor( final SingleFieldConstraint c ) { HorizontalPanel pred = new HorizontalPanel(); pred.setWidth( "100%" ); Image img = new Image( GuidedRuleEditorResources.INSTANCE.images().functionAssets() ); img.setTitle( Constants.INSTANCE.FormulaBooleanTip() ); pred.add( img ); if ( c.getValue() == null ) { c.setValue( "" ); } final TextBox box = new TextBox(); box.setText( c.getValue() ); if ( !this.readOnly ) { box.addChangeHandler( new ChangeHandler() { public void onChange( ChangeEvent event ) { setModified( true ); c.setValue( box.getText() ); getModeller().makeDirty(); } } ); box.setWidth( "100%" ); pred.add( box ); } else { pred.add( new SmallLabel( c.getValue() ) ); } return pred; }
if ( constr.getConstraintValueType() == BaseSingleFieldConstraint.TYPE_PREDICATE ) { buf.append( "eval( " ); buf.append( constr.getValue() ); buf.append( " )" ); } else { && ( constr.getValue() != null || constr.getOperator().equals( "== null" ) || constr.getOperator().equals( "!= null" ) ) ) sfexp.getOperator(), parameters, sfexp.getValue(), sfexp.getExpressionValue() ); } else { constr.getOperator(), parameters, constr.getValue(), constr.getExpressionValue() );
final String[] oldValueList = c.getValue().split( "," ); if ( oldValueList.length > 0 ) { c.setValue( oldValueList[ 0 ] );
private SingleFieldConstraint visitSingleFieldConstraint( SingleFieldConstraint sfc ) { SingleFieldConstraint clone = new SingleFieldConstraint(); clone.setConstraintValueType( sfc.getConstraintValueType() ); clone.setExpressionValue( (ExpressionFormLine) visit( sfc.getExpressionValue() ) ); clone.setFieldBinding( sfc.getFieldBinding() ); clone.setFactType( sfc.getFactType() ); clone.setFieldName( sfc.getFieldName() ); clone.setFieldType( sfc.getFieldType() ); clone.setOperator( sfc.getOperator() ); for ( Map.Entry<String, String> entry : sfc.getParameters().entrySet() ) { clone.setParameter( entry.getKey(), entry.getValue() ); } clone.setValue( sfc.getValue() ); if ( sfc.getConnectives() != null ) { clone.setConnectives( new ConnectiveConstraint[ sfc.getConnectives().length ] ); for ( int i = 0; i < sfc.getConnectives().length; i++ ) { clone.getConnectives()[ i ] = (ConnectiveConstraint) visit( sfc.getConnectives()[ i ] ); } } return clone; }
cons.getOperator() ); assertEquals( "mike", cons.getValue() ); cons.getOperator() ); assertEquals( "33 + 1", cons.getValue() ); cons.getConstraintValueType() ); assertEquals( "age > 6", cons.getValue() ); cons.getOperator() ); assertEquals( "stilton", cons.getValue() ); assertEquals( BaseSingleFieldConstraint.TYPE_LITERAL, cons.getConstraintValueType() );
cons.getOperator() ); assertEquals( "mike", cons.getValue() ); assertEquals( "$name", cons.getFieldBinding() ); cons.getOperator() ); assertEquals( "33 + 1", cons.getValue() ); assertNull( cons.getFieldBinding() ); cons.getConstraintValueType() ); assertEquals( "age > 6", cons.getValue() ); assertNull( cons.getFieldBinding() );
cons.getOperator() ); assertEquals( "mike", cons.getValue() ); cons.getOperator() ); assertEquals( "33 + 1", cons.getValue() ); cons.getConstraintValueType() ); assertEquals( "age > 6", cons.getValue() ); cons.getOperator() ); assertEquals( "stilton", cons.getValue() ); assertEquals( BaseSingleFieldConstraint.TYPE_LITERAL, cons.getConstraintValueType() );
fieldName ); if ( customFormConfiguration != null ) { Button btnCustom = new Button( con.getValue(), new ClickHandler() {
sfc.getValue() ); return;
result0Fp1Con1.getOperator() ); assertEquals( "Gargamel", result0Fp1Con1.getValue() ); result0Fp2Con1.getOperator() ); assertEquals( "$name", result0Fp2Con1.getValue() ); result0Fp2Con2.getOperator() ); assertEquals( "$age", result0Fp2Con2.getValue() ); result1Fp1Con1.getOperator() ); assertEquals( "Gargamel", result1Fp1Con1.getValue() ); result2Fp1Con1.getOperator() ); assertEquals( "Gargamel", result2Fp1Con1.getValue() );