From b1b90ee83327f03c058c8128df5efe2a3fdc7cb7 Mon Sep 17 00:00:00 2001 From: "Andreas L. Delmelle" Date: Tue, 8 Aug 2006 15:26:54 +0000 Subject: [PATCH] Small update in the table-layout code git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@429689 13f79535-47bb-0310-9956-ffa450edef68 --- .../table/TableContentLayoutManager.java | 35 ++++++++++--------- .../fop/layoutmgr/table/TableStepper.java | 2 +- 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java b/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java index 27f3da0c9..a5eeb1093 100644 --- a/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java @@ -76,7 +76,7 @@ public class TableContentLayoutManager implements PercentBaseContext { private int startXOffset; private int usedBPD; - + /** * Main constructor * @param parent Parent layout manager @@ -144,15 +144,18 @@ public class TableContentLayoutManager implements PercentBaseContext { this.headerList = getKnuthElementsForRowIterator( headerIter, context, alignment, TableRowIterator.HEADER); ElementListUtils.removeLegalBreaks(this.headerList); - this.headerNetHeight = ElementListUtils.calcContentLength(this.headerList); + this.headerNetHeight = + ElementListUtils.calcContentLength(this.headerList); if (log.isDebugEnabled()) { - log.debug("==> Header: " + headerNetHeight + " - " + this.headerList); + log.debug("==> Header: " + + headerNetHeight + " - " + this.headerList); } TableHeaderFooterPosition pos = new TableHeaderFooterPosition( getTableLM(), true, this.headerList); KnuthBox box = new KnuthBox(headerNetHeight, pos, false); if (getTableLM().getTable().omitHeaderAtBreak()) { - //We can simply add the table header at the beginning of the whole list + //We can simply add the table header at the start + //of the whole list headerAsFirst = box; } else { headerAsSecondToLast = box; @@ -162,17 +165,17 @@ public class TableContentLayoutManager implements PercentBaseContext { this.footerList = getKnuthElementsForRowIterator( footerIter, context, alignment, TableRowIterator.FOOTER); ElementListUtils.removeLegalBreaks(this.footerList); - this.footerNetHeight = ElementListUtils.calcContentLength(this.footerList); + this.footerNetHeight = + ElementListUtils.calcContentLength(this.footerList); if (log.isDebugEnabled()) { - log.debug("==> Footer: " + footerNetHeight + " - " + this.footerList); - } - if (true /*getTableLM().getTable().omitFooterAtBreak()*/) { - //We can simply add the table header at the end of the whole list - TableHeaderFooterPosition pos = new TableHeaderFooterPosition( - getTableLM(), false, this.footerList); - KnuthBox box = new KnuthBox(footerNetHeight, pos, false); - footerAsLast = box; + log.debug("==> Footer: " + + footerNetHeight + " - " + this.footerList); } + //We can simply add the table footer at the end of the whole list + TableHeaderFooterPosition pos = new TableHeaderFooterPosition( + getTableLM(), false, this.footerList); + KnuthBox box = new KnuthBox(footerNetHeight, pos, false); + footerAsLast = box; } LinkedList returnList = getKnuthElementsForRowIterator( trIter, context, alignment, TableRowIterator.BODY); @@ -192,7 +195,8 @@ public class TableContentLayoutManager implements PercentBaseContext { * @param iter TableRowIterator instance to fetch rows from * @param context Active LayoutContext * @param alignment alignment indicator - * @param bodyType Indicates what kind of body is being processed (BODY, HEADER or FOOTER) + * @param bodyType Indicates what kind of body is being processed + * (BODY, HEADER or FOOTER) * @return An element list */ private LinkedList getKnuthElementsForRowIterator(TableRowIterator iter, @@ -211,7 +215,7 @@ public class TableContentLayoutManager implements PercentBaseContext { pen.setP(-KnuthPenalty.INFINITE); pen.setBreakClass(rowFO.getBreakBefore()); } else if (last instanceof BreakElement) { - BreakElement breakPoss = (BreakElement)last; + BreakElement breakPoss = (BreakElement) last; breakPoss.setPenaltyValue(-KnuthPenalty.INFINITE); breakPoss.setBreakClass(rowFO.getBreakBefore()); } @@ -573,7 +577,6 @@ public class TableContentLayoutManager implements PercentBaseContext { log.debug(" height=" + rowHeights[i] + " explicit=" + explicitRowHeights[i]); } } - //TODO It may make sense to reuse the stepper since it allocates quite some space TableStepper stepper = new TableStepper(this); LinkedList returnedList = stepper.getCombinedKnuthElementsForRowGroup( context, rowGroup, maxColumnCount, bodyType); diff --git a/src/java/org/apache/fop/layoutmgr/table/TableStepper.java b/src/java/org/apache/fop/layoutmgr/table/TableStepper.java index e4191732b..9d77293ed 100644 --- a/src/java/org/apache/fop/layoutmgr/table/TableStepper.java +++ b/src/java/org/apache/fop/layoutmgr/table/TableStepper.java @@ -72,10 +72,10 @@ public class TableStepper { */ public TableStepper(TableContentLayoutManager tclm) { this.tclm = tclm; - this.activeRow = 0; } private void setup(int columnCount) { + this.activeRow = 0; elementLists = new List[columnCount]; startRow = new int[columnCount]; start = new int[columnCount]; -- 2.39.5