use of org.uberfire.ext.wires.core.grids.client.model.GridData in project drools-wb by kiegroup.
the class GuidedDecisionTableModellerContextMenuSupportTest method onContextMenuWithCellSelectionManagerWithoutChangeInSelection.
@Test
@SuppressWarnings("unchecked")
public void onContextMenuWithCellSelectionManagerWithoutChangeInSelection() {
final GuidedDecisionTableView.Presenter dtPresenter = makeDecisionTable();
final GridData uiModel = dtPresenter.getView().getModel();
final GridColumn uiColumn = new RowNumberColumn();
uiModel.appendColumn(uiColumn);
when(columnInformation.getColumn()).thenReturn(uiColumn);
when(modellerPresenter.getAvailableDecisionTables()).thenReturn(new HashSet<GuidedDecisionTableView.Presenter>() {
{
add(dtPresenter);
}
});
when(uiModel.getCell(any(Integer.class), any(Integer.class))).thenReturn(uiCell);
final ContextMenuHandler handler = contextMenuSupport.getContextMenuHandler(modellerPresenter);
handler.onContextMenu(event);
verify(cellSelectionStrategy, times(1)).handleSelection(eq(uiModel), eq(0), eq(0), eq(false), eq(false));
verify(layer, never()).batch();
}
use of org.uberfire.ext.wires.core.grids.client.model.GridData in project drools-wb by kiegroup.
the class ColumnHeaderPopOverHandler method getHeaderRowsYOffset.
private double getHeaderRowsYOffset(final GridWidget gridWidget) {
final GridData model = gridWidget.getModel();
final int headerRowCount = model.getHeaderRowCount();
final GridRenderer renderer = gridWidget.getRenderer();
final double headerHeight = renderer.getHeaderHeight();
final double headerRowHeight = renderer.getHeaderRowHeight();
final double headerRowsHeight = headerRowHeight * headerRowCount;
final double headerRowsYOffset = headerHeight - headerRowsHeight;
return headerRowsYOffset;
}
use of org.uberfire.ext.wires.core.grids.client.model.GridData in project drools-wb by kiegroup.
the class GuidedDecisionTablePresenterTest method onDeleteSelectedRowsWithSelections.
@Test
public void onDeleteSelectedRowsWithSelections() throws VetoException {
final GridData uiModel = dtPresenter.getUiModel();
uiModel.selectCell(0, 0);
uiModel.selectCell(2, 0);
dtPresenter.onDeleteSelectedRows();
verify(synchronizer, times(1)).deleteRow(eq(0));
verify(synchronizer, times(1)).deleteRow(eq(1));
checkDTSelectionsChangedEventFired(4);
}
use of org.uberfire.ext.wires.core.grids.client.model.GridData in project drools-wb by kiegroup.
the class GuidedDecisionTablePresenterTest method onInsertRowBelowMultipleRowsSelected.
@Test
public void onInsertRowBelowMultipleRowsSelected() throws VetoException {
final GridData uiModel = dtPresenter.getUiModel();
uiModel.selectCell(0, 0);
uiModel.selectCell(1, 0);
dtPresenter.onInsertRowBelow();
verify(synchronizer, never()).insertRow(any(Integer.class));
}
use of org.uberfire.ext.wires.core.grids.client.model.GridData 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());
}
Aggregations