for (int i = 0; i < _rowIndices.size(); i++) {
int r = _rowIndices.get(i);
List<Serializable> tuple = _tuples.get(i);
Row oldRow = project.rows.get(r);
Row newRow = oldRow.dup();
_oldRows.add(oldRow);
_newRows.add(newRow);
for (int c = 0; c < tuple.size(); c++) {
Serializable value = tuple.get(c);
if (value != null) {
newRow.setCell(_firstNewCellIndex + c, new Cell(value, null));
}
}
if (_removeOriginalColumn) {
newRow.setCell(cellIndex, null);
}
}
}
int columnGroupCount = project.columnModel.columnGroups.size();
int columnCountChange = _columnNames.size() - (_removeOriginalColumn ? 1 : 0);
_oldColumnGroups = new ArrayList<ColumnGroup>(columnGroupCount);
for (int i = columnGroupCount - 1; i >= 0; i--) {
ColumnGroup columnGroup = project.columnModel.columnGroups.get(i);
_oldColumnGroups.add(columnGroup);
if (columnGroup.startColumnIndex <= _columnIndex) {
if (columnGroup.startColumnIndex + columnGroup.columnSpan > _columnIndex) {
// the column being split is in the middle of the group
if (columnGroup.keyColumnIndex == _columnIndex) {
if (_removeOriginalColumn) {
// the key column is being split and removed
project.columnModel.columnGroups.remove(i);
} else {
project.columnModel.columnGroups.set(i, new ColumnGroup(
columnGroup.startColumnIndex,
columnGroup.columnSpan + columnCountChange,
columnGroup.keyColumnIndex
));
}
} else {
project.columnModel.columnGroups.set(i, new ColumnGroup(
columnGroup.startColumnIndex,
columnGroup.columnSpan + columnCountChange,
columnGroup.keyColumnIndex < _columnIndex ?
columnGroup.keyColumnIndex :
(columnGroup.keyColumnIndex + columnCountChange)
));
}
}
} else {
// the new column precedes this whole group
project.columnModel.columnGroups.set(i, new ColumnGroup(
columnGroup.startColumnIndex + columnCountChange,
columnGroup.columnSpan,
columnGroup.keyColumnIndex + columnCountChange
));
}
}
for (int i = 0; i < _rowIndices.size(); i++) {
int r = _rowIndices.get(i);
Row newRow = _newRows.get(i);
project.rows.set(r, newRow);
}
for (int i = 0; i < _columnNames.size(); i++) {