@Test public void testOnChangeCallbackRegisteredForActionValueEditor() throws Exception { final ActionFieldValue value = new ActionFieldValue(); value.setNature(FieldNatureType.TYPE_LITERAL); value.setField("a"); final ActionValueEditor editor = mock(ActionValueEditor.class); doReturn(editor).when(testedWidget).actionValueEditor(any(), eq(value), any(), anyBoolean()); final ActionFieldValue valueTwo = new ActionFieldValue(); valueTwo.setNature(FieldNatureType.TYPE_LITERAL); valueTwo.setField("b"); final ActionValueEditor editorTwo = mock(ActionValueEditor.class); doReturn(editorTwo).when(testedWidget).actionValueEditor(any(), eq(valueTwo), any(), anyBoolean()); testedWidget.valueEditor(value); testedWidget.valueEditor(valueTwo); verify(editor).setOnChangeCommand(commandCaptor.capture()); commandCaptor.getValue().execute(); verify(testedWidget).setModified(true); verify(editorTwo).refresh(); }
ActionValueEditor valueEditor(final ActionFieldValue actionFieldValue) { AsyncPackageDataModelOracle oracle = this.getModeller().getDataModelOracle(); String type = ""; if (oracle.isGlobalVariable(this.model.getVariable())) { type = oracle.getGlobalVariable(this.model.getVariable()); } else { type = this.getModeller().getModel().getLHSBindingType(this.model.getVariable()); if (type == null && !this.readOnly) { type = this.getModeller().getModel().getRHSBoundFact(this.model.getVariable()).getFactType(); } } ActionValueEditor actionValueEditor = actionValueEditor(type, actionFieldValue, model.getFieldValues(), readOnly); actionValueEditor.setOnChangeCommand(new Command() { public void execute() { RefreshUtil.refreshActionValueEditorsDropDownData(actionValueEditors, actionFieldValue); setModified(true); } }); actionValueEditors.put(actionFieldValue, actionValueEditor); return actionValueEditor; }
ActionSetFieldWidget extends RuleModellerWidget { ActionValueEditor valueEditor(final ActionFieldValue actionFieldValue) { AsyncPackageDataModelOracle oracle = this.getModeller().getDataModelOracle(); String type = ""; if (oracle.isGlobalVariable(this.model.getVariable())) { type = oracle.getGlobalVariable(this.model.getVariable()); } else { type = this.getModeller().getModel().getLHSBindingType(this.model.getVariable()); if (type == null && !this.readOnly) { type = this.getModeller().getModel().getRHSBoundFact(this.model.getVariable()).getFactType(); } } ActionValueEditor actionValueEditor = actionValueEditor(type, actionFieldValue, model.getFieldValues(), readOnly); actionValueEditor.setOnChangeCommand(new Command() { public void execute() { RefreshUtil.refreshActionValueEditorsDropDownData(actionValueEditors, actionFieldValue); setModified(true); } }); actionValueEditors.put(actionFieldValue, actionValueEditor); return actionValueEditor; } }
ActionSetFieldWidget extends RuleModellerWidget { ActionValueEditor valueEditor(final ActionFieldValue actionFieldValue) { AsyncPackageDataModelOracle oracle = this.getModeller().getDataModelOracle(); String type = ""; if (oracle.isGlobalVariable(this.model.getVariable())) { type = oracle.getGlobalVariable(this.model.getVariable()); } else { type = this.getModeller().getModel().getLHSBindingType(this.model.getVariable()); if (type == null && !this.readOnly) { type = this.getModeller().getModel().getRHSBoundFact(this.model.getVariable()).getFactType(); } } ActionValueEditor actionValueEditor = actionValueEditor(type, actionFieldValue, model.getFieldValues(), readOnly); actionValueEditor.setOnChangeCommand(new Command() { public void execute() { RefreshUtil.refreshActionValueEditorsDropDownData(actionValueEditors, actionFieldValue); setModified(true); } }); actionValueEditors.put(actionFieldValue, actionValueEditor); return actionValueEditor; } ActionSetFieldWidget(RuleModeller mod,
                                EventBus eventBus,
                                ActionSetField set,
                                Boolean readOnly); }
ActionSetFieldWidget extends RuleModellerWidget { ActionValueEditor valueEditor(final ActionFieldValue actionFieldValue) { AsyncPackageDataModelOracle oracle = this.getModeller().getDataModelOracle(); String type = ""; if (oracle.isGlobalVariable(this.model.getVariable())) { type = oracle.getGlobalVariable(this.model.getVariable()); } else { type = this.getModeller().getModel().getLHSBindingType(this.model.getVariable()); if (type == null && !this.readOnly) { type = this.getModeller().getModel().getRHSBoundFact(this.model.getVariable()).getFactType(); } } ActionValueEditor actionValueEditor = actionValueEditor(type, actionFieldValue, model.getFieldValues(), readOnly); actionValueEditor.setOnChangeCommand(new Command() { public void execute() { RefreshUtil.refreshActionValueEditorsDropDownData(actionValueEditors, actionFieldValue); setModified(true); } }); actionValueEditors.put(actionFieldValue, actionValueEditor); return actionValueEditor; } ActionSetFieldWidget(RuleModeller mod,
                                EventBus eventBus,
                                ActionSetField set,
                                Boolean readOnly); boolean isBoundFact(); @Override boolean isReadOnly(); @Override boolean isFactTypeKnown(); }
ActionSetFieldWidget extends RuleModellerWidget { ActionValueEditor valueEditor(final ActionFieldValue actionFieldValue) { AsyncPackageDataModelOracle oracle = this.getModeller().getDataModelOracle(); String type = ""; if (oracle.isGlobalVariable(this.model.getVariable())) { type = oracle.getGlobalVariable(this.model.getVariable()); } else { type = this.getModeller().getModel().getLHSBindingType(this.model.getVariable()); if (type == null && !this.readOnly) { type = this.getModeller().getModel().getRHSBoundFact(this.model.getVariable()).getFactType(); } } ActionValueEditor actionValueEditor = actionValueEditor(type, actionFieldValue, model.getFieldValues(), readOnly); actionValueEditor.setOnChangeCommand(new Command() { public void execute() { RefreshUtil.refreshActionValueEditorsDropDownData(actionValueEditors, actionFieldValue); setModified(true); } }); actionValueEditors.put(actionFieldValue, actionValueEditor); return actionValueEditor; } ActionSetFieldWidget(RuleModeller mod,
                                EventBus eventBus,
                                ActionSetField set,
                                Boolean readOnly); boolean isBoundFact(); @Override boolean isReadOnly(); @Override boolean isFactTypeKnown();  }