ColumnRenderingStrategyFlattened { @SuppressWarnings({"unused", "unchecked"}) public static List<GridRenderer.RendererCommand> render(final GridColumn<?> column, final GridBodyColumnRenderContext context, final BaseGridRendererHelper rendererHelper, final BaseGridRendererHelper.RenderingInformation renderingInformation, final BiFunction<Boolean, GridColumn<?>, Boolean> columnRenderingConstraint) { final double x = context.getX(); final double absoluteGridY = context.getAbsoluteGridY(); final double absoluteColumnX = context.getAbsoluteColumnX(); final double clipMinY = context.getClipMinY(); final double clipMinX = context.getClipMinX(); final int minVisibleRowIndex = context.getMinVisibleRowIndex(); final int maxVisibleRowIndex = context.getMaxVisibleRowIndex(); final List<Double> allRowHeights = renderingInformation.getAllRowHeights(); final List<Double> visibleRowOffsets = renderingInformation.getVisibleRowOffsets(); final boolean isFloating = context.isFloating(); final GridData model = context.getModel(); final Transform transform = context.getTransform(); final GridRenderer renderer = context.getRenderer(); final GridRendererTheme theme = renderer.getTheme(); final double columnWidth = column.getWidth(); final double columnHeight = visibleRowOffsets.get(maxVisibleRowIndex - minVisibleRowIndex) - visibleRowOffsets.get(0) + allRowHeights.get(maxVisibleRowIndex); final List<GridRenderer.RendererCommand> commands = new ArrayList<>(); commands.add((GridRenderer.RenderBodyGridLinesCommand) (rc) -> { if (!rc.isSelectionLayer()) { final MultiPath bodyGrid = theme.getBodyGridLine(); for (int rowIndex = minVisibleRowIndex; rowIndex <= maxVisibleRowIndex; rowIndex++) { if (rowIndex == 0) { continue; } final double y = visibleRowOffsets.get(rowIndex - minVisibleRowIndex) - visibleRowOffsets.get(0); bodyGrid.M(x, y + 0.5) .L(x + columnWidth, y + 0.5); } final int columnIndex = model.getColumns().indexOf(column); if (columnIndex < model.getColumnCount() - 1) { bodyGrid.M(x + columnWidth + 0.5, 0) .L(x + columnWidth + 0.5, columnHeight); } rc.getGroup().add(bodyGrid); } }); commands.add((GridRenderer.RenderBodyGridContentCommand) (rc) -> { if (columnRenderingConstraint.apply(rc.isSelectionLayer(), column)) { final Group columnGroup = GWT.create(Group.class); columnGroup.setX(x); final int columnIndex = model.getColumns().indexOf(column); for (int rowIndex = minVisibleRowIndex; rowIndex <= maxVisibleRowIndex; rowIndex++) { final double y = visibleRowOffsets.get(rowIndex - minVisibleRowIndex) - visibleRowOffsets.get(0); final double rowHeight = allRowHeights.get(rowIndex); final GridBodyCellRenderContext cellContext = new GridBodyCellRenderContext(absoluteColumnX, absoluteGridY + renderer.getHeaderHeight() + visibleRowOffsets.get(rowIndex - minVisibleRowIndex), columnWidth, rowHeight, clipMinY, clipMinX, rowIndex, columnIndex, isFloating, transform, renderer); final GridCell<?> cell = model.getCell(rowIndex, columnIndex); final Group cc = column.getColumnRenderer().renderCell((GridCell) cell, cellContext); if (cc != null) { cc.setX(0).setY(y).setListening(true); columnGroup.add(cc); } } final BoundingBoxPathClipperFactory boundingBoxPathClipperFactory = GWT.create(BoundingBoxPathClipperFactory.class); final IPathClipper clipper = boundingBoxPathClipperFactory.newClipper(0, 0, columnWidth, columnHeight); columnGroup.setPathClipper(clipper); clipper.setActive(true); rc.getGroup().add(columnGroup); } }); return commands; }  @SuppressWarnings({"unused", "unchecked"}) static List<GridRenderer.RendererCommand> render(final GridColumn<?> column,
                                                            final GridBodyColumnRenderContext context,
                                                            final BaseGridRendererHelper rendererHelper,
                                                            final BaseGridRendererHelper.RenderingInformation renderingInformation,
                                                            final BiFunction<Boolean, GridColumn<?>, Boolean> columnRenderingConstraint);  }
@Test @SuppressWarnings("unchecked") public void testRenderNotSelectionLayer() { final List<Double> allRowHeights = new ArrayList<>(Collections.nCopies(3, ROW_HEIGHT)); final GridRenderer.GridRendererContext rendererContext = mock(GridRenderer.GridRendererContext.class); final Group group = mock(Group.class); doReturn(false).when(rendererContext).isSelectionLayer(); doReturn(group).when(rendererContext).getGroup(); doReturn(allRowHeights).when(renderingInformation).getAllRowHeights(); final List<GridRenderer.RendererCommand> commands = ColumnRenderingStrategyFlattened.render(column, context, rendererHelper, renderingInformation, columnRenderingConstraint); assertThat(commands).hasSize(2); commands.get(0).execute(rendererContext); verify(group).add(multiPath); verify(multiPath, never()).M(CONTEXT_X_POSITION, 0 + 0.5); verify(multiPath, never()).L(CONTEXT_X_POSITION + COLUMN_WIDTH, 0 + 0.5); verify(multiPath).M(CONTEXT_X_POSITION, ROW_HEIGHT + 0.5); verify(multiPath).L(CONTEXT_X_POSITION + COLUMN_WIDTH, ROW_HEIGHT + 0.5); verify(multiPath).M(CONTEXT_X_POSITION, ROW_HEIGHT * 2 + 0.5); verify(multiPath).L(CONTEXT_X_POSITION + COLUMN_WIDTH, ROW_HEIGHT * 2 + 0.5); verify(multiPath).M(COLUMN_WIDTH + 0.5, 0); verify(multiPath).L(COLUMN_WIDTH + 0.5, ROW_HEIGHT * 3); reset(group); commands.get(1).execute(rendererContext); verify(gridColumnRenderer).renderCell(eq(cellOne), any(GridBodyCellRenderContext.class)); verify(gridColumnRenderer).renderCell(eq(cellTwo), any(GridBodyCellRenderContext.class)); verify(gridColumnRenderer).renderCell(eq(cellThree), any(GridBodyCellRenderContext.class)); verify(boundingBoxPathClipperFactory).newClipper(0, 0, COLUMN_WIDTH, ROW_HEIGHT * 3); verify(pathClipper).setActive(true); verify(columnGroup).setX(CONTEXT_X_POSITION); verify(group).add(columnGroup); }