use of org.uberfire.ext.wires.core.grids.client.widget.grid.columns.RowNumberColumn in project kie-wb-common by kiegroup.
the class BaseExpressionGridRenderingTest method setup.
@Before
@Override
public void setup() {
super.setup();
doReturn(false).when(context).isSelection();
doReturn(new BaseBounds(0, 0, 1000, 1000)).when(gridLayer).getVisibleBounds();
grid.getModel().appendColumn(new RowNumberColumn());
grid.getModel().appendRow(new DMNGridRow());
doReturn(renderSelectorCommand).when(renderer).renderSelector(anyDouble(), anyDouble(), any(BaseGridRendererHelper.RenderingInformation.class));
doReturn(renderSelectedCellsCommand).when(renderer).renderSelectedCells(any(GridData.class), any(GridBodyRenderContext.class), any(BaseGridRendererHelper.class));
final List<RendererCommand> renderHeaderCommands = new ArrayList<>();
renderHeaderCommands.add(renderHeaderBackgroundCommand);
renderHeaderCommands.add(renderHeaderGridLinesCommand);
renderHeaderCommands.add(renderHeaderContentCommand);
doReturn(renderHeaderCommands).when(renderer).renderHeader(any(GridData.class), any(GridHeaderRenderContext.class), any(BaseGridRendererHelper.class), any(BaseGridRendererHelper.RenderingInformation.class));
final List<RendererCommand> renderBodyCommands = new ArrayList<>();
renderBodyCommands.add(renderBodyGridBackgroundCommand);
renderBodyCommands.add(renderBodyGridLinesCommand);
renderBodyCommands.add(renderBodyGridContentCommand);
doReturn(renderBodyCommands).when(renderer).renderBody(any(GridData.class), any(GridBodyRenderContext.class), any(BaseGridRendererHelper.class), any(BaseGridRendererHelper.RenderingInformation.class));
doReturn(renderHeaderBodyDividerCommand).when(renderer).renderHeaderBodyDivider(anyDouble());
doReturn(renderGridBoundaryCommand).when(renderer).renderGridBoundary(any(GridBoundaryRenderContext.class));
doReturn(BaseExpressionGridRenderer.HEADER_HEIGHT).when(renderer).getHeaderHeight();
}
use of org.uberfire.ext.wires.core.grids.client.widget.grid.columns.RowNumberColumn in project kie-wb-common by kiegroup.
the class BaseFunctionSupplementaryGridTest method testInitialSetupFromDefinition.
@Test
public void testInitialSetupFromDefinition() {
setupGrid(0);
final GridData uiModel = grid.getModel();
assertTrue(uiModel instanceof FunctionSupplementaryGridData);
assertEquals(3, uiModel.getColumnCount());
assertTrue(uiModel.getColumns().get(0) instanceof RowNumberColumn);
assertTrue(uiModel.getColumns().get(1) instanceof NameColumn);
assertTrue(uiModel.getColumns().get(2) instanceof ExpressionEditorColumn);
assertEquals(2, uiModel.getRowCount());
final String[] expectedNames = getExpectedNames();
for (int i = 0; i < uiModel.getRowCount(); i++) {
assertEquals(i + 1, uiModel.getCell(i, 0).getValue().getValue());
assertEquals(expectedNames[i], uiModel.getCell(i, 1).getValue().getValue());
assertTrue(uiModel.getCell(i, 2).getValue() instanceof ExpressionCellValue);
final ExpressionCellValue dcv = (ExpressionCellValue) uiModel.getCell(i, 2).getValue();
assertEquals(literalExpressionEditor, dcv.getValue().get());
}
}
use of org.uberfire.ext.wires.core.grids.client.widget.grid.columns.RowNumberColumn in project kie-wb-common by kiegroup.
the class BaseExpressionGridGeneralTest method testAdjustSelectionHandling_HeaderCells.
@Test
public void testAdjustSelectionHandling_HeaderCells() {
grid.getModel().appendColumn(new RowNumberColumn());
grid.getModel().appendRow(new BaseGridRow());
grid.selectCell(0, 0, false, false);
reset(grid);
grid.adjustSelection(SelectionExtension.UP, false);
verify(grid).doAfterHeaderSelectionChange(0, 0);
}
use of org.uberfire.ext.wires.core.grids.client.widget.grid.columns.RowNumberColumn in project kie-wb-common by kiegroup.
the class BaseExpressionGridGeneralTest method testSelectHeaderWithPoint.
@Test
public void testSelectHeaderWithPoint() {
grid.getModel().appendColumn(new RowNumberColumn());
grid.getModel().appendColumn(new RowNumberColumn());
final Point2D point = mock(Point2D.class);
final double columnOffset = grid.getModel().getColumns().get(0).getWidth();
final double columnWidth = grid.getModel().getColumns().get(1).getWidth() / 2;
when(point.getX()).thenReturn(columnOffset + columnWidth);
when(point.getY()).thenReturn(HEADER_HEIGHT / 2);
when(grid.getHeader()).thenReturn(header);
when(header.getY()).thenReturn(0.0);
when(renderer.getHeaderHeight()).thenReturn(HEADER_HEIGHT);
when(renderer.getHeaderRowHeight()).thenReturn(HEADER_HEIGHT);
grid.selectHeaderCell(point, false, false);
assertHeaderSelection();
assertDomainObjectEventFiring();
}
use of org.uberfire.ext.wires.core.grids.client.widget.grid.columns.RowNumberColumn in project kie-wb-common by kiegroup.
the class BaseExpressionGridGeneralTest method testAdjustSelectionHandling_DataCells.
@Test
public void testAdjustSelectionHandling_DataCells() {
grid.getModel().appendColumn(new RowNumberColumn());
grid.getModel().appendRow(new BaseGridRow());
grid.selectHeaderCell(0, 0, false, false);
reset(grid);
grid.adjustSelection(SelectionExtension.DOWN, false);
verify(grid).doAfterSelectionChange(0, 0);
}
Aggregations