]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
removes space after if a row needs to be removed
authorKeiron Liddle <keiron@apache.org>
Tue, 19 Dec 2000 03:57:28 +0000 (03:57 +0000)
committerKeiron Liddle <keiron@apache.org>
Tue, 19 Dec 2000 03:57:28 +0000 (03:57 +0000)
fixed a bug where the extra space after was left behind for rows
going over a page

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

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

index 0d3e1bd9ec3667d1a44dae6d90ad1e8a8c5f7678..dbd1c1296e715edf88d6257474504408357925ed 100644 (file)
@@ -189,7 +189,7 @@ public class TableBody extends FObj {
             row.setColumns(columns);
             row.doSetup(areaContainer);
             if (row.getKeepWithPrevious() != 0 && lastRow != null &&
-                    keepWith.indexOf(lastRow) != -1) {
+                    keepWith.indexOf(lastRow) == -1) {
                 keepWith.addElement(lastRow);
             }
 
@@ -275,12 +275,18 @@ public class TableBody extends FObj {
         return new Status(Status.OK);
     }
 
-    public int getAreaHeight() {
+/*    public int getAreaHeight() {
         return areaContainer.getHeight();
-    }
+    }*/
 
     public void removeLayout(Area area) {
         area.removeChild(areaContainer);
+        if (spaceBefore != 0) {
+            area.increaseHeight(-spaceBefore);
+        }
+        if (spaceAfter != 0) {
+            area.increaseHeight(-spaceAfter);
+        }
         this.resetMarker();
     }
 }
index 20db3ce4b25b0e51fb28a080848406fa940257e9..5f40124321f06ea0980a8ec61cc90661b17298c6 100644 (file)
@@ -111,6 +111,7 @@ public class TableRow extends FObj {
 
     // added by Dresdner Bank, Germany
     DisplaySpace spacer = null;
+    boolean hasAddedSpacer = false;
     DisplaySpace spacerAfter = null;
 
     /**
@@ -359,7 +360,6 @@ public class TableRow extends FObj {
             this.marker = 0;
         }
 
-
         if ((spaceBefore != 0) && (this.marker == 0)) {
             spacer = new DisplaySpace(spaceBefore);
             area.increaseHeight(spaceBefore);
@@ -482,8 +482,9 @@ public class TableRow extends FObj {
                     }
                 } else {
                     // added on 11/28/2000, by Dresdner Bank, Germany
-                    if (spacer != null)
+                    if (hasAddedSpacer && spacer != null)
                         area.removeChild(spacer);
+                    hasAddedSpacer = false;
                     if(spacerAfter != null)
                         area.removeChild(spacerAfter);
 
@@ -517,9 +518,9 @@ public class TableRow extends FObj {
         }
 
         // added by Dresdner Bank, Germany
-        if (spacer != null) {
+        if (!hasAddedSpacer && spacer != null) {
             area.addChild(spacer);
-            spacer = null;
+            hasAddedSpacer = true;
         }
 
         area.addChild(areaContainer);
@@ -533,16 +534,6 @@ public class TableRow extends FObj {
         // bug fix from Eric Schaeffer
         //area.increaseHeight(largestCellHeight);
 
-        if (spaceAfter != 0) {
-            spacerAfter = new DisplaySpace(spaceAfter);
-            area.increaseHeight(spaceAfter);
-            area.addChild(spacerAfter);
-        }
-
-        if (area instanceof BlockArea) {
-            area.start();
-        }
-
         // test to see if some cells are not
         // completely laid out.
         // Hani Elabed 11/22/2000
@@ -555,6 +546,16 @@ public class TableRow extends FObj {
             }
         }
 
+        if (!someCellDidNotLayoutCompletely && spaceAfter != 0) {
+            spacerAfter = new DisplaySpace(spaceAfter);
+            area.increaseHeight(spaceAfter);
+            area.addChild(spacerAfter);
+        }
+
+        if (area instanceof BlockArea) {
+            area.start();
+        }
+
         // replaced by Hani Elabed 11/27/2000
         //return new Status(Status.OK);
 
@@ -574,17 +575,28 @@ public class TableRow extends FObj {
     }
 
     public void removeLayout(Area area) {
-        if (spacer != null)
-            area.removeChild(spacer);
+        if (spacer != null) {
+            if(hasAddedSpacer) {
+                area.removeChild(spacer);
+            } else {
+                area.increaseHeight(-spaceBefore);
+            }
+        }
+        hasAddedSpacer = false;
         if(spacerAfter != null)
             area.removeChild(spacerAfter);
-        // removing something that was added by succession
-        // of cell.layout()
-        // just to keep my sanity here, Hani
-        //             area.increaseHeight(areaContainer.getHeight());
+        //area.increaseHeight(areaContainer.getHeight());
         area.removeChild(areaContainer);
         this.resetMarker();
         cells = null;
         this.removeID(area.getIDReferences());
     }
+
+    public void resetMarker()
+    {
+        super.resetMarker();
+        spacer = null;
+        spacerAfter = null;
+        hasAddedSpacer = false;
+    }
 }