Search in sources :

Example 66 with AttributeCol52

use of org.drools.workbench.models.guided.dtable.shared.model.AttributeCol52 in project drools-wb by kiegroup.

the class GuidedDecisionTablePresenterTest method onDeleteSelectedCellsWithSelectionsWithBooleanColumn.

@Test
public void onDeleteSelectedCellsWithSelectionsWithBooleanColumn() {
    final AttributeCol52 column = new AttributeCol52() {

        {
            setAttribute(RuleAttributeWidget.ENABLED_ATTR);
        }
    };
    dtPresenter.appendColumn(column);
    final GridData uiModel = dtPresenter.getUiModel();
    uiModel.selectCell(0, 1);
    uiModel.selectCell(0, 2);
    final ArgumentCaptor<Integer> columnIndexCaptor = ArgumentCaptor.forClass(Integer.class);
    final ArgumentCaptor<GridData.Range> rowRangeCaptor = ArgumentCaptor.forClass(GridData.Range.class);
    dtPresenter.onDeleteSelectedCells();
    verify(synchronizer, times(1)).deleteCell(rowRangeCaptor.capture(), columnIndexCaptor.capture());
    verify(synchronizer, never()).deleteCell(any(GridData.Range.class), eq(2));
    checkDTSelectionsChangedEventFired(3);
    final GridCell<?> booleanCell = uiModel.getCell(0, 2);
    assertNotNull(booleanCell);
    assertFalse((Boolean) booleanCell.getValue().getValue());
    final Integer columnIndex = columnIndexCaptor.getValue();
    final GridData.Range rowRange = rowRangeCaptor.getValue();
    assertEquals(0, rowRange.getMinRowIndex());
    assertEquals(0, rowRange.getMaxRowIndex());
    assertEquals(1, columnIndex.intValue());
}
Also used : AttributeCol52(org.drools.workbench.models.guided.dtable.shared.model.AttributeCol52) GridData(org.uberfire.ext.wires.core.grids.client.model.GridData) BaseGridData(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData) Test(org.junit.Test)

Example 67 with AttributeCol52

use of org.drools.workbench.models.guided.dtable.shared.model.AttributeCol52 in project drools-wb by kiegroup.

the class GuidedDecisionTablePresenterTest method hasColumnDefinitionsWithAttributeColumn.

@Test
public void hasColumnDefinitionsWithAttributeColumn() {
    final AttributeCol52 attribute = new AttributeCol52();
    attribute.setAttribute("attribute");
    dtPresenter.getModel().getAttributeCols().add(attribute);
    assertTrue(dtPresenter.hasColumnDefinitions());
}
Also used : AttributeCol52(org.drools.workbench.models.guided.dtable.shared.model.AttributeCol52) Test(org.junit.Test)

Example 68 with AttributeCol52

use of org.drools.workbench.models.guided.dtable.shared.model.AttributeCol52 in project drools-wb by kiegroup.

the class AttributeColumnSynchronizer method delete.

@Override
public void delete(final ColumnMetaData metaData) throws VetoException {
    // Check operation is supported
    if (!handlesDelete(metaData)) {
        return;
    }
    final AttributeCol52 column = (AttributeCol52) metaData.getColumn();
    final int columnIndex = model.getExpandedColumns().indexOf(column);
    model.getAttributeCols().remove(column);
    synchroniseDeleteColumn(columnIndex);
}
Also used : AttributeCol52(org.drools.workbench.models.guided.dtable.shared.model.AttributeCol52)

Example 69 with AttributeCol52

use of org.drools.workbench.models.guided.dtable.shared.model.AttributeCol52 in project drools-wb by kiegroup.

the class GridWidgetColumnFactoryImplTest method columnResizingListenerSetup_AttributeColumn.

@Test
public void columnResizingListenerSetup_AttributeColumn() {
    final AttributeCol52 column = new AttributeCol52();
    column.setAttribute(RuleAttributeWidget.SALIENCE_ATTR);
    final GridColumn<?> uiColumn = factory.convertColumn(column, access, gridWidget);
    assertTrue(uiColumn instanceof BaseUiColumn);
    assertEquals((int) uiColumn.getWidth(), column.getWidth());
    uiColumn.setWidth(200.0);
    assertEquals(200, column.getWidth());
}
Also used : AttributeCol52(org.drools.workbench.models.guided.dtable.shared.model.AttributeCol52) BaseUiColumn(org.drools.workbench.screens.guided.dtable.client.widget.table.columns.BaseUiColumn) Test(org.junit.Test)

