use of org.drools.workbench.models.guided.dtable.shared.model.ActionCol52 in project drools-wb by kiegroup.
the class ActionInsertFactFieldsPage method initialise.
@Override
public void initialise() {
view.init(this);
view.setValidator(getValidator());
patternToActionsMap.clear();
// Set-up validator for the pattern-to-action mapping voodoo
getValidator().setPatternToActionInsertFactFieldsMap(patternToActionsMap);
// Set-up a factory for value editors
view.setDTCellValueWidgetFactory(DTCellValueWidgetFactory.getInstance(model, oracle, false, allowEmptyValues()));
// Available types
final List<String> availableTypes = Arrays.asList(oracle.getFactTypes());
view.setAvailableFactTypes(availableTypes);
// Existing ActionInsertFactCols (should be empty for a new Decision Table)
for (ActionCol52 a : model.getActionCols()) {
if (a instanceof ActionInsertFactCol52) {
final ActionInsertFactCol52 aif = (ActionInsertFactCol52) a;
final ActionInsertFactFieldsPattern p = lookupExistingInsertFactPattern(aif.getBoundName());
final List<ActionInsertFactCol52> actions = patternToActionsMap.get(p);
getValidator().addActionPattern(p);
actions.add(aif);
}
}
view.setChosenPatterns(new ArrayList<ActionInsertFactFieldsPattern>());
view.setAvailableFields(new ArrayList<AvailableField>());
view.setChosenFields(new ArrayList<ActionInsertFactCol52>());
content.setWidget(view);
}
use of org.drools.workbench.models.guided.dtable.shared.model.ActionCol52 in project drools-wb by kiegroup.
the class ActionSetFieldsPage method initialise.
@Override
public void initialise() {
view.init(this);
view.setValidator(getValidator());
patternToActionsMap.clear();
// Set-up validator for the pattern-to-action mapping voodoo
getValidator().setPatternToActionSetFieldsMap(patternToActionsMap);
// Set-up a factory for value editors
view.setDTCellValueWidgetFactory(DTCellValueWidgetFactory.getInstance(model, oracle, false, allowEmptyValues()));
// Existing ActionSetFieldCols (should be empty for a new Decision Table)
for (ActionCol52 a : model.getActionCols()) {
if (a instanceof ActionSetFieldCol52) {
final ActionSetFieldCol52 asf = (ActionSetFieldCol52) a;
final Pattern52 p = model.getConditionPattern(asf.getBoundName());
if (!patternToActionsMap.containsKey(p)) {
patternToActionsMap.put(p, new ArrayList<ActionSetFieldCol52>());
}
final List<ActionSetFieldCol52> actions = patternToActionsMap.get(p);
actions.add(asf);
}
}
view.setChosenFields(new ArrayList<ActionSetFieldCol52>());
content.setWidget(view);
}
use of org.drools.workbench.models.guided.dtable.shared.model.ActionCol52 in project drools-wb by kiegroup.
the class RowExpander method addActionColumns.
private void addActionColumns() {
for (ActionCol52 a : model.getActionCols()) {
if (a instanceof ActionSetFieldCol52) {
ActionSetFieldCol52 afc = (ActionSetFieldCol52) a;
addColumn(afc);
} else if (a instanceof ActionInsertFactCol52) {
ActionInsertFactCol52 aif = (ActionInsertFactCol52) a;
addColumn(aif);
}
}
}
use of org.drools.workbench.models.guided.dtable.shared.model.ActionCol52 in project drools-wb by kiegroup.
the class ActionWorkItemSetFieldPluginTest method testGetAlreadyUsedColumnNames.
@Test
public void testGetAlreadyUsedColumnNames() throws Exception {
final GuidedDecisionTable52 model = new GuidedDecisionTable52();
model.getActionCols().add(new ActionCol52() {
{
setHeader("a");
}
});
model.getActionCols().add(new ActionCol52() {
{
setHeader("b");
}
});
when(presenter.getModel()).thenReturn(model);
assertEquals(2, plugin.getAlreadyUsedColumnHeaders().size());
assertTrue(plugin.getAlreadyUsedColumnHeaders().contains("a"));
assertTrue(plugin.getAlreadyUsedColumnHeaders().contains("b"));
}
use of org.drools.workbench.models.guided.dtable.shared.model.ActionCol52 in project drools-wb by kiegroup.
the class ActionWorkItemSetFieldPluginTest method testSetupValuesWhenColumnIsNotNew.
@Test
public void testSetupValuesWhenColumnIsNotNew() throws Exception {
final DTColumnConfig52 column = mock(DTColumnConfig52.class);
final ActionWorkItemWrapper actionWrapper = mock(ActionWorkItemWrapper.class);
final PatternWrapper patternWrapper = mock(PatternWrapper.class);
doReturn(model).when(presenter).getModel();
doReturn(column).when(plugin).getOriginalColumnConfig52();
doReturn(actionWrapper).when(plugin).newActionWorkItemWrapper(column);
doReturn(patternWrapper).when(plugin).newPatternWrapper(actionWrapper);
doReturn("WorkItemName").when(actionWrapper).getWorkItemName();
doReturn("WorkItemResultParameterName").when(actionWrapper).getWorkItemResultParameterName();
doReturn(new ArrayList<ActionCol52>()).when(model).getActionCols();
doReturn(false).when(plugin).isNewColumn();
plugin.setupValues();
verify(plugin).setupWorkItems();
verify(plugin).setWorkItem("WorkItemName:WorkItemResultParameterName");
verify(plugin).setWorkItemPageAsCompleted();
verify(plugin).fireChangeEvent(patternPage);
verify(plugin).fireChangeEvent(fieldPage);
verify(plugin).fireChangeEvent(additionalInfoPage);
}
Aggregations