rowModel.addRow(new TableRow());
autoRowInfo = autoGeneratedRow.getRowInfoStructure();
for (int emptyCellCnt = 0; emptyCellCnt < i; emptyCellCnt += 1)
{
final TableCellRenderBox autoCell =
new TableCellRenderBox(EmptyBoxDefinition.getInstance(), true);
autoCell.close();
autoCell.setColumnIndex(emptyCellCnt);
final DataCell dataCell = new DataCell
(1, 1, autoCell.getInstanceId());
autoRowInfo.addCell(dataCell);
autoGeneratedRow.addChild(autoCell);
}
}
final PlaceHolderCell placeHolder;
if (cell instanceof DataCell)
{
placeHolder = new PlaceHolderCell
((DataCell) cell, cell.getRowSpan() - 1, cell.getColSpan());
}
else if (cell instanceof PlaceHolderCell)
{
final PlaceHolderCell prevCell = (PlaceHolderCell) cell;
placeHolder = new PlaceHolderCell
(prevCell.getSourceCell(), cell.getRowSpan() - 1, cell.getColSpan());
}
else
{
throw new IllegalStateException("Unexpected cell type.");
}
autoRowInfo.addCell(placeHolder);
}
else if (autoGeneratedRow != null)
{
// only add, if the auto-row-box has been already generated ..
// this prevents the generation of totally empty rows ..
final TableCellRenderBox autoCell =
new TableCellRenderBox(EmptyBoxDefinition.getInstance(), true);
autoCell.close();
autoCell.setColumnIndex(i);
final DataCell dataCell = new DataCell
(1, 1, autoCell.getInstanceId());
autoRowInfo.addCell(dataCell);
autoGeneratedRow.addChild(autoCell);
}
}