BaseGridRendererHelper { public double getRowOffset(final GridRow row) { final GridData model = view.getModel(); final int rowIndex = model.getRows().indexOf(row); return getRowOffset(rowIndex); } BaseGridRendererHelper(final GridWidget view); double getColumnOffset(final GridColumn<?> column); double getColumnOffset(final int columnIndex); double getColumnOffset(final List<GridColumn<?>> columns,
                                  final int columnIndex); double getRowOffset(final GridRow row); double getRowOffset(final int rowIndex); double getRowOffset(final GridRow row,
                               final List<Double> rowHeights); double getRowOffset(final int rowIndex,
                               final List<Double> rowHeights); double getWidth(final List<GridColumn<?>> columns); RenderingInformation getRenderingInformation(); ColumnInformation getColumnInformation(final double cx);  }
@Test public void testGetRowOffsetWithObject() { assertThat(helper.getRowOffset(uiRow1)).isEqualTo(0.0); assertThat(helper.getRowOffset(uiRow2)).isEqualTo(uiRow1.getHeight()); assertThat(helper.getRowOffset(uiRow3)).isEqualTo(uiRow1.getHeight() + uiRow2.getHeight()); }
@Test public void testGetRowOffsetWithIndex() { assertThat(helper.getRowOffset(0)).isEqualTo(0.0); assertThat(helper.getRowOffset(1)).isEqualTo(uiRow1.getHeight()); assertThat(helper.getRowOffset(2)).isEqualTo(uiRow1.getHeight() + uiRow2.getHeight()); }
@Test public void testGetRowOffsetWithObjectAndExplicitRowHeights() { final List<Double> allRowHeights = new ArrayList<>(Arrays.asList(uiRow1.getHeight(), uiRow2.getHeight(), uiRow3.getHeight())); assertThat(helper.getRowOffset(uiRow1, allRowHeights)).isEqualTo(0.0); assertThat(helper.getRowOffset(uiRow2, allRowHeights)).isEqualTo(uiRow1.getHeight()); assertThat(helper.getRowOffset(uiRow3, allRowHeights)).isEqualTo(uiRow1.getHeight() + uiRow2.getHeight()); }
@Test public void testGetRowOffsetWithIndexAndExplicitRowHeights() { final List<Double> allRowHeights = new ArrayList<>(Arrays.asList(uiRow1.getHeight(), uiRow2.getHeight(), uiRow3.getHeight())); assertThat(helper.getRowOffset(0, allRowHeights)).isEqualTo(0.0); assertThat(helper.getRowOffset(1, allRowHeights)).isEqualTo(uiRow1.getHeight()); assertThat(helper.getRowOffset(2, allRowHeights)).isEqualTo(uiRow1.getHeight() + uiRow2.getHeight()); }