private void fullIndex() { final List<GridColumn<?>> columns = gridData.getColumns(); for (int columnIndex = 0; columnIndex < columns.size(); columnIndex++) { indexColumn(columnIndex); } }
private void updateMergeMetaData(final int rowIndex, final int columnIndex, final int minRowIndex, final int maxRowIndex) { //Find the cell's current value final GridRow currentRow = gridData.getRow(rowIndex); final GridCell<?> currentRowCell = currentRow.getCells().get(columnIndex); //Find minimum row with a cell containing the same value as that being updated final int minBlockRowIndex = findMinRowIndex(rowIndex, columnIndex, minRowIndex, currentRowCell); //Find maximum row with a cell containing the same value as that being updated final int maxBlockRowIndex = findMaxRowIndex(rowIndex, columnIndex, maxRowIndex, currentRowCell); //Update merge meta-data updateMergeMetaData(minBlockRowIndex, maxBlockRowIndex, columnIndex); }
final int minRowIndex = findMinRowIndex(expandMinRowIndex, columnIndex, 0, currentRowCell); final int maxRowIndex = findMaxRowIndex(expandMinRowIndex, columnIndex, rows.size(), updateMergeMetaData(minRowIndex, maxRowIndex, columnIndex); bottomSplitRowCell.setMergedCellCount(maxRowIndex - expandMaxRowIndex); updateRowMergedCells(bottomSplitRow); bottomSplitRow.expand(); if (cell != null) { cell.setMergedCellCount(expandMaxRowIndex - minRowIndex); updateRowMergedCells(row);
@Override public void insertRow(final int rowIndex, final GridRow row) { this.rows.add(rowIndex, row); indexManager.onInsertRow(rowIndex); selectionsManager.onInsertRow(rowIndex); }
@Override public void setMerged(final boolean isMerged) { if (this.isMerged == isMerged) { return; } this.isMerged = isMerged; indexManager.onMerge(isMerged); selectionsManager.onMerge(isMerged); }
@Override public void expandCell(final int rowIndex, final int columnIndex) { //Data needs to be merged to expand cells if (!isMerged) { return; } final int _columnIndex = columns.get(columnIndex).getIndex(); final GridRow row = rows.get(rowIndex); final GridCell<?> cell = row.getCells().get(_columnIndex); if (cell == null) { return; } indexManager.onExpandCell(rowIndex, _columnIndex); }
@Override public void collapseCell(final int rowIndex, final int columnIndex) { //Data needs to be merged to collapse cells if (!isMerged) { return; } final int _columnIndex = columns.get(columnIndex).getIndex(); final GridRow row = rows.get(rowIndex); final GridCell<?> cell = row.getCells().get(_columnIndex); if (cell == null) { return; } if (!cell.isMerged()) { return; } indexManager.onCollapseCell(rowIndex, _columnIndex); }
@Override public Range deleteRow(final int rowIndex) { //Find row that is the "lead" in a merged collapsed block GridRow row; int minRowIndex = rowIndex; int maxRowIndex = rowIndex; while ((row = rows.get(minRowIndex)).isMerged() && row.isCollapsed() && minRowIndex > 0) { minRowIndex--; } //Find last row in a merged collapsed block do { maxRowIndex++; } while (maxRowIndex < rows.size() && rows.get(maxRowIndex).isCollapsed()); maxRowIndex--; final Range range = new Range(minRowIndex, maxRowIndex); for (int _rowIndex = minRowIndex; _rowIndex <= maxRowIndex; _rowIndex++) { rows.remove(minRowIndex); } indexManager.onDeleteRow(range); selectionsManager.onDeleteRow(range); return range; }
indexManager.onDeleteCell(range, _columnIndex);
final int minRowIndex = findMinRowIndex(expandMinRowIndex, columnIndex, 0, currentRowCell); final int maxRowIndex = findMaxRowIndex(expandMinRowIndex, columnIndex, rows.size(), updateMergeMetaData(minRowIndex, maxRowIndex, columnIndex); bottomSplitRowCell.setMergedCellCount(maxRowIndex - expandMaxRowIndex); updateRowMergedCells(bottomSplitRow); bottomSplitRow.expand(); if (cell != null) { cell.setMergedCellCount(expandMaxRowIndex - minRowIndex); updateRowMergedCells(row);
@Override public void insertRow(final int rowIndex, final GridRow row) { this.rows.add(rowIndex, row); indexManager.onInsertRow(rowIndex); selectionsManager.onInsertRow(rowIndex); }
@Override public void setMerged(final boolean isMerged) { if (this.isMerged == isMerged) { return; } this.isMerged = isMerged; indexManager.onMerge(isMerged); selectionsManager.onMerge(isMerged); }
@Override public void expandCell(final int rowIndex, final int columnIndex) { //Data needs to be merged to expand cells if (!isMerged) { return; } final int _columnIndex = columns.get(columnIndex).getIndex(); final GridRow row = rows.get(rowIndex); final GridCell<?> cell = row.getCells().get(_columnIndex); if (cell == null) { return; } indexManager.onExpandCell(rowIndex, _columnIndex); }
@Override public void collapseCell(final int rowIndex, final int columnIndex) { //Data needs to be merged to collapse cells if (!isMerged) { return; } final int _columnIndex = columns.get(columnIndex).getIndex(); final GridRow row = rows.get(rowIndex); final GridCell<?> cell = row.getCells().get(_columnIndex); if (cell == null) { return; } if (!cell.isMerged()) { return; } indexManager.onCollapseCell(rowIndex, _columnIndex); }
@Override public Range deleteRow(final int rowIndex) { //Find row that is the "lead" in a merged collapsed block GridRow row; int minRowIndex = rowIndex; int maxRowIndex = rowIndex; while ((row = rows.get(minRowIndex)).isMerged() && row.isCollapsed() && minRowIndex > 0) { minRowIndex--; } //Find last row in a merged collapsed block do { maxRowIndex++; } while (maxRowIndex < rows.size() && rows.get(maxRowIndex).isCollapsed()); maxRowIndex--; final Range range = new Range(minRowIndex, maxRowIndex); for (int _rowIndex = minRowIndex; _rowIndex <= maxRowIndex; _rowIndex++) { rows.remove(minRowIndex); } indexManager.onDeleteRow(range); selectionsManager.onDeleteRow(range); return range; }
indexManager.onDeleteCell(range, _columnIndex);
private void updateMergeMetaData(final int rowIndex, final int columnIndex, final int minRowIndex, final int maxRowIndex) { //Find the cell's current value final GridRow currentRow = gridData.getRow(rowIndex); final GridCell<?> currentRowCell = currentRow.getCells().get(columnIndex); //Find minimum row with a cell containing the same value as that being updated final int minBlockRowIndex = findMinRowIndex(rowIndex, columnIndex, minRowIndex, currentRowCell); //Find maximum row with a cell containing the same value as that being updated final int maxBlockRowIndex = findMaxRowIndex(rowIndex, columnIndex, maxRowIndex, currentRowCell); //Update merge meta-data updateMergeMetaData(minBlockRowIndex, maxBlockRowIndex, columnIndex); }
private void fullIndex() { final List<GridColumn<?>> columns = gridData.getColumns(); for (int columnIndex = 0; columnIndex < columns.size(); columnIndex++) { indexColumn(columnIndex); } }