From ea1956a6f19fb19ea3c1c31036e8dd54de38b5af Mon Sep 17 00:00:00 2001 From: Peter Bernard West Date: Sat, 24 Jul 2004 17:34:48 +0000 Subject: [PATCH] BlockAllocationRectangle implements AreaListener BlockAllocationRectangle instance created in constructor of BlockArea setDimensions() from AreaListener is implements by re-calculating the allocation-recatngle dimensions git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/FOP_0-20-0_Alt-Design@197833 13f79535-47bb-0310-9956-ffa450edef68 --- src/java/org/apache/fop/area/BlockArea.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/java/org/apache/fop/area/BlockArea.java b/src/java/org/apache/fop/area/BlockArea.java index fde0e7093..92cb4f485 100644 --- a/src/java/org/apache/fop/area/BlockArea.java +++ b/src/java/org/apache/fop/area/BlockArea.java @@ -40,9 +40,11 @@ public class BlockArea extends Area { Node parent, Object sync) { super(pageSeq, generatedBy, parent, sync); - // TODO Auto-generated constructor stub + // Setup the allocation-rectangle + allocation = new BlockAllocationRectangle(); } + private BlockAllocationRectangle allocation; /** The page space allocation for layout of the block */ private Rectangle2D pageSpace = new Rectangle2D.Double(); /** The content space equivalent to the pageSpace */ @@ -142,7 +144,7 @@ public class BlockArea extends Area { * @version $Revision$ $Name$ */ public class BlockAllocationRectangle extends AreaFrame implements - AllocationRectangle { + AllocationRectangle, AreaListener { private PaddingRectangle padding; private BorderRectangle borders; @@ -167,16 +169,23 @@ public class BlockArea extends Area { padding = BlockArea.this.getPadding(); borders = BlockArea.this.getBorders(); spaces = BlockArea.this.getSpaces(); + // Register the listener + spaces.registerAreaListener(this); setAllocationFrame(); } public void setAllocationFrame() { + // TODO synchronize this setStart(spaces.getStart() + borders.getStart() + padding.getStart()); setEnd(spaces.getEnd() + borders.getEnd() + padding.getEnd()); setBefore(borders.getBefore() + padding.getBefore()); setAfter(borders.getAfter() + padding.getAfter()); } + public void setDimensions(Rectangle2D geometry) { + setAllocationFrame(); + } + } } -- 2.39.5