]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
fixed a couple of bugs with footers, multiple table bodies
authorKeiron Liddle <keiron@apache.org>
Thu, 21 Dec 2000 05:20:28 +0000 (05:20 +0000)
committerKeiron Liddle <keiron@apache.org>
Thu, 21 Dec 2000 05:20:28 +0000 (05:20 +0000)
and removing incompletely laid out rows

git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@193917 13f79535-47bb-0310-9956-ffa450edef68

src/org/apache/fop/fo/flow/Table.java
src/org/apache/fop/fo/flow/TableRow.java

index 72d0c4aae0553716cfaf7dbb74f4f4a43d88f0d9..b393341ddf17f224164ac9efb70124ac205c4cec 100644 (file)
@@ -94,6 +94,7 @@ public class Table extends FObj {
 
     Vector columns = new Vector();
     int currentColumnNumber = 0;
+    int bodyCount = 0;
 
     AreaContainer areaContainer;
 
@@ -194,6 +195,7 @@ public class Table extends FObj {
         int offset = 0;
 
         boolean addedHeader = false;
+        boolean addedFooter = false;
         int numChildren = this.children.size();
         for (int i = this.marker; i < numChildren; i++) {
             FONode fo = (FONode) children.elementAt(i);
@@ -239,11 +241,12 @@ public class Table extends FObj {
                     addedHeader = true;
                     tableHeader.resetMarker();
                 }
-                if (tableFooter != null && !this.omitFooterAtBreak) {
+                if (tableFooter != null && !this.omitFooterAtBreak && !addedFooter) {
                     if ((status = tableFooter.layout(areaContainer)).
                             isIncomplete()) {
                         return new Status(Status.AREA_FULL_NONE);
                     }
+                    addedFooter = true;
                     tableFooter.resetMarker();
                 }
                 fo.setWidows(widows);
@@ -252,11 +255,12 @@ public class Table extends FObj {
 
                 if ((status = fo.layout(areaContainer)).isIncomplete()) {
                     this.marker = i;
-                    if (status.getCode() == Status.AREA_FULL_NONE) {
+                    if (bodyCount == 0 && status.getCode() == Status.AREA_FULL_NONE) {
                         if (tableHeader != null)
                             tableHeader.removeLayout(areaContainer);
                         if (tableFooter != null)
                             tableFooter.removeLayout(areaContainer);
+                        resetMarker();
                         //                     status = new Status(Status.AREA_FULL_SOME);
                     }
                     //areaContainer.end();
@@ -277,8 +281,11 @@ public class Table extends FObj {
                               tableFooter.getYPosition() +
                               ((TableBody) fo).getHeight());
                         }
+                        status = new Status(Status.AREA_FULL_SOME);
                     }
                     return status;
+                } else {
+                    bodyCount++;
                 }
                 if (tableFooter != null && !this.omitFooterAtBreak) {
                     // move footer to bottom of area and move up body
index 5f40124321f06ea0980a8ec61cc90661b17298c6..a7e7f571d3c811e6f8de2345a1ad7bf1e517a7f5 100644 (file)
@@ -113,6 +113,7 @@ public class TableRow extends FObj {
     DisplaySpace spacer = null;
     boolean hasAddedSpacer = false;
     DisplaySpace spacerAfter = null;
+    boolean areaAdded = false;
 
     /**
      * The list of cell states for this row. This is the location of
@@ -482,11 +483,14 @@ public class TableRow extends FObj {
                     }
                 } else {
                     // added on 11/28/2000, by Dresdner Bank, Germany
-                    if (hasAddedSpacer && spacer != null)
+                    if (spacer != null) {
                         area.removeChild(spacer);
+                        spacer = null;
+                    }
                     hasAddedSpacer = false;
                     if(spacerAfter != null)
                         area.removeChild(spacerAfter);
+                    spacerAfter = null;
 
                     // removing something that was added by succession
                     // of cell.layout()
@@ -524,6 +528,7 @@ public class TableRow extends FObj {
         }
 
         area.addChild(areaContainer);
+        areaAdded = true;
         areaContainer.end();
         area.addDisplaySpace(largestCellHeight +
                              areaContainer.getPaddingTop() +
@@ -548,8 +553,8 @@ public class TableRow extends FObj {
 
         if (!someCellDidNotLayoutCompletely && spaceAfter != 0) {
             spacerAfter = new DisplaySpace(spaceAfter);
-            area.increaseHeight(spaceAfter);
             area.addChild(spacerAfter);
+            area.increaseHeight(spaceAfter);
         }
 
         if (area instanceof BlockArea) {
@@ -582,11 +587,12 @@ public class TableRow extends FObj {
                 area.increaseHeight(-spaceBefore);
             }
         }
-        hasAddedSpacer = false;
         if(spacerAfter != null)
             area.removeChild(spacerAfter);
         //area.increaseHeight(areaContainer.getHeight());
-        area.removeChild(areaContainer);
+        if(areaAdded)
+            area.removeChild(areaContainer);
+        areaAdded = false;
         this.resetMarker();
         cells = null;
         this.removeID(area.getIDReferences());