@Override public RuleModel getContent() { return modeller.getModel(); }
private RuleModel getRuleModel() { return this.getModeller().getModel(); }
private List<String> getApplicableBindings() { List<String> bindings = new ArrayList<String>(); //Examine LHS Fact and Field bindings and RHS (new) Fact bindings for ( String v : modeller.getModel().getAllVariables() ) { //LHS FactPattern FactPattern fp = modeller.getModel().getLHSBoundFact( v ); if ( fp != null ) { if ( isLHSFactTypeEquivalent( v ) ) { bindings.add( v ); } } //LHS FieldConstraint FieldConstraint fc = modeller.getModel().getLHSBoundField( v ); if ( fc != null ) { if ( isLHSFieldTypeEquivalent( v ) ) { bindings.add( v ); } } //RHS ActionInsertFact ActionInsertFact aif = modeller.getModel().getRHSBoundFact( v ); if ( aif != null ) { if ( isRHSFieldTypeEquivalent( v ) ) { bindings.add( v ); } } } return bindings; }
private boolean isLHSFieldTypeEquivalent( String boundVariable ) { String boundFieldType = modeller.getModel().getLHSBindingType( boundVariable ); //If the fieldTypes are SuggestionCompletionEngine.TYPE_COMPARABLE check the enums are equivalent if ( boundFieldType.equals( DataType.TYPE_COMPARABLE ) ) { if ( !this.variableType.equals( DataType.TYPE_COMPARABLE ) ) { return false; } FieldConstraint fc = this.modeller.getModel().getLHSBoundField( boundVariable ); if ( fc instanceof SingleFieldConstraint ) { String fieldName = ( (SingleFieldConstraint) fc ).getFieldName(); String parentFactTypeForBinding = this.modeller.getModel().getLHSParentFactPatternForBinding( boundVariable ).getFactType(); String[] dd = this.modeller.getSuggestionCompletions().getEnumValues( parentFactTypeForBinding, fieldName ); return isEnumEquivalent( dd ); } return false; } //If the fieldTypes are identical (and not SuggestionCompletionEngine.TYPE_COMPARABLE) then return true if ( boundFieldType.equals( this.variableType ) ) { return true; } return false; }
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 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; }
public ActionValueEditor( final ActionFieldValue val, final DropDownData enums, RuleModeller modeller, EventBus eventBus, String variableType, boolean readOnly ) { this.readOnly = readOnly; if ( val.getType().equals( DataType.TYPE_BOOLEAN ) ) { this.enums = DropDownData.create( new String[]{ "true", "false" } ); } else { this.enums = enums; } this.root = new SimplePanel(); this.value = val; this.modeller = modeller; this.model = modeller.getModel(); this.eventBus = eventBus; this.variableType = variableType; refresh(); initWidget( root ); }
public void onClick( ClickEvent event ) { if ( Window.confirm( Constants.INSTANCE.RemoveThisItem() ) ) { model.removeField( idx ); setModified( true ); getModeller().refreshWidget(); //Signal possible change in Template variables TemplateVariablesChangedEvent tvce = new TemplateVariablesChangedEvent( getModeller().getModel() ); getEventBus().fireEventFromSource( tvce, getModeller().getModel() ); } } } );
public void onClick( ClickEvent event ) { if ( Window.confirm( Constants.INSTANCE.RemoveThisItem() ) ) { model.removeField( idx ); setModified( true ); getModeller().refreshWidget(); //Signal possible change in Template variables TemplateVariablesChangedEvent tvce = new TemplateVariablesChangedEvent( getModeller().getModel() ); getEventBus().fireEventFromSource( tvce, getModeller().getModel() ); } } } );
List<String> vars = model.getModel().getLHSBoundFacts(); for ( String v : vars ) { FactPattern factPattern = model.getModel().getLHSBoundFact( v ); if ( factPattern.getFactType().equals( this.methodParameter.getType() ) ) { List<String> vars2 = model.getModel().getRHSBoundFacts(); for ( String v : vars2 ) { ActionInsertFact factPattern = model.getModel().getRHSBoundFact( v ); if ( factPattern.getFactType().equals( this.methodParameter.getType() ) ) {
private Widget getSetterLabel() { ClickHandler clk = new ClickHandler() { public void onClick( ClickEvent event ) { //Widget w = (Widget)event.getSource(); showAddFieldPopup( event ); } }; String modifyType = "set"; if ( this.model instanceof ActionUpdateField) { modifyType = "modify"; } String type = this.getModeller().getModel().getLHSBindingType( model.getVariable() ); String descFact = ( type != null ) ? type + " <b>[" + model.getVariable() + "]</b>" : model.getVariable(); String sl = Constants.INSTANCE.setterLabel( HumanReadable.getActionDisplayName(modifyType), descFact ); return new ClickableLabel( sl, clk, !this.readOnly );//HumanReadable.getActionDisplayName(modifyType) + " value of <b>[" + model.variable + "]</b>", clk); }
List<String> vars = model.getModel().getLHSBoundFacts(); List<String> vars2 = model.getModel().getRHSBoundFacts(); for ( String i : vars2 ) { vars.add( i ); Button variable = new Button( Constants.INSTANCE.BoundVariable() ); if ( vars2.contains( v ) == false ) { FactPattern factPattern = model.getModel().getLHSBoundFact( v ); if ( factPattern.getFactType().equals( this.parameterType ) ) { createButton = true; ActionInsertFact factPattern = model.getModel().getRHSBoundFact( v ); if ( factPattern.getFactType().equals( this.parameterType ) ) { createButton = true;
public ActionRetractFactWidget( RuleModeller modeller, EventBus eventBus, ActionRetractFact model, Boolean readOnly ) { super( modeller, eventBus ); HorizontalPanel layout = new HorizontalPanel(); layout.setWidth( "100%" ); layout.setStyleName( "model-builderInner-Background" ); this.isFactTypeKnown = modeller.getSuggestionCompletions().isFactTypeRecognized( modeller.getModel().getLHSBindingType( model.getVariableName() ) ); if ( readOnly == null ) { this.readOnly = !this.isFactTypeKnown; } else { this.readOnly = readOnly; } if ( this.readOnly ) { layout.addStyleName( "editor-disabled-widget" ); } String desc = modeller.getModel().getLHSBindingType( model.getVariableName() ) + " [" + model.getVariableName() + "]"; layout.add( new SmallLabel( HumanReadable.getActionDisplayName("retract") + " <b>" + desc + "</b>" ) ); //This widget couldn't be modified. this.setModified( false ); initWidget( layout ); }
FactPattern pattern = mod.getModel().getLHSBoundFact( set.getVariable() ); if ( pattern != null ) { List<String> methodList = completions.getMethodNames( pattern.getFactType() ); ActionInsertFact patternRhs = mod.getModel().getRHSBoundFact( set.getVariable() ); if ( patternRhs != null ) { List<String> methodList = completions.getMethodNames( patternRhs.getFactType() );
private Widget valueEditor( final ActionFieldFunction 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() ); if ( type == null ) { type = this.getModeller().getModel().getRHSBoundFact( this.model.getVariable() ).getFactType(); } } DropDownData enums = completions.getEnums( type, val.getField(), FieldNatureUtil.toMap( this.model.getFieldValues() ) ); return new MethodParameterValueEditor( val, enums, this.getModeller(), val.getType(), new Command() { public void execute() { setModified( true ); } } ); }
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; }
this.variableClass = completions.getGlobalVariable( set.getVariable() ); } else { String type = mod.getModel().getLHSBindingType( set.getVariable() ); if ( type != null ) { this.fieldCompletions = completions.getFieldCompletions( FieldAccessorsAndMutators.MUTATOR, this.isBoundFact = true; } else { ActionInsertFact patternRhs = mod.getModel().getRHSBoundFact( set.getVariable() ); if ( patternRhs != null ) { this.fieldCompletions = completions.getFieldCompletions( FieldAccessorsAndMutators.MUTATOR,
eventBus ); this.isFactTypeKnown = modeller.getSuggestionCompletions().isFactTypeRecognized( modeller.getModel().getLHSBindingType( action.getFactName() ) ); if ( readOnly == null ) { this.readOnly = !this.isFactTypeKnown;
if ( bindable || !( modeller.getModel().isBoundFactUsed( pattern.getBoundName() ) ) ) { HorizontalPanel varName = new HorizontalPanel(); final TextBox varTxt = new BindingTextBox();
this.constraintList = constraintList; this.sce = modeller.getSuggestionCompletions(); this.model = modeller.getModel();