use of org.drools.workbench.screens.guided.dtable.client.widget.table.columns.BooleanUiColumn in project drools-wb by kiegroup.
the class ActionWorkItemInsertFactColumnSynchronizerTest method testAppend.
@Test
public void testAppend() throws VetoException {
final ActionWorkItemInsertFactCol52 column = new ActionWorkItemInsertFactCol52();
column.setWorkItemName(WORK_ITEM_NAME);
column.setHeader("col1");
modelSynchronizer.appendColumn(column);
assertEquals(2, model.getActionCols().size());
assertEquals(4, uiModel.getColumns().size());
assertTrue(uiModel.getColumns().get(3) instanceof BooleanUiColumn);
assertEquals(true, ((BaseMultipleDOMElementUiColumn) uiModel.getColumns().get(3)).isEditable());
}
use of org.drools.workbench.screens.guided.dtable.client.widget.table.columns.BooleanUiColumn in project drools-wb by kiegroup.
the class ActionWorkItemInsertFactColumnSynchronizerTest method testMoveColumnTo_MoveRight.
@Test
public void testMoveColumnTo_MoveRight() throws VetoException {
final ActionWorkItemInsertFactCol52 column1 = new ActionWorkItemInsertFactCol52();
column1.setWorkItemName(WORK_ITEM_NAME);
column1.setBoundName("$a");
column1.setFactType("Applicant");
column1.setFactField("age");
column1.setHeader("wid1");
final ActionWorkItemInsertFactCol52 column2 = new ActionWorkItemInsertFactCol52();
column2.setWorkItemName(WORK_ITEM_NAME);
column2.setBoundName("$a");
column2.setFactType("Applicant");
column2.setFactField("name");
column2.setHeader("wid2");
modelSynchronizer.appendColumn(column1);
modelSynchronizer.appendColumn(column2);
modelSynchronizer.appendRow();
uiModel.setCellValue(0, 3, new BaseGridCellValue<Boolean>(true));
uiModel.setCellValue(0, 4, 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(3).getBooleanValue());
assertEquals(false, model.getData().get(0).get(4).getBooleanValue());
assertEquals(5, uiModel.getColumns().size());
final GridColumn<?> uiModelColumn1_1 = uiModel.getColumns().get(3);
final GridColumn<?> uiModelColumn2_1 = uiModel.getColumns().get(4);
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(3, uiModelColumn1_1.getIndex());
assertEquals(4, 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(4, uiModelColumn1_1);
assertEquals(3, model.getActionCols().size());
assertEquals(column2, model.getActionCols().get(1));
assertEquals(column1, model.getActionCols().get(2));
assertEquals(false, model.getData().get(0).get(3).getBooleanValue());
assertEquals(true, model.getData().get(0).get(4).getBooleanValue());
assertEquals(5, uiModel.getColumns().size());
final GridColumn<?> uiModelColumn1_2 = uiModel.getColumns().get(3);
final GridColumn<?> uiModelColumn2_2 = uiModel.getColumns().get(4);
assertEquals("wid2", uiModelColumn1_2.getHeaderMetaData().get(1).getTitle());
assertEquals("wid1", uiModelColumn2_2.getHeaderMetaData().get(1).getTitle());
assertTrue(uiModelColumn1_2 instanceof BooleanUiColumn);
assertTrue(uiModelColumn2_2 instanceof BooleanUiColumn);
assertEquals(4, uiModelColumn1_2.getIndex());
assertEquals(3, uiModelColumn2_2.getIndex());
assertEquals(false, uiModel.getRow(0).getCells().get(uiModelColumn1_2.getIndex()).getValue().getValue());
assertEquals(true, uiModel.getRow(0).getCells().get(uiModelColumn2_2.getIndex()).getValue().getValue());
}
use of org.drools.workbench.screens.guided.dtable.client.widget.table.columns.BooleanUiColumn in project drools-wb by kiegroup.
the class AttributeColumnSynchronizerTest method testUpdate1.
@Test
public void testUpdate1() throws VetoException {
final AttributeCol52 column = spy(new AttributeCol52());
column.setAttribute(RuleAttributeWidget.SALIENCE_ATTR);
modelSynchronizer.appendColumn(column);
final AttributeCol52 edited = new AttributeCol52();
edited.setWidth(column.getWidth());
edited.setAttribute(RuleAttributeWidget.ENABLED_ATTR);
List<BaseColumnFieldDiff> diffs = modelSynchronizer.updateColumn(column, edited);
assertEquals(1, diffs.size());
verify(column).diff(edited);
assertEquals(1, model.getAttributeCols().size());
assertEquals(RuleAttributeWidget.ENABLED_ATTR, model.getAttributeCols().get(0).getAttribute());
assertEquals(3, uiModel.getColumns().size());
assertTrue(uiModel.getColumns().get(2) instanceof BooleanUiColumn);
assertEquals(RuleAttributeWidget.ENABLED_ATTR, uiModel.getColumns().get(2).getHeaderMetaData().get(0).getTitle());
}
use of org.drools.workbench.screens.guided.dtable.client.widget.table.columns.BooleanUiColumn in project drools-wb by kiegroup.
the class ActionWorkItemExecuteColumnSynchronizerTest method testUpdate.
@Test
public void testUpdate() throws VetoException {
final ActionWorkItemCol52 column = spy(new ActionWorkItemCol52());
column.setHeader("col1");
modelSynchronizer.appendColumn(column);
final ActionWorkItemCol52 edited = new ActionWorkItemCol52();
edited.setWidth(column.getWidth());
edited.setHideColumn(true);
edited.setHeader("updated");
List<BaseColumnFieldDiff> diffs = modelSynchronizer.updateColumn(column, edited);
assertEquals(2, diffs.size());
verify(column).diff(edited);
assertEquals(1, model.getActionCols().size());
assertEquals(3, uiModel.getColumns().size());
assertTrue(uiModel.getColumns().get(2) instanceof BooleanUiColumn);
assertEquals("updated", uiModel.getColumns().get(2).getHeaderMetaData().get(1).getTitle());
assertEquals(false, uiModel.getColumns().get(2).isVisible());
}
use of org.drools.workbench.screens.guided.dtable.client.widget.table.columns.BooleanUiColumn in project drools-wb by kiegroup.
the class ActionWorkItemExecuteColumnSynchronizerTest method testMoveColumnTo_MoveRight.
@Test
public void testMoveColumnTo_MoveRight() throws VetoException {
final ActionWorkItemCol52 column1 = new ActionWorkItemCol52();
column1.setHeader("wid1");
final ActionWorkItemCol52 column2 = new ActionWorkItemCol52();
column2.setHeader("wid2");
modelSynchronizer.appendColumn(column1);
modelSynchronizer.appendColumn(column2);
modelSynchronizer.appendRow();
uiModel.setCellValue(0, 2, new BaseGridCellValue<Boolean>(true));
uiModel.setCellValue(0, 3, new BaseGridCellValue<Boolean>(false));
assertEquals(2, model.getActionCols().size());
assertEquals(column1, model.getActionCols().get(0));
assertEquals(column2, model.getActionCols().get(1));
assertEquals(true, model.getData().get(0).get(2).getBooleanValue());
assertEquals(false, model.getData().get(0).get(3).getBooleanValue());
assertEquals(4, uiModel.getColumns().size());
final GridColumn<?> uiModelColumn1_1 = uiModel.getColumns().get(2);
final GridColumn<?> uiModelColumn2_1 = uiModel.getColumns().get(3);
assertEquals("wid1", uiModelColumn1_1.getHeaderMetaData().get(0).getTitle());
assertEquals("wid2", uiModelColumn2_1.getHeaderMetaData().get(0).getTitle());
assertTrue(uiModelColumn1_1 instanceof BooleanUiColumn);
assertTrue(uiModelColumn2_1 instanceof BooleanUiColumn);
assertEquals(2, uiModelColumn1_1.getIndex());
assertEquals(3, 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(3, uiModelColumn1_1);
assertEquals(2, model.getActionCols().size());
assertEquals(column2, model.getActionCols().get(0));
assertEquals(column1, model.getActionCols().get(1));
assertEquals(false, model.getData().get(0).get(2).getBooleanValue());
assertEquals(true, model.getData().get(0).get(3).getBooleanValue());
assertEquals(4, uiModel.getColumns().size());
final GridColumn<?> uiModelColumn1_2 = uiModel.getColumns().get(2);
final GridColumn<?> uiModelColumn2_2 = uiModel.getColumns().get(3);
assertEquals("wid2", uiModelColumn1_2.getHeaderMetaData().get(0).getTitle());
assertEquals("wid1", uiModelColumn2_2.getHeaderMetaData().get(0).getTitle());
assertTrue(uiModelColumn1_2 instanceof BooleanUiColumn);
assertTrue(uiModelColumn2_2 instanceof BooleanUiColumn);
assertEquals(3, uiModelColumn1_2.getIndex());
assertEquals(2, uiModelColumn2_2.getIndex());
assertEquals(false, uiModel.getRow(0).getCells().get(uiModelColumn1_2.getIndex()).getValue().getValue());
assertEquals(true, uiModel.getRow(0).getCells().get(uiModelColumn2_2.getIndex()).getValue().getValue());
}
Aggregations