From 9f32257ad872af34623768576a21bfd6c5b53f0c Mon Sep 17 00:00:00 2001 From: Keiron Liddle Date: Wed, 13 Dec 2000 03:53:23 +0000 Subject: [PATCH] makes sure that the header and footer are removed if no body fits on a page git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@193869 13f79535-47bb-0310-9956-ffa450edef68 --- src/org/apache/fop/fo/flow/Table.java | 4 ++++ src/org/apache/fop/fo/flow/TableBody.java | 10 ++++++++-- src/org/apache/fop/fo/flow/TableFooter.java | 2 +- src/org/apache/fop/layout/AreaContainer.java | 4 ++++ 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/org/apache/fop/fo/flow/Table.java b/src/org/apache/fop/fo/flow/Table.java index 659adc177..daffbe5a3 100644 --- a/src/org/apache/fop/fo/flow/Table.java +++ b/src/org/apache/fop/fo/flow/Table.java @@ -244,6 +244,10 @@ public class Table extends FObj { if ((status = fo.layout(areaContainer)).isIncomplete()) { this.marker = i; if (/*(i != 0) && */(status.getCode() == Status.AREA_FULL_NONE)) { + if(tableHeader != null) + tableHeader.removeLayout(areaContainer); + if(tableFooter != null) + tableFooter.removeLayout(areaContainer); // status = new Status(Status.AREA_FULL_SOME); } //areaContainer.end(); diff --git a/src/org/apache/fop/fo/flow/TableBody.java b/src/org/apache/fop/fo/flow/TableBody.java index d4854e7c5..befcb02ef 100644 --- a/src/org/apache/fop/fo/flow/TableBody.java +++ b/src/org/apache/fop/fo/flow/TableBody.java @@ -104,12 +104,12 @@ public class TableBody extends FObj { public int getYPosition() { - return areaContainer.getYPosition(); + return areaContainer.getCurrentYPosition(); } public int getHeight() { - return areaContainer.getHeight(); + return areaContainer.getHeight() + spaceBefore + spaceAfter; } public Status layout(Area area) throws FOPException { @@ -270,4 +270,10 @@ public class TableBody extends FObj { public int getAreaHeight() { return areaContainer.getHeight(); } + + public void removeLayout(Area area) + { + area.removeChild(areaContainer); + this.resetMarker(); + } } diff --git a/src/org/apache/fop/fo/flow/TableFooter.java b/src/org/apache/fop/fo/flow/TableFooter.java index 7fa15b77a..818e208ae 100644 --- a/src/org/apache/fop/fo/flow/TableFooter.java +++ b/src/org/apache/fop/fo/flow/TableFooter.java @@ -73,7 +73,7 @@ public class TableFooter extends TableBody { public int getYPosition() { - return areaContainer.getYPosition() - spaceBefore; + return areaContainer.getCurrentYPosition() - spaceBefore; } public void setYPosition(int value) diff --git a/src/org/apache/fop/layout/AreaContainer.java b/src/org/apache/fop/layout/AreaContainer.java index 2f994f32e..e97129bd2 100644 --- a/src/org/apache/fop/layout/AreaContainer.java +++ b/src/org/apache/fop/layout/AreaContainer.java @@ -93,6 +93,10 @@ public class AreaContainer extends Area { return yPosition + this.paddingTop + this.borderWidthTop; } + public int getCurrentYPosition() { + return yPosition; + } + public void setYPosition(int value) { yPosition = value; } -- 2.39.5