use of org.drools.workbench.screens.guided.dtable.client.widget.table.columns.LongUiColumn in project drools-wb by kiegroup.
the class BRLActionColumnSynchronizerTest method testUpdate3.
@Test
public void testUpdate3() throws VetoException {
// Single Column, multiple variables
final BRLActionColumn column = spy(new BRLActionColumn());
final BRLActionVariableColumn columnV0 = new BRLActionVariableColumn("$age", DataType.TYPE_NUMERIC_INTEGER, "Applicant", "age");
final BRLActionVariableColumn columnV1 = new BRLActionVariableColumn("$name", DataType.TYPE_STRING, "Applicant", "name");
column.getChildColumns().add(columnV0);
column.getChildColumns().add(columnV1);
column.setHeader("col1");
columnV0.setHeader("col1v0");
columnV1.setHeader("col1v1");
modelSynchronizer.appendColumn(column);
assertEquals(4, model.getExpandedColumns().size());
assertEquals(1, model.getActionCols().size());
assertEquals(4, uiModel.getColumns().size());
assertTrue(uiModel.getColumns().get(2) instanceof IntegerUiColumn);
assertTrue(uiModel.getColumns().get(3) instanceof StringUiColumn);
final BRLActionColumn edited = new BRLActionColumn();
final BRLActionVariableColumn editedColumnV0 = new BRLActionVariableColumn("$s", DataType.TYPE_NUMERIC_LONG, "Applicant", "salary");
edited.getChildColumns().add(editedColumnV0);
edited.setHideColumn(true);
edited.setHeader("updated");
editedColumnV0.setHeader("updated");
List<BaseColumnFieldDiff> diffs = modelSynchronizer.updateColumn(column, edited);
assertEquals(6, // header, hide, field name, field type, binding, removed column
diffs.size());
verify(column).diff(edited);
assertEquals(3, model.getExpandedColumns().size());
assertEquals(1, model.getActionCols().size());
assertEquals(3, uiModel.getColumns().size());
assertTrue(uiModel.getColumns().get(2) instanceof LongUiColumn);
assertEquals("updated", uiModel.getColumns().get(2).getHeaderMetaData().get(0).getTitle());
assertEquals("$s", 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.LongUiColumn in project drools-wb by kiegroup.
the class BRLConditionColumnSynchronizerTest method testUpdate3.
@Test
public void testUpdate3() throws VetoException {
// Single Column, multiple variables
final BRLConditionColumn column = spy(new BRLConditionColumn());
final BRLConditionVariableColumn columnV0 = new BRLConditionVariableColumn("$age", DataType.TYPE_NUMERIC_INTEGER, "Applicant", "age");
final BRLConditionVariableColumn columnV1 = new BRLConditionVariableColumn("$name", DataType.TYPE_STRING, "Applicant", "name");
column.getChildColumns().add(columnV0);
column.getChildColumns().add(columnV1);
column.setHeader("col1");
columnV0.setHeader("col1v0");
columnV1.setHeader("col1v1");
modelSynchronizer.appendColumn(column);
assertEquals(4, model.getExpandedColumns().size());
assertEquals(1, model.getConditions().size());
assertEquals(4, uiModel.getColumns().size());
assertTrue(uiModel.getColumns().get(2) instanceof IntegerUiColumn);
assertTrue(uiModel.getColumns().get(3) instanceof StringUiColumn);
assertEquals("$age", uiModel.getColumns().get(2).getHeaderMetaData().get(1).getTitle());
final BRLConditionColumn edited = new BRLConditionColumn();
final BRLConditionVariableColumn editedColumnV0 = new BRLConditionVariableColumn("$s", DataType.TYPE_NUMERIC_LONG, "Applicant", "salary");
edited.getChildColumns().add(editedColumnV0);
edited.setHideColumn(true);
edited.setHeader("updated");
editedColumnV0.setHeader("updated");
List<BaseColumnFieldDiff> diffs = modelSynchronizer.updateColumn(column, edited);
assertEquals(6, // header, hide, field name, field type, binding, removed column
diffs.size());
verify(column).diff(edited);
assertEquals(3, model.getExpandedColumns().size());
assertEquals(1, model.getConditions().size());
assertEquals(3, uiModel.getColumns().size());
assertTrue(uiModel.getColumns().get(2) instanceof LongUiColumn);
assertEquals("updated", uiModel.getColumns().get(2).getHeaderMetaData().get(0).getTitle());
assertEquals(false, uiModel.getColumns().get(2).isVisible());
assertEquals("$s", uiModel.getColumns().get(2).getHeaderMetaData().get(1).getTitle());
}
Aggregations