private Widget fieldSelector( final ActionFieldValue val ) { return new SmallLabel( val.getField() ); }
private Widget fieldSelector( final ActionFieldValue val ) { return new SmallLabel( val.getField() ); }
private void generateSetMethodCalls( final String variableName, final ActionFieldValue[] fieldValues ) { for ( int i = 0; i < fieldValues.length; i++ ) { buf.append( indentation ); if ( isDSLEnhanced ) { buf.append( ">" ); } buf.append( variableName ); ActionFieldValue fieldValue = fieldValues[ i ]; if ( fieldValue instanceof ActionFieldFunction ) { buf.append( "." ); buf.append( fieldValue.getField() ); } else { buf.append( ".set" ); buf.append( Character.toUpperCase( fieldValues[ i ].getField().charAt( 0 ) ) ); buf.append( fieldValues[ i ].getField().substring( 1 ) ); } buf.append( "( " ); generateSetMethodCallParameterValue( buf, fieldValue ); buf.append( " );\n" ); } }
private void visitActionFieldList( ActionInsertFact afl ) { String factType = afl.getFactType(); for ( ActionFieldValue afv : afl.getFieldValues() ) { InterpolationVariable var = new InterpolationVariable( afv.getValue(), afv.getType(), factType, afv.getField() ); if ( afv.getNature() == FieldNatureType.TYPE_TEMPLATE && !vars.containsKey( var ) ) { vars.put( var, vars.size() ); } } }
private void visitActionFieldList( ActionSetField afl ) { String factType = model.getLHSBindingType( afl.getVariable() ); for ( ActionFieldValue afv : afl.getFieldValues() ) { InterpolationVariable var = new InterpolationVariable( afv.getValue(), afv.getType(), factType, afv.getField() ); if ( afv.getNature() == FieldNatureType.TYPE_TEMPLATE && !vars.containsKey( var ) ) { vars.put( var, vars.size() ); } } }
private boolean isLHSFactTypeEquivalent( String boundVariable ) { String boundFactType = modeller.getModel().getLHSBoundFact( boundVariable ).getFactType(); //If the types are SuggestionCompletionEngine.TYPE_COMPARABLE check the enums are equivalent if ( boundFactType.equals( DataType.TYPE_COMPARABLE ) ) { if ( !this.variableType.equals( DataType.TYPE_COMPARABLE ) ) { return false; } String[] dd = this.modeller.getSuggestionCompletions().getEnumValues( boundFactType, this.value.getField() ); return isEnumEquivalent( dd ); } //If the types are identical (and not SuggestionCompletionEngine.TYPE_COMPARABLE) then return true if ( boundFactType.equals( this.variableType ) ) { return true; } return false; }
private void visitActionFieldList( ActionUpdateField afl ) { String factType = model.getLHSBindingType( afl.getVariable() ); for ( ActionFieldValue afv : afl.getFieldValues() ) { InterpolationVariable var = new InterpolationVariable( afv.getValue(), afv.getType(), factType, afv.getField() ); if ( afv.getNature() == FieldNatureType.TYPE_TEMPLATE && !vars.containsKey( var ) ) { vars.put( var, vars.size() ); } } }
private boolean isRHSFieldTypeEquivalent( String boundVariable ) { String boundFactType = modeller.getModel().getRHSBoundFact( boundVariable ).getFactType(); if ( boundFactType == null ) { return false; } if ( this.variableType == null ) { return false; } //If the types are SuggestionCompletionEngine.TYPE_COMPARABLE check the enums are equivalent if ( boundFactType.equals( DataType.TYPE_COMPARABLE ) ) { if ( !this.variableType.equals( DataType.TYPE_COMPARABLE ) ) { return false; } String[] dd = this.modeller.getSuggestionCompletions().getEnumValues( boundFactType, this.value.getField() ); return isEnumEquivalent( dd ); } //If the types are identical (and not SuggestionCompletionEngine.TYPE_COMPARABLE) then return true if ( boundFactType.equals( this.variableType ) ) { return true; } return false; }
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 ActionUpdateField visitActionFieldList( ActionUpdateField afl ) { ActionUpdateField clone = new ActionUpdateField(); clone.setVariable( afl.getVariable() ); for ( ActionFieldValue afv : afl.getFieldValues() ) { ActionFieldValue afvClone = new ActionFieldValue(); afvClone.setField( afv.getField() ); afvClone.setNature( afv.getNature() ); afvClone.setType( afv.getType() ); afvClone.setValue( afv.getValue() ); clone.addFieldValue( afvClone ); } return clone; }
private ActionSetField visitActionFieldList( ActionSetField afl ) { ActionSetField clone = new ActionSetField(); clone.setVariable( afl.getVariable() ); for ( ActionFieldValue afv : afl.getFieldValues() ) { ActionFieldValue afvClone = new ActionFieldValue(); afvClone.setField( afv.getField() ); afvClone.setNature( afv.getNature() ); afvClone.setType( afv.getType() ); afvClone.setValue( afv.getValue() ); clone.addFieldValue( afvClone ); } return clone; }
private ActionInsertFact visitActionFieldList( ActionInsertFact afl ) { ActionInsertFact clone = new ActionInsertFact(); clone.setFactType( afl.getFactType() ); clone.setBoundName( afl.getBoundName() ); for ( ActionFieldValue afv : afl.getFieldValues() ) { ActionFieldValue afvClone = new ActionFieldValue(); afvClone.setField( afv.getField() ); afvClone.setNature( afv.getNature() ); afvClone.setType( afv.getType() ); afvClone.setValue( afv.getValue() ); clone.addFieldValue( afvClone ); } return clone; }
a1.getFieldValues()[ 0 ].getField() ); assertEquals( "actionsetfield1", a1.getFieldValues()[ 0 ].getValue() ); a1.getFieldValues()[ 1 ].getField() ); assertEquals( "actionsetfield2", a1.getFieldValues()[ 1 ].getValue() ); a3.getFieldValues()[ 0 ].getField() ); assertEquals( "actioninsertfact1", a3.getFieldValues()[ 0 ].getValue() ); a3.getFieldValues()[ 1 ].getField() ); assertEquals( "actioninsertfact2", a3.getFieldValues()[ 1 ].getValue() );
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; }
raif1.getFactType() ); assertEquals( "rating", raif1.getFieldValues()[ 0 ].getField() ); assertEquals( DataType.TYPE_STRING, raif1.getFieldValues()[ 0 ].getType() ); raif2.getFactType() ); assertEquals( "rating", raif2.getFieldValues()[ 0 ].getField() ); assertEquals( DataType.TYPE_STRING, raif2.getFieldValues()[ 0 ].getType() );
raif1.getFactType() ); assertEquals( "rating", raif1.getFieldValues()[ 0 ].getField() ); assertEquals( DataType.TYPE_STRING, raif1.getFieldValues()[ 0 ].getType() ); raif2.getFactType() ); assertEquals( "rating2", raif2.getFieldValues()[ 0 ].getField() ); assertEquals( DataType.TYPE_STRING, raif2.getFieldValues()[ 0 ].getType() ); raif3.getFactType() ); assertEquals( "rating", raif3.getFieldValues()[ 0 ].getField() ); assertEquals( DataType.TYPE_STRING, raif3.getFieldValues()[ 0 ].getType() );
raif1.getFactType() ); assertEquals( "rating", raif1.getFieldValues()[ 0 ].getField() ); assertEquals( DataType.TYPE_STRING, raif1.getFieldValues()[ 0 ].getType() ); raif2.getFactType() ); assertEquals( "rating", raif2.getFieldValues()[ 0 ].getField() ); assertEquals( DataType.TYPE_STRING, raif2.getFieldValues()[ 0 ].getType() );
raif1.getFactType() ); assertEquals( "rating", raif1.getFieldValues()[ 0 ].getField() ); assertEquals( DataType.TYPE_STRING, raif1.getFieldValues()[ 0 ].getType() ); raif2.getFactType() ); assertEquals( "rating", raif2.getFieldValues()[ 0 ].getField() ); assertEquals( DataType.TYPE_STRING, raif2.getFieldValues()[ 0 ].getType() );
fv.getField() ); assertEquals( "Michael", fv.getValue() );