// No column exists at that position ..
final BoxDefinition boxDefinition = columnNode.getBoxDefinition();
final Border border = boxDefinition.getBorder();
final RenderLength width = boxDefinition.getPreferredWidth();
final TableColumn column = new TableColumn(border, width, false);
final TableColumnGroup group = new TableColumnGroup();
group.addColumn(column);
columnModel.addColumnGroup(group);
colCount += 1;
}
else
{
// We do not change existing columns. That validation should be the
// first that checks column definitions, so that state should always
// be correct.
}
}
else if (node instanceof TableColumnGroupNode)
{
final TableColumnGroupNode groupNode = (TableColumnGroupNode) node;
final boolean newGroupGenerated;
final TableColumnGroup group;
if (colCount >= columnModel.getColumnCount())
{
group = new TableColumnGroup(groupNode.getBorder());
newGroupGenerated = true;
}
else
{
group = columnModel.getGroupForIndex(colCount);
newGroupGenerated = false;
}
RenderNode groupColNode = groupNode.getFirstChild();
while (groupColNode != null)
{
if (groupColNode instanceof TableColumnNode)
{
final TableColumnNode columnNode = (TableColumnNode) groupColNode;
if (colCount >= columnModel.getColumnCount())
{
final BoxDefinition boxDefinition = columnNode.getBoxDefinition();
final Border border = boxDefinition.getBorder();
final RenderLength width = boxDefinition.getPreferredWidth();
final TableColumn column = new TableColumn(border, width, false);
group.addColumn(column);
}
else
{
colCount += 1;
}
}
else
{
// ignore silently ..
}
groupColNode = groupColNode.getNext();
}
if (newGroupGenerated)
{
columnModel.addColumnGroup(group);
colCount += group.getColumnCount();
}
}
else if (node instanceof TableSectionRenderBox)
{