@Override public void moveRowsTo(final int index, final List<GridRow> rows) { if (rows == null || rows.isEmpty()) { return; } //Get extent of block being moved final int oldBlockStart = this.rows.indexOf(rows.get(0)); final int oldBlockEnd = this.rows.indexOf(rows.get(rows.size() - 1)); //If we're attempting to move it to its current index just exit if (index == oldBlockStart) { return; } this.rows.removeAll(rows); if (index < oldBlockStart) { this.rows.addAll(index, rows); } else if (index > oldBlockStart) { this.rows.addAll(index - rows.size() + 1, rows); } final Range oldBlockExtent = new Range(oldBlockStart, oldBlockEnd); indexManager.onMoveRows(rows, oldBlockExtent); selectionsManager.onMoveRows(rows, oldBlockExtent); }
@Override public void moveRowsTo(final int index, final List<GridRow> rows) { if (rows == null || rows.isEmpty()) { return; } //Get extent of block being moved final int oldBlockStart = this.rows.indexOf(rows.get(0)); final int oldBlockEnd = this.rows.indexOf(rows.get(rows.size() - 1)); //If we're attempting to move it to its current index just exit if (index == oldBlockStart) { return; } this.rows.removeAll(rows); if (index < oldBlockStart) { this.rows.addAll(index, rows); } else if (index > oldBlockStart) { this.rows.addAll(index - rows.size() + 1, rows); } final Range oldBlockExtent = new Range(oldBlockStart, oldBlockEnd); indexManager.onMoveRows(rows, oldBlockExtent); selectionsManager.onMoveRows(rows, oldBlockExtent); }