validationTrack = table.getChangeTracker();
return;
}
final ComputedLayoutProperties nlp = table.getComputedLayoutProperties();
final RenderLength blockContextWidth = nlp.getBlockContextWidth();
final long bcw = blockContextWidth.resolve(0);
final RenderLength borderSpacingLength = table.getBorderSpacing();
borderSpacing = borderSpacingLength.resolve(bcw);
final long totalBorderSpacing = (colCount - 1) * borderSpacing;
minimumChunkSize = totalBorderSpacing;
maxBoxSize = totalBorderSpacing;
preferredSize = totalBorderSpacing;
// first, find out how much space is already used.
final long[] minChunkSizes = new long[colCount];
final long[] maxBoxSizes = new long[colCount];
final long[] preferredSizes = new long[colCount];
// For each colspan distribute the content.
// The 1-column size also gets the preferred size ...
for (int colIdx = 0; colIdx < minChunkSizes.length; colIdx++)
{
final TableColumn column = columns[colIdx];
final long minimumChunkSize = column.getMinimumChunkSize(1);
final long maxBoxSize = column.getMaximumBoxWidth(1);
final long resolvedColWidth = column.getDefinedWidth().resolve(bcw);
final long preferredSize = Math.max
(resolvedColWidth, column.getPreferredWidth(1));
minChunkSizes[colIdx] = minimumChunkSize;
maxBoxSizes[colIdx] = maxBoxSize;
preferredSizes[colIdx] = preferredSize;
}
for (int colspan = 2; colspan <= maxColSpan; colspan += 1)
{
for (int colIdx = 0; colIdx < minChunkSizes.length; colIdx++)
{
final TableColumn column = columns[colIdx];
final long minimumChunkSize = column.getMinimumChunkSize(colspan);
final long maxBoxSize = column.getMaximumBoxWidth(colspan);
final long preferredSize = column.getPreferredWidth(colspan);
distribute(minimumChunkSize, minChunkSizes, colIdx, colspan);
distribute(preferredSize, preferredSizes, colIdx, colspan);
distribute(maxBoxSize, maxBoxSizes, colIdx, colspan);
}
}
for (int i = 0; i < minChunkSizes.length; i++)
{
final TableColumn column = columns[i];
final long cmin = minChunkSizes[i];
final long cpref = preferredSizes[i];
final long cmax = maxBoxSizes[i];
final long width = Math.max(cmin, cpref);
minimumChunkSize += cmin;
preferredSize += width;
maxBoxSize += cmax;
if (column.isValidated())
{
continue;
}
column.setComputedPreferredSize(cpref);
column.setComputedMinChunkSize(cmin);
column.setComputedMaximumWidth(cmax);
column.setEffectiveSize(width);
column.setValidated(true);
}
// Table-AutoWidth means, the tables width is based on the content of the
// cells. The minimum chunk size and the preferred sizes are the only
// metrics used in that computation.
//
// If the table's width is fixed, then we have to shrink or expand the
// columns to fit that additional requirement.
final RenderLength tableCWidth = table.getComputedLayoutProperties().getComputedWidth();
if (tableCWidth != RenderLength.AUTO)
{
final long tableSize = Math.max(tableCWidth.resolve(0), minimumChunkSize);
// the space we are able to distribute .. (This can be negative, if we
// have to remove space to get to the defined table size!)
// The space that is available for the content from the cells. The
// border-spacing eats some space as well (already in the pref-size-value)
final long extraSpace = tableSize - preferredSize;