Search in sources :

Example 1 with BooleanUiColumn

use of org.drools.workbench.screens.guided.dtable.client.widget.table.columns.BooleanUiColumn in project drools-wb by kiegroup.

the class LimitedEntryBRLActionColumnSynchronizerTest method testMoveColumnTo_OutOfBounds.

@Test
public void testMoveColumnTo_OutOfBounds() throws VetoException {
    final LimitedEntryBRLActionColumn column1 = new LimitedEntryBRLActionColumn();
    column1.setHeader("age");
    final LimitedEntryBRLActionColumn column2 = new LimitedEntryBRLActionColumn();
    column2.setHeader("name");
    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(2, model.getActionCols().size());
    assertEquals(column1, model.getActionCols().get(0));
    assertEquals(column2, model.getActionCols().get(1));
    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("age", uiModelColumn1_1.getHeaderMetaData().get(0).getTitle());
    assertEquals("name", uiModelColumn2_1.getHeaderMetaData().get(0).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(1, uiModelColumn1_1);
    assertEquals(2, model.getActionCols().size());
    assertEquals(column1, model.getActionCols().get(0));
    assertEquals(column2, model.getActionCols().get(1));
    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_2 = uiModel.getColumns().get(3);
    final GridColumn<?> uiModelColumn2_2 = uiModel.getColumns().get(4);
    assertEquals("age", uiModelColumn1_2.getHeaderMetaData().get(0).getTitle());
    assertEquals("name", uiModelColumn2_2.getHeaderMetaData().get(0).getTitle());
    assertTrue(uiModelColumn1_2 instanceof BooleanUiColumn);
    assertTrue(uiModelColumn2_2 instanceof BooleanUiColumn);
    assertEquals(3, uiModelColumn1_2.getIndex());
    assertEquals(4, 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());
}
Also used : LimitedEntryBRLActionColumn(org.drools.workbench.models.guided.dtable.shared.model.LimitedEntryBRLActionColumn) BooleanUiColumn(org.drools.workbench.screens.guided.dtable.client.widget.table.columns.BooleanUiColumn) Test(org.junit.Test)

Example 2 with BooleanUiColumn

use of org.drools.workbench.screens.guided.dtable.client.widget.table.columns.BooleanUiColumn in project drools-wb by kiegroup.

the class LimitedEntryBRLActionColumnSynchronizerTest method testUpdate.

@Test
public void testUpdate() throws VetoException {
    final LimitedEntryBRLActionColumn column = new LimitedEntryBRLActionColumn();
    column.setHeader("col1");
    modelSynchronizer.appendColumn(column);
    final LimitedEntryBRLActionColumn edited = new LimitedEntryBRLActionColumn();
    edited.setHideColumn(true);
    edited.setHeader("updated");
    modelSynchronizer.updateColumn(column, edited);
    assertEquals(1, model.getActionCols().size());
    assertEquals(4, uiModel.getColumns().size());
    assertTrue(uiModel.getColumns().get(3) instanceof BooleanUiColumn);
    assertEquals("updated", uiModel.getColumns().get(3).getHeaderMetaData().get(0).getTitle());
    assertEquals(false, uiModel.getColumns().get(3).isVisible());
}
Also used : LimitedEntryBRLActionColumn(org.drools.workbench.models.guided.dtable.shared.model.LimitedEntryBRLActionColumn) BooleanUiColumn(org.drools.workbench.screens.guided.dtable.client.widget.table.columns.BooleanUiColumn) Test(org.junit.Test)

Example 3 with BooleanUiColumn

use of org.drools.workbench.screens.guided.dtable.client.widget.table.columns.BooleanUiColumn in project drools-wb by kiegroup.

the class LimitedEntryBRLActionColumnSynchronizerTest method testMoveColumnTo_MoveLeft.

@Test
public void testMoveColumnTo_MoveLeft() throws VetoException {
    final LimitedEntryBRLActionColumn column1 = new LimitedEntryBRLActionColumn();
    column1.setHeader("age");
    final LimitedEntryBRLActionColumn column2 = new LimitedEntryBRLActionColumn();
    column2.setHeader("name");
    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(2, model.getActionCols().size());
    assertEquals(column1, model.getActionCols().get(0));
    assertEquals(column2, model.getActionCols().get(1));
    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("age", uiModelColumn1_1.getHeaderMetaData().get(0).getTitle());
    assertEquals("name", uiModelColumn2_1.getHeaderMetaData().get(0).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(3, uiModelColumn2_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(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("name", uiModelColumn1_2.getHeaderMetaData().get(0).getTitle());
    assertEquals("age", uiModelColumn2_2.getHeaderMetaData().get(0).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());
}
Also used : LimitedEntryBRLActionColumn(org.drools.workbench.models.guided.dtable.shared.model.LimitedEntryBRLActionColumn) BooleanUiColumn(org.drools.workbench.screens.guided.dtable.client.widget.table.columns.BooleanUiColumn) Test(org.junit.Test)

Example 4 with BooleanUiColumn

use of org.drools.workbench.screens.guided.dtable.client.widget.table.columns.BooleanUiColumn in project drools-wb by kiegroup.

the class ConditionColumnSynchronizerTest method testAppendBoolean.

@Test
public void testAppendBoolean() throws VetoException {
    // Single Pattern, single Condition
    final Pattern52 pattern = boundApplicantPattern("$a");
    final ConditionCol52 condition = new ConditionCol52();
    condition.setConstraintValueType(BaseSingleFieldConstraint.TYPE_LITERAL);
    condition.setHeader("col1");
    condition.setFactField("approved");
    condition.setOperator("==");
    // Test column append
    modelSynchronizer.appendColumn(pattern, condition);
    modelSynchronizer.appendRow();
    assertEquals(4, model.getExpandedColumns().size());
    assertEquals(1, model.getConditions().size());
    assertEquals(1, model.getConditionPattern("$a").getChildColumns().size());
    assertEquals(4, uiModel.getColumns().size());
    assertTrue(uiModel.getColumns().get(3) instanceof BooleanUiColumn);
    // Test row append (boolean cells should be instantiated for Model and UiModel)
    modelSynchronizer.appendRow();
    assertFalse(model.getData().get(0).get(3).getBooleanValue());
    assertFalse(((Boolean) uiModel.getRow(0).getCells().get(3).getValue().getValue()));
}
Also used : ConditionCol52(org.drools.workbench.models.guided.dtable.shared.model.ConditionCol52) Pattern52(org.drools.workbench.models.guided.dtable.shared.model.Pattern52) BooleanUiColumn(org.drools.workbench.screens.guided.dtable.client.widget.table.columns.BooleanUiColumn) Test(org.junit.Test)

Example 5 with BooleanUiColumn

use of org.drools.workbench.screens.guided.dtable.client.widget.table.columns.BooleanUiColumn in project drools-wb by kiegroup.

the class LimitedEntryBRLConditionColumnSynchronizerTest method testAppend.

@Test
public void testAppend() throws VetoException {
    final LimitedEntryBRLConditionColumn column = new LimitedEntryBRLConditionColumn();
    column.setHeader("col1");
    modelSynchronizer.appendColumn(column);
    assertEquals(1, model.getConditions().size());
    assertEquals(4, uiModel.getColumns().size());
    assertTrue(uiModel.getColumns().get(3) instanceof BooleanUiColumn);
    assertEquals(true, ((BaseMultipleDOMElementUiColumn) uiModel.getColumns().get(3)).isEditable());
}
Also used : LimitedEntryBRLConditionColumn(org.drools.workbench.models.guided.dtable.shared.model.LimitedEntryBRLConditionColumn) BooleanUiColumn(org.drools.workbench.screens.guided.dtable.client.widget.table.columns.BooleanUiColumn) Test(org.junit.Test)

Aggregations

BooleanUiColumn (org.drools.workbench.screens.guided.dtable.client.widget.table.columns.BooleanUiColumn)29 Test (org.junit.Test)28 ActionWorkItemInsertFactCol52 (org.drools.workbench.models.guided.dtable.shared.model.ActionWorkItemInsertFactCol52)6 ActionWorkItemSetFieldCol52 (org.drools.workbench.models.guided.dtable.shared.model.ActionWorkItemSetFieldCol52)6 ActionWorkItemCol52 (org.drools.workbench.models.guided.dtable.shared.model.ActionWorkItemCol52)5 ConditionCol52 (org.drools.workbench.models.guided.dtable.shared.model.ConditionCol52)5 LimitedEntryBRLActionColumn (org.drools.workbench.models.guided.dtable.shared.model.LimitedEntryBRLActionColumn)5 Pattern52 (org.drools.workbench.models.guided.dtable.shared.model.Pattern52)5 BaseColumnFieldDiff (org.drools.workbench.models.guided.dtable.shared.model.BaseColumnFieldDiff)4 LimitedEntryBRLConditionColumn (org.drools.workbench.models.guided.dtable.shared.model.LimitedEntryBRLConditionColumn)2 ActionInsertFactCol52 (org.drools.workbench.models.guided.dtable.shared.model.ActionInsertFactCol52)1 ActionSetFieldCol52 (org.drools.workbench.models.guided.dtable.shared.model.ActionSetFieldCol52)1 AttributeCol52 (org.drools.workbench.models.guided.dtable.shared.model.AttributeCol52)1 BaseColumn (org.drools.workbench.models.guided.dtable.shared.model.BaseColumn)1 RowNumberCol52 (org.drools.workbench.models.guided.dtable.shared.model.RowNumberCol52)1 GridData (org.uberfire.ext.wires.core.grids.client.model.GridData)1