use of org.drools.workbench.screens.guided.dtable.client.widget.table.columns.BoundFactUiColumn in project drools-wb by kiegroup.
the class ActionRetractFactColumnSynchronizerTest method testMoveColumnTo_MoveRight.
@Test
public void testMoveColumnTo_MoveRight() throws VetoException {
final ActionRetractFactCol52 column1 = new ActionRetractFactCol52();
column1.setHeader("retract1");
final ActionRetractFactCol52 column2 = new ActionRetractFactCol52();
column2.setHeader("retract2");
modelSynchronizer.appendColumn(column1);
modelSynchronizer.appendColumn(column2);
modelSynchronizer.appendRow();
uiModel.setCellValue(0, 2, new BaseGridCellValue<String>("$r1"));
uiModel.setCellValue(0, 3, new BaseGridCellValue<String>("$r2"));
assertEquals(2, model.getActionCols().size());
assertEquals(column1, model.getActionCols().get(0));
assertEquals(column2, model.getActionCols().get(1));
assertEquals("$r1", model.getData().get(0).get(2).getStringValue());
assertEquals("$r2", model.getData().get(0).get(3).getStringValue());
assertEquals(4, uiModel.getColumns().size());
final GridColumn<?> uiModelColumn1_1 = uiModel.getColumns().get(2);
final GridColumn<?> uiModelColumn2_1 = uiModel.getColumns().get(3);
assertEquals("retract1", uiModelColumn1_1.getHeaderMetaData().get(0).getTitle());
assertEquals("retract2", uiModelColumn2_1.getHeaderMetaData().get(0).getTitle());
assertTrue(uiModelColumn1_1 instanceof BoundFactUiColumn);
assertTrue(uiModelColumn2_1 instanceof BoundFactUiColumn);
assertEquals(2, uiModelColumn1_1.getIndex());
assertEquals(3, uiModelColumn2_1.getIndex());
assertEquals("$r1", uiModel.getRow(0).getCells().get(uiModelColumn1_1.getIndex()).getValue().getValue());
assertEquals("$r2", 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("$r2", model.getData().get(0).get(2).getStringValue());
assertEquals("$r1", model.getData().get(0).get(3).getStringValue());
assertEquals(4, uiModel.getColumns().size());
final GridColumn<?> uiModelColumn1_2 = uiModel.getColumns().get(2);
final GridColumn<?> uiModelColumn2_2 = uiModel.getColumns().get(3);
assertEquals("retract2", uiModelColumn1_2.getHeaderMetaData().get(0).getTitle());
assertEquals("retract1", uiModelColumn2_2.getHeaderMetaData().get(0).getTitle());
assertTrue(uiModelColumn1_2 instanceof BoundFactUiColumn);
assertTrue(uiModelColumn2_2 instanceof BoundFactUiColumn);
assertEquals(3, uiModelColumn1_2.getIndex());
assertEquals(2, uiModelColumn2_2.getIndex());
assertEquals("$r2", uiModel.getRow(0).getCells().get(uiModelColumn1_2.getIndex()).getValue().getValue());
assertEquals("$r1", uiModel.getRow(0).getCells().get(uiModelColumn2_2.getIndex()).getValue().getValue());
}
use of org.drools.workbench.screens.guided.dtable.client.widget.table.columns.BoundFactUiColumn in project drools-wb by kiegroup.
the class ActionRetractFactColumnSynchronizerTest method testMoveColumnTo_MoveLeft.
@Test
public void testMoveColumnTo_MoveLeft() throws VetoException {
final ActionRetractFactCol52 column1 = new ActionRetractFactCol52();
column1.setHeader("retract1");
final ActionRetractFactCol52 column2 = new ActionRetractFactCol52();
column2.setHeader("retract2");
modelSynchronizer.appendColumn(column1);
modelSynchronizer.appendColumn(column2);
modelSynchronizer.appendRow();
uiModel.setCellValue(0, 2, new BaseGridCellValue<String>("$r1"));
uiModel.setCellValue(0, 3, new BaseGridCellValue<String>("$r2"));
assertEquals(2, model.getActionCols().size());
assertEquals(column1, model.getActionCols().get(0));
assertEquals(column2, model.getActionCols().get(1));
assertEquals("$r1", model.getData().get(0).get(2).getStringValue());
assertEquals("$r2", model.getData().get(0).get(3).getStringValue());
assertEquals(4, uiModel.getColumns().size());
final GridColumn<?> uiModelColumn1_1 = uiModel.getColumns().get(2);
final GridColumn<?> uiModelColumn2_1 = uiModel.getColumns().get(3);
assertEquals("retract1", uiModelColumn1_1.getHeaderMetaData().get(0).getTitle());
assertEquals("retract2", uiModelColumn2_1.getHeaderMetaData().get(0).getTitle());
assertTrue(uiModelColumn1_1 instanceof BoundFactUiColumn);
assertTrue(uiModelColumn2_1 instanceof BoundFactUiColumn);
assertEquals(2, uiModelColumn1_1.getIndex());
assertEquals(3, uiModelColumn2_1.getIndex());
assertEquals("$r1", uiModel.getRow(0).getCells().get(uiModelColumn1_1.getIndex()).getValue().getValue());
assertEquals("$r2", uiModel.getRow(0).getCells().get(uiModelColumn2_1.getIndex()).getValue().getValue());
uiModel.moveColumnTo(2, uiModelColumn2_1);
assertEquals(2, model.getActionCols().size());
assertEquals(column2, model.getActionCols().get(0));
assertEquals(column1, model.getActionCols().get(1));
assertEquals("$r2", model.getData().get(0).get(2).getStringValue());
assertEquals("$r1", model.getData().get(0).get(3).getStringValue());
assertEquals(4, uiModel.getColumns().size());
final GridColumn<?> uiModelColumn1_2 = uiModel.getColumns().get(2);
final GridColumn<?> uiModelColumn2_2 = uiModel.getColumns().get(3);
assertEquals("retract2", uiModelColumn1_2.getHeaderMetaData().get(0).getTitle());
assertEquals("retract1", uiModelColumn2_2.getHeaderMetaData().get(0).getTitle());
assertTrue(uiModelColumn1_2 instanceof BoundFactUiColumn);
assertTrue(uiModelColumn2_2 instanceof BoundFactUiColumn);
assertEquals(3, uiModelColumn1_2.getIndex());
assertEquals(2, uiModelColumn2_2.getIndex());
assertEquals("$r2", uiModel.getRow(0).getCells().get(uiModelColumn1_2.getIndex()).getValue().getValue());
assertEquals("$r1", uiModel.getRow(0).getCells().get(uiModelColumn2_2.getIndex()).getValue().getValue());
}
use of org.drools.workbench.screens.guided.dtable.client.widget.table.columns.BoundFactUiColumn in project drools-wb by kiegroup.
the class ActionRetractFactColumnSynchronizerTest method testUpdate.
@Test
public void testUpdate() throws VetoException {
final ActionRetractFactCol52 column = spy(new ActionRetractFactCol52());
column.setHeader("col1");
modelSynchronizer.appendColumn(column);
final ActionRetractFactCol52 edited = new ActionRetractFactCol52();
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 BoundFactUiColumn);
assertEquals("updated", uiModel.getColumns().get(2).getHeaderMetaData().get(0).getTitle());
assertEquals(false, uiModel.getColumns().get(2).isVisible());
}
use of org.drools.workbench.screens.guided.dtable.client.widget.table.columns.BoundFactUiColumn in project drools-wb by kiegroup.
the class ActionRetractFactColumnSynchronizerTest method testMoveColumnTo_OutOfBounds.
@Test
public void testMoveColumnTo_OutOfBounds() throws VetoException {
final ActionRetractFactCol52 column1 = new ActionRetractFactCol52();
column1.setHeader("retract1");
final ActionRetractFactCol52 column2 = new ActionRetractFactCol52();
column2.setHeader("retract2");
modelSynchronizer.appendColumn(column1);
modelSynchronizer.appendColumn(column2);
modelSynchronizer.appendRow();
uiModel.setCellValue(0, 2, new BaseGridCellValue<String>("$r1"));
uiModel.setCellValue(0, 3, new BaseGridCellValue<String>("$r2"));
assertEquals(2, model.getActionCols().size());
assertEquals(column1, model.getActionCols().get(0));
assertEquals(column2, model.getActionCols().get(1));
assertEquals("$r1", model.getData().get(0).get(2).getStringValue());
assertEquals("$r2", model.getData().get(0).get(3).getStringValue());
assertEquals(4, uiModel.getColumns().size());
final GridColumn<?> uiModelColumn1_1 = uiModel.getColumns().get(2);
final GridColumn<?> uiModelColumn2_1 = uiModel.getColumns().get(3);
assertEquals("retract1", uiModelColumn1_1.getHeaderMetaData().get(0).getTitle());
assertEquals("retract2", uiModelColumn2_1.getHeaderMetaData().get(0).getTitle());
assertTrue(uiModelColumn1_1 instanceof BoundFactUiColumn);
assertTrue(uiModelColumn2_1 instanceof BoundFactUiColumn);
assertEquals(2, uiModelColumn1_1.getIndex());
assertEquals(3, uiModelColumn2_1.getIndex());
assertEquals("$r1", uiModel.getRow(0).getCells().get(uiModelColumn1_1.getIndex()).getValue().getValue());
assertEquals("$r2", uiModel.getRow(0).getCells().get(uiModelColumn2_1.getIndex()).getValue().getValue());
uiModel.moveColumnTo(0, uiModelColumn1_1);
assertEquals(2, model.getActionCols().size());
assertEquals(column1, model.getActionCols().get(0));
assertEquals(column2, model.getActionCols().get(1));
assertEquals("$r1", model.getData().get(0).get(2).getStringValue());
assertEquals("$r2", model.getData().get(0).get(3).getStringValue());
assertEquals(4, uiModel.getColumns().size());
final GridColumn<?> uiModelColumn1_2 = uiModel.getColumns().get(2);
final GridColumn<?> uiModelColumn2_2 = uiModel.getColumns().get(3);
assertEquals("retract1", uiModelColumn1_2.getHeaderMetaData().get(0).getTitle());
assertEquals("retract2", uiModelColumn2_2.getHeaderMetaData().get(0).getTitle());
assertTrue(uiModelColumn1_2 instanceof BoundFactUiColumn);
assertTrue(uiModelColumn2_2 instanceof BoundFactUiColumn);
assertEquals(2, uiModelColumn1_2.getIndex());
assertEquals(3, uiModelColumn2_2.getIndex());
assertEquals("$r1", uiModel.getRow(0).getCells().get(uiModelColumn1_2.getIndex()).getValue().getValue());
assertEquals("$r2", uiModel.getRow(0).getCells().get(uiModelColumn2_2.getIndex()).getValue().getValue());
}
use of org.drools.workbench.screens.guided.dtable.client.widget.table.columns.BoundFactUiColumn in project drools-wb by kiegroup.
the class ActionRetractFactColumnSynchronizerTest method testAppend.
@Test
public void testAppend() throws VetoException {
final ActionRetractFactCol52 column = new ActionRetractFactCol52();
column.setHeader("col1");
modelSynchronizer.appendColumn(column);
assertEquals(1, model.getActionCols().size());
assertEquals(3, uiModel.getColumns().size());
assertTrue(uiModel.getColumns().get(2) instanceof BoundFactUiColumn);
assertEquals(true, ((BaseSingletonDOMElementUiColumn) uiModel.getColumns().get(2)).isEditable());
}
Aggregations