use of org.uberfire.ext.wires.core.grids.client.widget.grid.selections.CellSelectionStrategy in project kie-wb-common by kiegroup.
the class LiteralExpressionUIModelMapperTest method testFromDmn_CellSelectionStrategy.
@Test
public void testFromDmn_CellSelectionStrategy() {
mapper.fromDMNModel(0, 0);
final CellSelectionStrategy strategy = uiModel.getCell(0, 0).getSelectionStrategy();
strategy.handleSelection(uiModel, 0, 0, true, false);
verify(parentGridUiCellCellSelectionStrategy).handleSelection(eq(parentGridUiModel), eq(PARENT_ROW_INDEX), eq(PARENT_COLUMN_INDEX), eq(true), eq(false));
}
use of org.uberfire.ext.wires.core.grids.client.widget.grid.selections.CellSelectionStrategy in project kie-wb-common by kiegroup.
the class UndefinedExpressionUIModelMapperTest method testFromDMNCellSelectionStrategy.
@Test
public void testFromDMNCellSelectionStrategy() {
mapper.fromDMNModel(0, 0);
final CellSelectionStrategy strategy = uiModel.getCell(0, 0).getSelectionStrategy();
strategy.handleSelection(uiModel, 0, 0, true, false);
verify(parentGridUiCellCellSelectionStrategy).handleSelection(eq(parentGridUiModel), eq(PARENT_ROW_INDEX), eq(PARENT_COLUMN_INDEX), eq(true), eq(false));
}
use of org.uberfire.ext.wires.core.grids.client.widget.grid.selections.CellSelectionStrategy in project kie-wb-common by kiegroup.
the class DMNGridPanelContextMenuHandler method selectCell.
private void selectCell(final int uiRowIndex, final int uiColumnIndex, final GridWidget gridWidget, final boolean isShiftKeyDown, final boolean isControlKeyDown) {
// Lookup CellSelectionManager for cell
final GridData gridModel = gridWidget.getModel();
CellSelectionStrategy selectionStrategy;
final GridCell<?> cell = gridModel.getCell(uiRowIndex, uiColumnIndex);
if (cell == null) {
selectionStrategy = RangeSelectionStrategy.INSTANCE;
} else {
selectionStrategy = cell.getSelectionStrategy();
}
if (selectionStrategy == null) {
return;
}
gridLayer.select(gridWidget);
// Handle selection
if (selectionStrategy.handleSelection(gridModel, uiRowIndex, uiColumnIndex, isShiftKeyDown, isControlKeyDown)) {
gridWidget.getLayer().batch();
}
}
use of org.uberfire.ext.wires.core.grids.client.widget.grid.selections.CellSelectionStrategy in project kie-wb-common by kiegroup.
the class DMNGridPanelContextMenuHandlerTest method onContextMenu_WithGridWidget_WithCellSelectionStrategy_CellNotSelected.
@Test
public void onContextMenu_WithGridWidget_WithCellSelectionStrategy_CellNotSelected() {
when(nativeEvent.getClientX()).thenReturn((int) (COLUMN0_WIDTH / 2));
when(nativeEvent.getClientY()).thenReturn((int) (HEADER_HEIGHT + ROW_HEIGHT + ROW_HEIGHT / 2));
final BaseGrid gridWidget = mockGridWidget();
when(gridLayer.getGridWidgets()).thenReturn(Collections.singleton(gridWidget));
final MockCell cell = mock(MockCell.class);
final CellSelectionStrategy selectionStrategy = mock(CellSelectionStrategy.class);
gridWidget.getModel().setCell(1, 0, () -> cell);
when(cell.getEditor()).thenReturn(Optional.of(editor));
when(cell.getSelectionStrategy()).thenReturn(selectionStrategy);
handler.onContextMenu(event);
verify(cellSelectionHandler).selectCellIfRequired(eq(1), eq(0), eq(gridWidget), eq(false), eq(false));
}
use of org.uberfire.ext.wires.core.grids.client.widget.grid.selections.CellSelectionStrategy in project kie-wb-common by kiegroup.
the class DMNGridPanelContextMenuHandlerTest method onContextMenu_WithGridWidget_WithCellSelectionStrategy_CellAlreadySelected.
@Test
public void onContextMenu_WithGridWidget_WithCellSelectionStrategy_CellAlreadySelected() {
when(nativeEvent.getClientX()).thenReturn((int) (COLUMN0_WIDTH / 2));
when(nativeEvent.getClientY()).thenReturn((int) (ROW_HEIGHT + ROW_HEIGHT / 2));
final BaseGrid gridWidget = mockGridWidget();
when(gridLayer.getGridWidgets()).thenReturn(Collections.singleton(gridWidget));
gridWidget.selectCell(1, 0, false, false);
final MockCell cell = mock(MockCell.class);
final CellSelectionStrategy selectionStrategy = mock(CellSelectionStrategy.class);
gridWidget.getModel().setCell(1, 0, () -> cell);
when(cell.getEditor()).thenReturn(Optional.of(editor));
when(cell.getSelectionStrategy()).thenReturn(selectionStrategy);
handler.onContextMenu(event);
verify(selectionStrategy, never()).handleSelection(any(GridData.class), anyInt(), anyInt(), anyBoolean(), anyBoolean());
}
Aggregations