You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by vh...@apache.org on 2007/07/17 19:53:50 UTC
svn commit: r556991 - in
/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table:
ActiveCell.java TableStepper.java
Author: vhennebert
Date: Tue Jul 17 10:53:50 2007
New Revision: 556991
URL: http://svn.apache.org/viewvc?view=rev&rev=556991
Log:
- Compute the height of already handled rows progressively in TableStepper
- Give this information to the ActiveCell constructor. This allows to:
- avoid passing the row-group to the constructor
- avoid re-computing it for each cell starting on the current row
Modified:
xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/ActiveCell.java
xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableStepper.java
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/ActiveCell.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/ActiveCell.java?view=diff&rev=556991&r1=556990&r2=556991
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/ActiveCell.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/ActiveCell.java Tue Jul 17 10:53:50 2007
@@ -43,7 +43,7 @@
*/
private int width;
private int remainingLength;
- private int baseWidth;
+ private int previousRowsLength;
private int totalLength;
private int includedLength;
private int borderBefore;
@@ -53,7 +53,7 @@
private boolean keepWithNextSignal;
private int lastPenaltyLength;
- ActiveCell(PrimaryGridUnit pgu, EffRow row, int rowIndex, EffRow[] rowGroup, TableLayoutManager tableLM) {
+ ActiveCell(PrimaryGridUnit pgu, EffRow row, int rowIndex, int previousRowsLength, TableLayoutManager tableLM) {
this.pgu = pgu;
boolean makeBoxForWholeRow = false;
if (row.getExplicitHeight().min > 0) {
@@ -80,6 +80,9 @@
// log.trace("column " + (column+1) + ": recording " + elementLists.size() + " element(s)");
// }
}
+ includedLength = -1; // Avoid troubles with cells having content of zero length
+ this.previousRowsLength = previousRowsLength;
+ width = previousRowsLength;
totalLength = ElementListUtils.calcContentLength(elementList);
if (pgu.getTable().isSeparateBorderModel()) {
borderBefore = pgu.getBorders().getBorderBeforeWidth(false)
@@ -96,20 +99,10 @@
end = -1;
startRow = rowIndex;
keepWithNextSignal = false;
- computeBaseWidth(rowGroup);
remainingLength = totalLength;
goToNextLegalBreak();
}
- private void computeBaseWidth(EffRow[] rowGroup) {
- width = 0;
- includedLength = -1; // Avoid troubles with cells having content of zero length
- for (int prevRow = 0; prevRow < startRow; prevRow++) {
- width += rowGroup[prevRow].getHeight().opt;
- }
- baseWidth = width;
- }
-
boolean endsOnRow(int rowIndex) {
return rowIndex == startRow + pgu.getCell().getNumberRowsSpanned() - 1;
}
@@ -177,7 +170,7 @@
computeRemainingLength();
return false;
} else {
- return baseWidth + borderBefore + borderAfter + paddingBefore + paddingAfter > minStep;
+ return previousRowsLength + borderBefore + borderAfter + paddingBefore + paddingAfter > minStep;
}
}
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableStepper.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableStepper.java?view=diff&rev=556991&r1=556990&r2=556991
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableStepper.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableStepper.java Tue Jul 17 10:53:50 2007
@@ -49,6 +49,7 @@
/** Number of columns in the row group. */
private int columnCount;
private int totalHeight;
+ private int previousRowsLength = 0;
private int activeRowIndex;
private boolean rowBacktrackForLastStep;
private boolean skippedStep;
@@ -128,7 +129,7 @@
for (int i = 0; i < columnCount; i++) {
GridUnit gu = getActiveGridUnit(i);
if (gu != null && !gu.isEmpty() && gu.isPrimary()) {
- activeCells.add(new ActiveCell((PrimaryGridUnit) gu, row, activeRowIndex, rowGroup, getTableLM()));
+ activeCells.add(new ActiveCell((PrimaryGridUnit) gu, row, activeRowIndex, previousRowsLength, getTableLM()));
}
}
}
@@ -347,6 +348,7 @@
"break-after ignored on table-row because of row spanning "
+ "in progress (See XSL 1.0, 7.19.1)", rowFO));
}
+ previousRowsLength += rowGroup[activeRowIndex].getHeight().opt;
activeRowIndex++;
if (log.isDebugEnabled()) {
log.debug("===> new row: " + activeRowIndex);
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org