]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Small update in the table-layout code
authorAndreas L. Delmelle <adelmelle@apache.org>
Tue, 8 Aug 2006 15:26:54 +0000 (15:26 +0000)
committerAndreas L. Delmelle <adelmelle@apache.org>
Tue, 8 Aug 2006 15:26:54 +0000 (15:26 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@429689 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java
src/java/org/apache/fop/layoutmgr/table/TableStepper.java

index 27f3da0c94bd7f44b572930717985e025a310480..a5eeb10936e933124d46e1ca624558b220216b04 100644 (file)
@@ -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);
index e4191732b9c688898545ce71797f91b5f66fa6e1..9d77293ed708a2dd547dafdf429147b7ba9f421b 100644 (file)
@@ -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];