use of org.drools.workbench.models.guided.dtable.shared.model.CompositeColumn in project drools-wb by kiegroup.
the class LimitedEntryBRLConditionColumnSynchronizer method moveColumnsTo.
@Override
public void moveColumnsTo(final List<MoveColumnToMetaData> metaData) throws VetoException {
// Check operation is supported
if (!handlesMoveColumnsTo(metaData)) {
return;
}
final MoveColumnToMetaData md = metaData.get(0);
final LimitedEntryBRLConditionColumn modelColumn = (LimitedEntryBRLConditionColumn) md.getColumn();
final List<CompositeColumn<? extends BaseColumn>> modelConditionColumns = model.getConditions();
final int modelConditionColumnCount = modelConditionColumns.size();
if (modelConditionColumnCount == 0) {
throw new ModelSynchronizer.MoveVetoException();
}
final List<BaseColumn> allModelColumns = model.getExpandedColumns();
final int minColumnIndex = allModelColumns.indexOf(modelConditionColumns.get(0));
final int maxColumnIndex = allModelColumns.indexOf(modelConditionColumns.get(modelConditionColumnCount - 1));
final int targetColumnIndex = md.getTargetColumnIndex();
final int sourceColumnIndex = md.getSourceColumnIndex();
if (targetColumnIndex < minColumnIndex || targetColumnIndex > maxColumnIndex) {
throw new ModelSynchronizer.MoveVetoException();
}
moveModelData(targetColumnIndex, sourceColumnIndex, sourceColumnIndex);
modelConditionColumns.remove(modelColumn);
modelConditionColumns.add(targetColumnIndex - minColumnIndex, modelColumn);
}
use of org.drools.workbench.models.guided.dtable.shared.model.CompositeColumn in project drools-wb by kiegroup.
the class ActionWorkItemSetFieldPluginTest method mockPatterns.
private void mockPatterns() {
final GuidedDecisionTable52 model = mock(GuidedDecisionTable52.class);
final List<CompositeColumn<?>> patterns = Collections.singletonList(fakePattern());
final List<ActionCol52> actions = Arrays.asList(fakeActionCol(), fakeActionCol());
when(model.getConditions()).thenReturn(patterns);
when(model.getActionCols()).thenReturn(actions);
when(presenter.getModel()).thenReturn(model);
}
Aggregations