BaseGridRenderer implements GridRenderer { Rectangle makeCellHighlight(final int rowIndex, final int visibleRowIndex, final GridData model, final BaseGridRendererHelper rendererHelper, final BaseGridRendererHelper.RenderingInformation renderingInformation, final GridColumn<?> column, final GridBodyRenderContext context) { final Rectangle r = getTheme().getHighlightedCellBackground().setListening(false); setCellHighlightX(r, context, rendererHelper); setCellHighlightY(r, rendererHelper, visibleRowIndex, model); setCellHighlightSize(r, model, column, renderingInformation.getAllRowHeights(), rowIndex); return r; } BaseGridRenderer(final GridRendererTheme theme); @Override double getHeaderHeight(); @Override double getHeaderRowHeight(); @Override GridRendererTheme getTheme(); @Override void setTheme(final GridRendererTheme theme); @Override RendererCommand renderSelector(final double width,
                                          final double height,
                                          final BaseGridRendererHelper.RenderingInformation renderingInformation); @Override RendererCommand renderSelectedCells(final GridData model,
                                               final GridBodyRenderContext context,
                                               final BaseGridRendererHelper rendererHelper,
                                               final List<GridData.SelectedCell> selectedCells,
                                               final BiFunction<SelectedRange, Integer, Double> selectedCellsYOffsetStrategy,
                                               final Function<SelectedRange, Double> selectedCellsHeightStrategy); @Override List<RendererCommand> renderHeader(final GridData model,
                                              final GridHeaderRenderContext context,
                                              final BaseGridRendererHelper rendererHelper,
                                              final BaseGridRendererHelper.RenderingInformation renderingInformation); @Override RendererCommand renderHeaderBodyDivider(final double width); @Override List<RendererCommand> renderBody(final GridData model,
                                            final GridBodyRenderContext context,
                                            final BaseGridRendererHelper rendererHelper,
                                            final BaseGridRendererHelper.RenderingInformation renderingInformation); @Override RendererCommand renderGridBoundary(final GridBoundaryRenderContext context); @Override boolean onGroupingToggle(double cellX,
                                    double cellY,
                                    double cellWidth,
                                    double cellHeight); @Override void setColumnRenderConstraint(final BiFunction<Boolean, GridColumn<?>, Boolean> columnRenderingConstraint); void clearCellHighlight(); void highlightCell(final int column, final int row); Integer getHighlightCellColumnIndex(); Integer getHighlightCellRowIndex();  }
@Test @SuppressWarnings("unchecked") public void testMakeCellHighlight() { final int rowIndex = 1; final int visibleRowIndex = 2; final List<Double> allRowHeights = new ArrayList<>(); final GridData model = mock(GridData.class); final GridRendererTheme theme = mock(GridRendererTheme.class); final Rectangle rectangle = mock(Rectangle.class); when(theme.getHighlightedCellBackground()).thenReturn(rectangle); when(rectangle.setListening(false)).thenReturn(rectangle); renderer.setTheme(theme); doNothing().when(renderer).setCellHighlightX(rectangle, context, rendererHelper); doNothing().when(renderer).setCellHighlightY(rectangle, rendererHelper, visibleRowIndex, model); doNothing().when(renderer).setCellHighlightSize(rectangle, model, column, allRowHeights, rowIndex); final Rectangle current = renderer.makeCellHighlight(rowIndex, visibleRowIndex, model, rendererHelper, renderingInformation, column, context); assertEquals(rectangle, current); }