use of org.drools.workbench.models.guided.dtable.shared.model.ActionCol52 in project drools-wb by kiegroup.
the class BaseColumnSynchronizer method findTargetActionIndex.
protected int findTargetActionIndex(final MoveColumnToMetaData md) throws ModelSynchronizer.MoveVetoException {
int tgtActionIndex = -1;
final int tgtColumnIndex = md.getTargetColumnIndex();
final List<BaseColumn> allModelColumns = model.getExpandedColumns();
final List<ActionCol52> allModelActions = model.getActionCols();
for (int actionIndex = 0; actionIndex < allModelActions.size(); actionIndex++) {
final ActionCol52 ac = allModelActions.get(actionIndex);
final List<ActionCol52> children = getChildren(ac);
if (children == null || children.isEmpty()) {
continue;
}
final BaseColumn firstChild = children.get(0);
final BaseColumn lastChild = children.get(children.size() - 1);
final int firstChildIndex = allModelColumns.indexOf(firstChild);
final int lastChildIndex = allModelColumns.indexOf(lastChild);
if (tgtColumnIndex >= firstChildIndex && tgtColumnIndex <= lastChildIndex) {
tgtActionIndex = actionIndex;
break;
}
}
if (tgtActionIndex < 0) {
throw new ModelSynchronizer.MoveVetoException();
}
return tgtActionIndex;
}
use of org.drools.workbench.models.guided.dtable.shared.model.ActionCol52 in project drools-wb by kiegroup.
the class DecisionTableColumnViewUtilsTest method testColumnManagementGroupTitle.
@Test
public void testColumnManagementGroupTitle() throws Exception {
final ActionCol52 column = mock(ActionCol52.class);
doReturn(COLUMN_HEADER).when(column).getHeader();
assertEquals(COLUMN_HEADER, DecisionTableColumnViewUtils.getColumnManagementGroupTitle(column));
}
use of org.drools.workbench.models.guided.dtable.shared.model.ActionCol52 in project drools-wb by kiegroup.
the class ActionSetFactPluginTest method testGenerateColumnWhenColumnIsNew.
@Test
public void testGenerateColumnWhenColumnIsNew() throws Exception {
final ActionCol52 actionCol52 = mock(ActionCol52.class);
doReturn(actionCol52).when(plugin).editingCol();
doReturn(true).when(plugin).isNewColumn();
assertTrue(plugin.generateColumn());
verify(presenter).appendColumn(actionCol52);
}
use of org.drools.workbench.models.guided.dtable.shared.model.ActionCol52 in project drools-wb by kiegroup.
the class ActionWorkItemPluginTest 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 testGenerateColumnWhenColumnIsNotNew.
@Test
public void testGenerateColumnWhenColumnIsNotNew() throws Exception {
final ActionCol52 editingColumn = mock(ActionCol52.class);
final ActionCol52 originalColumn = mock(ActionCol52.class);
final String header = "header";
doReturn(false).when(plugin).isNewColumn();
doReturn(header).when(editingWrapper).getHeader();
doReturn("factField").when(editingWrapper).getFactField();
doReturn("factType2").when(editingWrapper).getFactType();
doReturn(editingWrapper).when(plugin).editingWrapper();
doReturn(editingColumn).when(editingWrapper).getActionCol52();
doReturn(originalColumn).when(plugin).getOriginalColumnConfig52();
final Boolean success = plugin.generateColumn();
assertTrue(success);
verify(presenter).updateColumn(originalColumn, editingColumn);
verify(translationService, never()).format(any());
}
Aggregations