diff options
author | Keiron Liddle <keiron@apache.org> | 2000-12-19 03:57:28 +0000 |
---|---|---|
committer | Keiron Liddle <keiron@apache.org> | 2000-12-19 03:57:28 +0000 |
commit | b205c894932ccf63a9aa40195b4beebebb089383 (patch) | |
tree | 268836b94eeee984c514e059c5c0f4eddc297595 /src/org/apache | |
parent | 2f8e0dcedae493b8c7ad9537c44c474aa951340d (diff) | |
download | xmlgraphics-fop-b205c894932ccf63a9aa40195b4beebebb089383.tar.gz xmlgraphics-fop-b205c894932ccf63a9aa40195b4beebebb089383.zip |
removes space after if a row needs to be removed
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
Diffstat (limited to 'src/org/apache')
-rw-r--r-- | src/org/apache/fop/fo/flow/TableBody.java | 12 | ||||
-rw-r--r-- | src/org/apache/fop/fo/flow/TableRow.java | 52 |
2 files changed, 41 insertions, 23 deletions
diff --git a/src/org/apache/fop/fo/flow/TableBody.java b/src/org/apache/fop/fo/flow/TableBody.java index 0d3e1bd9e..dbd1c1296 100644 --- a/src/org/apache/fop/fo/flow/TableBody.java +++ b/src/org/apache/fop/fo/flow/TableBody.java @@ -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(); } } diff --git a/src/org/apache/fop/fo/flow/TableRow.java b/src/org/apache/fop/fo/flow/TableRow.java index 20db3ce4b..5f4012432 100644 --- a/src/org/apache/fop/fo/flow/TableRow.java +++ b/src/org/apache/fop/fo/flow/TableRow.java @@ -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; + } } |