use of org.drools.workbench.models.guided.dtable.shared.model.ActionWorkItemSetFieldCol52 in project drools-wb by kiegroup.
the class ActionWorkItemSetWrapper method clone.
private ActionWorkItemSetFieldCol52 clone(final ActionWorkItemSetFieldCol52 column) {
final ActionWorkItemSetFieldCol52 clone = new ActionWorkItemSetFieldCol52();
clone.setFactField(column.getFactField());
clone.setBoundName(column.getBoundName());
clone.setValueList(column.getValueList());
clone.setHeader(column.getHeader());
clone.setUpdate(column.isUpdate());
clone.setDefaultValue(column.getDefaultValue());
clone.setHideColumn(column.isHideColumn());
clone.setType(column.getType());
clone.setParameterClassName(column.getParameterClassName());
clone.setWorkItemName(column.getWorkItemName());
clone.setWorkItemResultParameterName(column.getWorkItemResultParameterName());
return clone;
}
use of org.drools.workbench.models.guided.dtable.shared.model.ActionWorkItemSetFieldCol52 in project drools-wb by kiegroup.
the class ActionWorkItemSetFieldColumnSynchronizer method update.
@Override
public List<BaseColumnFieldDiff> update(final ColumnMetaData originalMetaData, final ColumnMetaData editedMetaData) throws VetoException {
// Check operation is supported
if (!(handlesUpdate(originalMetaData) && handlesUpdate(editedMetaData))) {
return Collections.emptyList();
}
// Get differences between original and edited column
final ActionWorkItemSetFieldCol52 originalColumn = (ActionWorkItemSetFieldCol52) originalMetaData.getColumn();
final ActionWorkItemSetFieldCol52 editedColumn = (ActionWorkItemSetFieldCol52) editedMetaData.getColumn();
final List<BaseColumnFieldDiff> diffs = originalColumn.diff(editedColumn);
update(originalColumn, editedColumn);
// ActionWorkItem columns are always represented with a BooleanUiColumn
final boolean isHideUpdated = BaseColumnFieldDiffImpl.hasChanged(ActionWorkItemSetFieldCol52.FIELD_HIDE_COLUMN, diffs);
final boolean isHeaderUpdated = BaseColumnFieldDiffImpl.hasChanged(ActionWorkItemSetFieldCol52.FIELD_HEADER, diffs);
if (isHideUpdated) {
setColumnVisibility(originalColumn, originalColumn.isHideColumn());
}
if (isHeaderUpdated) {
setColumnHeader(originalColumn, originalColumn.getHeader());
}
return diffs;
}
use of org.drools.workbench.models.guided.dtable.shared.model.ActionWorkItemSetFieldCol52 in project drools-wb by kiegroup.
the class ActionWorkItemSetFieldColumnConverterTest method getColumn.
@Override
protected BaseColumn getColumn() {
final ActionWorkItemSetFieldCol52 column = new ActionWorkItemSetFieldCol52();
column.setWorkItemName(WID_NAME);
column.setHeader(HEADER);
column.setWidth(WIDTH);
return column;
}
use of org.drools.workbench.models.guided.dtable.shared.model.ActionWorkItemSetFieldCol52 in project drools-wb by kiegroup.
the class ActionWorkItemSetFieldColumnSynchronizerTest method testAppendMultipleColumns.
@Test
public void testAppendMultipleColumns() throws VetoException {
final ActionWorkItemSetFieldCol52 column1 = new ActionWorkItemSetFieldCol52();
column1.setWorkItemName(WORK_ITEM_NAME);
column1.setHeader("col1");
final ActionWorkItemSetFieldCol52 column2 = new ActionWorkItemSetFieldCol52();
column2.setWorkItemName(WORK_ITEM_NAME);
column2.setHeader("col2");
modelSynchronizer.appendColumn(column1);
modelSynchronizer.appendColumn(column2);
assertEquals(3, model.getActionCols().size());
assertEquals(6, uiModel.getColumns().size());
assertTrue(uiModel.getColumns().get(4) instanceof BooleanUiColumn);
assertTrue(uiModel.getColumns().get(5) instanceof BooleanUiColumn);
assertEquals(true, ((BaseMultipleDOMElementUiColumn) uiModel.getColumns().get(4)).isEditable());
assertEquals(true, ((BaseMultipleDOMElementUiColumn) uiModel.getColumns().get(5)).isEditable());
assertEquals(column1.getHeader(), uiModel.getColumns().get(4).getHeaderMetaData().get(1).getTitle());
assertEquals(column2.getHeader(), uiModel.getColumns().get(5).getHeaderMetaData().get(1).getTitle());
}
use of org.drools.workbench.models.guided.dtable.shared.model.ActionWorkItemSetFieldCol52 in project drools-wb by kiegroup.
the class ActionWorkItemSetFieldColumnSynchronizerTest method testMoveColumnTo_OutOfBounds.
@Test
public void testMoveColumnTo_OutOfBounds() throws VetoException {
// Add a Pattern to be updated
final Pattern52 pattern = new Pattern52();
pattern.setBoundName("$a");
pattern.setFactType("Applicant");
final ConditionCol52 condition = new ConditionCol52();
condition.setConstraintValueType(BaseSingleFieldConstraint.TYPE_LITERAL);
condition.setHeader("col1");
condition.setFactField("age");
condition.setOperator("==");
modelSynchronizer.appendColumn(pattern, condition);
final ActionWorkItemSetFieldCol52 column1 = new ActionWorkItemSetFieldCol52();
column1.setWorkItemName(WORK_ITEM_NAME);
column1.setBoundName("$a");
column1.setFactField("age");
column1.setHeader("wid1");
final ActionWorkItemSetFieldCol52 column2 = new ActionWorkItemSetFieldCol52();
column2.setWorkItemName(WORK_ITEM_NAME);
column2.setBoundName("$a");
column2.setFactField("name");
column2.setHeader("wid2");
modelSynchronizer.appendColumn(column1);
modelSynchronizer.appendColumn(column2);
modelSynchronizer.appendRow();
uiModel.setCellValue(0, 5, new BaseGridCellValue<Boolean>(true));
uiModel.setCellValue(0, 6, new BaseGridCellValue<Boolean>(false));
assertEquals(3, model.getActionCols().size());
assertEquals(column1, model.getActionCols().get(1));
assertEquals(column2, model.getActionCols().get(2));
assertEquals(true, model.getData().get(0).get(5).getBooleanValue());
assertEquals(false, model.getData().get(0).get(6).getBooleanValue());
assertEquals(7, uiModel.getColumns().size());
final GridColumn<?> uiModelColumn1_1 = uiModel.getColumns().get(5);
final GridColumn<?> uiModelColumn2_1 = uiModel.getColumns().get(6);
assertEquals("wid1", uiModelColumn1_1.getHeaderMetaData().get(1).getTitle());
assertEquals("wid2", uiModelColumn2_1.getHeaderMetaData().get(1).getTitle());
assertTrue(uiModelColumn1_1 instanceof BooleanUiColumn);
assertTrue(uiModelColumn2_1 instanceof BooleanUiColumn);
assertEquals(5, uiModelColumn1_1.getIndex());
assertEquals(6, uiModelColumn2_1.getIndex());
assertEquals(true, uiModel.getRow(0).getCells().get(uiModelColumn1_1.getIndex()).getValue().getValue());
assertEquals(false, uiModel.getRow(0).getCells().get(uiModelColumn2_1.getIndex()).getValue().getValue());
uiModel.moveColumnTo(2, uiModelColumn1_1);
assertEquals(3, model.getActionCols().size());
assertEquals(column1, model.getActionCols().get(1));
assertEquals(column2, model.getActionCols().get(2));
assertEquals(true, model.getData().get(0).get(5).getBooleanValue());
assertEquals(false, model.getData().get(0).get(6).getBooleanValue());
assertEquals(7, uiModel.getColumns().size());
final GridColumn<?> uiModelColumn1_2 = uiModel.getColumns().get(5);
final GridColumn<?> uiModelColumn2_2 = uiModel.getColumns().get(6);
assertEquals("wid1", uiModelColumn1_2.getHeaderMetaData().get(1).getTitle());
assertEquals("wid2", uiModelColumn2_2.getHeaderMetaData().get(1).getTitle());
assertTrue(uiModelColumn1_2 instanceof BooleanUiColumn);
assertTrue(uiModelColumn2_2 instanceof BooleanUiColumn);
assertEquals(5, uiModelColumn1_2.getIndex());
assertEquals(6, uiModelColumn2_2.getIndex());
assertEquals(true, uiModel.getRow(0).getCells().get(uiModelColumn1_2.getIndex()).getValue().getValue());
assertEquals(false, uiModel.getRow(0).getCells().get(uiModelColumn2_2.getIndex()).getValue().getValue());
}
Aggregations