git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@614845 13f79535-47bb-0310-9956-ffa450edef68tags/fop-0_95beta
@@ -136,7 +136,6 @@ class RowGroupLayoutManager { | |||
MinOptMax[] rowHeights = new MinOptMax[rowGroup.length]; | |||
MinOptMax[] explicitRowHeights = new MinOptMax[rowGroup.length]; | |||
EffRow row; | |||
int maxColumnCount = 0; | |||
List pgus = new java.util.ArrayList(); //holds a list of a row's primary grid units | |||
for (int rgi = 0; rgi < rowGroup.length; rgi++) { | |||
row = rowGroup[rgi]; | |||
@@ -151,8 +150,6 @@ class RowGroupLayoutManager { | |||
// The BPD of the biggest cell in the row | |||
int maxCellBPD = 0; | |||
for (int j = 0; j < row.getGridUnits().size(); j++) { | |||
assert maxColumnCount == 0 || maxColumnCount == row.getGridUnits().size(); | |||
maxColumnCount = Math.max(maxColumnCount, row.getGridUnits().size()); | |||
GridUnit gu = row.getGridUnit(j); | |||
if ((gu.isPrimary() || (gu.getColSpanIndex() == 0 && gu.isLastGridUnitRowSpan())) | |||
&& !gu.isEmpty()) { | |||
@@ -281,8 +278,8 @@ class RowGroupLayoutManager { | |||
log.debug(" height=" + rowHeights[i] + " explicit=" + explicitRowHeights[i]); | |||
} | |||
} | |||
LinkedList returnedList = tableStepper.getCombinedKnuthElementsForRowGroup( | |||
context, rowGroup, maxColumnCount, bodyType); | |||
LinkedList returnedList = tableStepper.getCombinedKnuthElementsForRowGroup(context, | |||
rowGroup, bodyType); | |||
if (returnedList != null) { | |||
returnList.addAll(returnedList); | |||
} |
@@ -69,7 +69,7 @@ public class TableContentLayoutManager implements PercentBaseContext { | |||
private int startXOffset; | |||
private int usedBPD; | |||
private TableStepper stepper = new TableStepper(this); | |||
private TableStepper stepper; | |||
/** | |||
* Main constructor | |||
@@ -85,6 +85,7 @@ public class TableContentLayoutManager implements PercentBaseContext { | |||
if (table.getTableFooter() != null) { | |||
footerIter = new TableRowIterator(table, TableRowIterator.FOOTER); | |||
} | |||
stepper = new TableStepper(this); | |||
} | |||
/** |
@@ -65,15 +65,16 @@ public class TableStepper { | |||
*/ | |||
public TableStepper(TableContentLayoutManager tclm) { | |||
this.tclm = tclm; | |||
this.columnCount = tclm.getTableLM().getTable().getNumberOfColumns(); | |||
} | |||
/** | |||
* Initializes the fields of this instance to handle a new row group. | |||
* | |||
* @param columnCount number of columns the row group has | |||
* @param rowGroup the new row group to handle | |||
*/ | |||
private void setup(int columnCount) { | |||
this.columnCount = columnCount; | |||
private void setup(EffRow[] rowGroup) { | |||
this.rowGroup = rowGroup; | |||
this.activeRowIndex = 0; | |||
this.previousRowsLength = 0; | |||
} | |||
@@ -143,15 +144,12 @@ public class TableStepper { | |||
* Creates the combined element list for a row group. | |||
* @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 (body, header or footer) | |||
* @return the combined element list | |||
*/ | |||
public LinkedList getCombinedKnuthElementsForRowGroup( | |||
LayoutContext context, | |||
EffRow[] rowGroup, int maxColumnCount, int bodyType) { | |||
this.rowGroup = rowGroup; | |||
setup(maxColumnCount); | |||
public LinkedList getCombinedKnuthElementsForRowGroup(LayoutContext context, EffRow[] rowGroup, | |||
int bodyType) { | |||
setup(rowGroup); | |||
initializeElementLists(); | |||
calcTotalHeight(); | |||
@@ -171,7 +169,7 @@ public class TableStepper { | |||
boolean forcedBreak = false; | |||
int breakClass = -1; | |||
//Put all involved grid units into a list | |||
List cellParts = new java.util.ArrayList(maxColumnCount); | |||
List cellParts = new java.util.ArrayList(columnCount); | |||
for (Iterator iter = activeCells.iterator(); iter.hasNext();) { | |||
ActiveCell activeCell = (ActiveCell) iter.next(); | |||
CellPart part = activeCell.createCellPart(); |