@Test public void testUpdateRowNumbers() { setupUiModel(Pair.newPair(new RowNumberColumn(), (rowIndex) -> new BaseGridCellValue<>(rowIndex + 1))); assertRowNumberValues(); gridData.moveRowTo(0, gridData.getRow(ROW_COUNT - 1)); CommandUtils.updateRowNumbers(gridData, IntStream.range(0, ROW_COUNT)); assertRowNumberValues(); }
public static void updateRowNumbers(final GridData uiModel, final IntStream rangeOfRowsToUpdate) { final Optional<GridColumn<?>> rowNumberColumn = uiModel .getColumns() .stream() .filter(column -> column instanceof IsRowDragHandle) .findFirst(); rowNumberColumn.ifPresent(c -> { final int columnIndex = uiModel.getColumns().indexOf(c); rangeOfRowsToUpdate.forEach( rowIndex -> uiModel.setCellValue(rowIndex, columnIndex, new BaseGridCellValue<>(rowIndex + 1)) ); }); }
CommandUtils { public static void updateRowNumbers(final GridData uiModel, final IntStream rangeOfRowsToUpdate) { final Optional<GridColumn<?>> rowNumberColumn = uiModel .getColumns() .stream() .filter(column -> column instanceof IsRowDragHandle) .findFirst(); rowNumberColumn.ifPresent(c -> { final int columnIndex = uiModel.getColumns().indexOf(c); rangeOfRowsToUpdate.forEach( rowIndex -> uiModel.setCellValue(rowIndex, columnIndex, new BaseGridCellValue<>(rowIndex + 1)) ); }); } }
CommandUtils { public static void updateRowNumbers(final GridData uiModel, final IntStream rangeOfRowsToUpdate) { final Optional<GridColumn<?>> rowNumberColumn = uiModel .getColumns() .stream() .filter(column -> column instanceof IsRowDragHandle) .findFirst(); rowNumberColumn.ifPresent(c -> { final int columnIndex = uiModel.getColumns().indexOf(c); rangeOfRowsToUpdate.forEach( rowIndex -> uiModel.setCellValue(rowIndex, columnIndex, new BaseGridCellValue<>(rowIndex + 1)) ); }); }  }
CommandUtils { public static void updateRowNumbers(final GridData uiModel, final IntStream rangeOfRowsToUpdate) { final Optional<GridColumn<?>> rowNumberColumn = uiModel .getColumns() .stream() .filter(column -> column instanceof IsRowDragHandle) .findFirst(); rowNumberColumn.ifPresent(c -> { final int columnIndex = uiModel.getColumns().indexOf(c); rangeOfRowsToUpdate.forEach( rowIndex -> uiModel.setCellValue(rowIndex, columnIndex, new BaseGridCellValue<>(rowIndex + 1)) ); }); }  static void updateRowNumbers(final GridData uiModel,
                                        final IntStream rangeOfRowsToUpdate); static void moveRows(final List<T> allRows,
                                    final List<T> rowsToMove,
                                    final int index); static void moveComponentWidths(final int index,
                                           final int oldIndex,
                                           final List<Double> componentWidths,
                                           final List<Integer> uiColumnIndexes); static void updateParentInformation(final GridData uiModel); static Optional<GridCellValue<?>> extractGridCellValue(final GridCellTuple cellTuple); }
CommandUtils { public static void updateRowNumbers(final GridData uiModel, final IntStream rangeOfRowsToUpdate) { final Optional<GridColumn<?>> rowNumberColumn = uiModel .getColumns() .stream() .filter(column -> column instanceof IsRowDragHandle) .findFirst(); rowNumberColumn.ifPresent(c -> { final int columnIndex = uiModel.getColumns().indexOf(c); rangeOfRowsToUpdate.forEach( rowIndex -> uiModel.setCellValue(rowIndex, columnIndex, new BaseGridCellValue<>(rowIndex + 1)) ); }); }  static void updateRowNumbers(final GridData uiModel,
                                        final IntStream rangeOfRowsToUpdate); static void moveRows(final List<T> allRows,
                                    final List<T> rowsToMove,
                                    final int index); static void moveComponentWidths(final int index,
                                           final int oldIndex,
                                           final List<Double> componentWidths,
                                           final List<Integer> uiColumnIndexes); static void updateParentInformation(final GridData uiModel); static Optional<GridCellValue<?>> extractGridCellValue(final GridCellTuple cellTuple);  }