KnuthPenalty pen = (KnuthPenalty)last;
pen.setP(-KnuthPenalty.INFINITE);
pen.setBreakClass(rowFO.getBreakBefore());
- } else if (last instanceof BreakElement) {
+ } else {//if (last instanceof BreakElement) { // TODO vh: seems the only possibility
BreakElement breakPoss = (BreakElement) last;
breakPoss.setPenaltyValue(-KnuthPenalty.INFINITE);
breakPoss.setBreakClass(rowFO.getBreakBefore());
pgus.clear();
TableRow tableRow = null;
- int minContentHeight = 0;
+ int minContentHeight = 0; // Minimum content height for the row
int maxCellHeight = 0;
int effRowContentHeight = 0;
for (int j = 0; j < row.getGridUnits().size(); j++) {
+// assert maxColumnCount == 0 || maxColumnCount == row.getGridUnits().size(); // TODO vh
maxColumnCount = Math.max(maxColumnCount, row.getGridUnits().size());
GridUnit gu = row.getGridUnit(j);
if ((gu.isPrimary() || (gu.getColSpanIndex() == 0 && gu.isLastGridUnitRowSpan()))
return halfBorderSeparationIPD;
}
- /** @see org.apache.fop.layoutmgr.LayoutManager */
+ /**
+ * Handles the Knuth elements at the table level: mainly breaks, spaces and borders
+ * before and after the table. The Knuth elements for the table cells are handled by
+ * TableContentLayoutManager.
+ *
+ * @see org.apache.fop.layoutmgr.LayoutManager
+ * @see TableContentLayoutManager#getNextKnuthElements(LayoutContext, int)
+ */
public LinkedList getNextKnuthElements(LayoutContext context, int alignment) {
LinkedList returnList = new LinkedList();
}
}
+ /*
+ * Compute the IPD and adjust it if necessary (overconstrained)
+ */
referenceIPD = context.getRefIPD();
-
if (getTable().getInlineProgressionDimension().getOptimum(this).getEnum() != EN_AUTO) {
int contentIPD = getTable().getInlineProgressionDimension().getOptimum(this)
.getLength().getValue(this);
}
updateContentAreaIPDwithOverconstrainedAdjust();
}
-
int sumOfColumns = columns.getSumOfColumnWidths(this);
if (!autoLayout && sumOfColumns > getContentAreaIPD()) {
log.debug(FONode.decorateWithContextInfo(
getTable()));
updateContentAreaIPDwithOverconstrainedAdjust(sumOfColumns);
}
-
int availableIPD = referenceIPD - getIPIndents();
if (getContentAreaIPD() > availableIPD) {
log.warn(FONode.decorateWithContextInfo(
//Spaces, border and padding to be repeated at each break
addPendingMarks(context);
+ // Elements for the table-header/footer/body
LinkedList contentKnuthElements = null;
LinkedList contentList = new LinkedList();
//Position returnPosition = new NonLeafPosition(this, null);
}
}
-}
\ No newline at end of file
+}
//TODO rows should later be a Jakarta Commons LinkedList so concurrent modifications while
//using a ListIterator are possible
- /** List of cached rows. This a list of EffRow elements. */
+ /** List of cached rows. This is a list of EffRow elements. */
private List fetchedRows = new java.util.ArrayList();
/**
private EffRow[] rowGroup;
private int totalHeight;
private int activeRow;
+ /**
+ * Knuth elements for active cells, per column. Active cells are cells spanning over
+ * the currently active row.
+ */
private List[] elementLists;
private int[] startRow;
+ /**
+ * For each column, index, in the cell's list of Knuth elements, of the element
+ * starting the current row.
+ */
private int[] start;
+ /**
+ * For each column, index, in the cell's list of Knuth elements, of the element
+ * ending the current row.
+ */
private int[] end;
+ /**
+ * For each column, widths of the Knuth elements which will be on the current row.
+ */
private int[] widths;
private int[] baseWidth;
private int[] borderBefore;
return false;
}
+ /**
+ * Returns the row currently being processed.
+ *
+ * @return the row currently being processed
+ */
private EffRow getActiveRow() {
return rowGroup[activeRow];
}
+ /**
+ * Returns the grid unit at the given column number on the active row.
+ *
+ * @param column column number of the grid unit to get
+ * @return the corresponding grid unit (may be null)
+ * @see TableStepper#getActiveRow
+ */
private GridUnit getActiveGridUnit(int column) {
return getActiveRow().safelyGetGridUnit(column);
}
if (height == 0) {
height = row.getHeight().opt;
}
- list.add(new KnuthBoxCellWithBPD(height, pgu));
+ list.add(new KnuthBoxCellWithBPD(height));
elementLists[column] = list;
} else {
//Copy elements (LinkedList) to array lists to improve
* @param context Active LayoutContext
* @param rowGroup the row group
* @param maxColumnCount the maximum number of columns to expect
- * @param bodyType Indicates what type of body is processed (boder, header or footer)
+ * @param bodyType Indicates what type of body is processed (body, header or footer)
* @return the combined element list
*/
public LinkedList getCombinedKnuthElementsForRowGroup(
return this.tclm.getTableLM();
}
+ /**
+ * Marker class denoting table cells fitting in just one box (no legal break inside).
+ */
private class KnuthBoxCellWithBPD extends KnuthBox {
- private PrimaryGridUnit pgu;
-
- public KnuthBoxCellWithBPD(int w, PrimaryGridUnit pgu) {
+ public KnuthBoxCellWithBPD(int w) {
super(w, null, true);
- this.pgu = pgu;
}
}