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());
}
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());
}
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);
}
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());
}
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);
}
Aggregations