Example 70 with AttributeCol52

use of org.drools.workbench.models.guided.dtable.shared.model.AttributeCol52 in project drools-wb by kiegroup.

the class AttributeColumnSynchronizerTest method testMoveColumnsTo_MoveRight.

@Test
public void testMoveColumnsTo_MoveRight() throws VetoException {
    final AttributeCol52 column1 = new AttributeCol52();
    column1.setAttribute(RuleAttributeWidget.SALIENCE_ATTR);
    final AttributeCol52 column2 = new AttributeCol52();
    column2.setAttribute(RuleAttributeWidget.AGENDA_GROUP_ATTR);
    final AttributeCol52 column3 = new AttributeCol52();
    column3.setAttribute(RuleAttributeWidget.AUTO_FOCUS_ATTR);
    modelSynchronizer.appendColumn(column1);
    modelSynchronizer.appendColumn(column2);
    modelSynchronizer.appendColumn(column3);
    modelSynchronizer.appendRow();
    uiModel.setCellValue(0, 2, new BaseGridCellValue<Integer>(1));
    uiModel.setCellValue(0, 3, new BaseGridCellValue<String>("smurf"));
    uiModel.setCellValue(0, 4, new BaseGridCellValue<Boolean>(true));
    final GridColumn<?> uiModelColumn1_1 = uiModel.getColumns().get(2);
    final GridColumn<?> uiModelColumn2_1 = uiModel.getColumns().get(3);
    final GridColumn<?> uiModelColumn3_1 = uiModel.getColumns().get(4);
    assertTestMoveColumnsTo(column1, column2, column3, uiModelColumn1_1, uiModelColumn2_1, uiModelColumn3_1);
    uiModel.moveColumnsTo(4, new ArrayList<GridColumn<?>>() {

        {
            add(uiModelColumn1_1);
            add(uiModelColumn2_1);
        }
    });
    final GridColumn<?> uiModelColumn1_2 = uiModel.getColumns().get(2);
    final GridColumn<?> uiModelColumn2_2 = uiModel.getColumns().get(3);
    final GridColumn<?> uiModelColumn3_2 = uiModel.getColumns().get(4);
    assertTestMoveColumnsTo(column1, column2, column3, uiModelColumn1_2, uiModelColumn2_2, uiModelColumn3_2);
}
Also used : AttributeCol52(org.drools.workbench.models.guided.dtable.shared.model.AttributeCol52) GridColumn(org.uberfire.ext.wires.core.grids.client.model.GridColumn) Test(org.junit.Test)

Aggregations

AttributeCol52 (org.drools.workbench.models.guided.dtable.shared.model.AttributeCol52)86 Test (org.junit.Test)55 DTCellValue52 (org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52)30 GuidedDecisionTable52 (org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52)20 BaseColumn (org.drools.workbench.models.guided.dtable.shared.model.BaseColumn)14 ArrayList (java.util.ArrayList)12 ConditionCol52 (org.drools.workbench.models.guided.dtable.shared.model.ConditionCol52)12 DescriptionCol52 (org.drools.workbench.models.guided.dtable.shared.model.DescriptionCol52)10 RowNumberCol52 (org.drools.workbench.models.guided.dtable.shared.model.RowNumberCol52)10 Pattern52 (org.drools.workbench.models.guided.dtable.shared.model.Pattern52)9 ActionInsertFactCol52 (org.drools.workbench.models.guided.dtable.shared.model.ActionInsertFactCol52)8 ActionSetFieldCol52 (org.drools.workbench.models.guided.dtable.shared.model.ActionSetFieldCol52)8 MetadataCol52 (org.drools.workbench.models.guided.dtable.shared.model.MetadataCol52)7 IOException (java.io.IOException)6 InputStream (java.io.InputStream)6 ExcelParser (org.drools.decisiontable.parser.xls.ExcelParser)6 DataListener (org.drools.template.parser.DataListener)6 ConversionResult (org.drools.workbench.models.guided.dtable.shared.conversion.ConversionResult)6 ActionCol52 (org.drools.workbench.models.guided.dtable.shared.model.ActionCol52)5 IntegerUiColumn (org.drools.workbench.screens.guided.dtable.client.widget.table.columns.IntegerUiColumn)5