// (damn, users, fix your table definitions!)
final ConflictingCell prevConflictCell = (ConflictingCell) prevCell;
final int count = prevConflictCell.getConflictingCellCount();
for (int x = 0; x < count; x++)
{
final PlaceHolderCell phc = prevConflictCell.getConflictingCell(x);
if (phc.getRowSpan() > 1)
{
final PlaceHolderCell placeHolderCell =
new PlaceHolderCell(phc.getSourceCell(),
phc.getRowSpan() - 1,
phc.getColSpan());
conflictingCell.addConflictingCell(placeHolderCell);
}
}
}
else if (prevCell instanceof PlaceHolderCell)
{
final PlaceHolderCell prevPHCell = (PlaceHolderCell) prevCell;
// a new conflict ...
final PlaceHolderCell placeHolderCell =
new PlaceHolderCell(prevPHCell.getSourceCell(),
prevCell.getRowSpan() - 1,
prevCell.getColSpan());
conflictingCell.addConflictingCell(placeHolderCell);
}
else if (prevCell instanceof DataCell)
{
final PlaceHolderCell placeHolderCell =
new PlaceHolderCell((DataCell) prevCell,
prevCell.getRowSpan() - 1,
prevCell.getColSpan());
conflictingCell.addConflictingCell(placeHolderCell);
}
else
{
throw new IllegalStateException("Unexpected cell type.");
}
infoStruct.addCell(conflictingCell);
}
else
{
final PlaceHolderCell placeHolderCell =
new PlaceHolderCell(dataCell, rowSpan, colSpan - i);
// a safe position. No conflicts ..
infoStruct.addCell(placeHolderCell);
}
}
else
{
final PlaceHolderCell placeHolderCell =
new PlaceHolderCell(dataCell, rowSpan, colSpan - i);
// no cells means: no conflicts. Thats always the easiest thing
infoStruct.addCell(placeHolderCell);
}
cellPosition += 1;
}