From: Peter Bernard West Date: Wed, 25 Feb 2004 22:02:25 +0000 (+0000) Subject: Added long pageId. X-Git-Tag: Alt-Design_pre_awt_renderer_import~35 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=1e587503f11a9919f9cb42ecb798d2dd02a90b04;p=xmlgraphics-fop.git Added long pageId. Modified constructors to match. Removed getKey() method. Added constructor for self-synchronized tree root object. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/FOP_0-20-0_Alt-Design@197372 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/java/org/apache/fop/area/PageViewport.java b/src/java/org/apache/fop/area/PageViewport.java index b4b1dbd5b..c2574fb7c 100644 --- a/src/java/org/apache/fop/area/PageViewport.java +++ b/src/java/org/apache/fop/area/PageViewport.java @@ -41,7 +41,8 @@ import org.apache.fop.fo.properties.RetrievePosition; public class PageViewport extends Area implements Viewport, Resolveable, Cloneable { - + + private long pageId = 0; private PageRefArea pageRefArea; private Rectangle2D viewArea; private boolean clip = false; @@ -65,23 +66,46 @@ implements Viewport, Resolveable, Cloneable { private Map markerLastEnd = null; private Map markerLastAny = null; + /** + * Create a page viewport at the root of a tree, synchronized on itself, + * with a given page reference area and viewport dimensions + * @param pageId + * @param p the page reference area for the contents of this page + * @param bounds the dimensions of the viewport + */ + public PageViewport(long pageId, PageRefArea p, Rectangle2D bounds) { + super(); + this.pageId = pageId; + pageRefArea = p; + viewArea = bounds; + } + /** * Create a page viewport. - * @param p the page reference area that holds the contents - * @param bounds the bounds of this viewport + * @param parent node of this viewport + * @param sync object on which teh Area is synchronized + * @param pageId the unique identifier of this page + * @param p the page reference area for the contents of this page + * @param bounds the dimensions of the viewport */ public PageViewport( - Node parent, Object areaSync, PageRefArea p, Rectangle2D bounds) { - super(parent, areaSync); + Node parent, Object sync, long pageId, + PageRefArea p, Rectangle2D bounds) { + super(parent, sync); + this.pageId = pageId; pageRefArea = p; viewArea = bounds; } /** - * Create a page viewport. + * Create a page viewport with a given parent node, sync object and ID + * @param parent + * @param sync + * @param pageId */ - public PageViewport(Node parent, Object areaSync) { - super(parent, areaSync); + public PageViewport(Node parent, Object sync, long pageId) { + super(parent, sync); + this.pageId = pageId; pageRefArea = null; viewArea = null; } @@ -126,17 +150,6 @@ implements Viewport, Resolveable, Cloneable { return pageNumber; } - /** - * Get the key for this page viewport. - * This is used so that a serializable key can be used to - * lookup the page or some other reference. - * - * @return a unique page viewport key for this area tree - */ - public String getKey() { - return toString(); - } - /** * Add an unresolved id to this page. * All unresolved ids for the contents of this page are @@ -363,9 +376,15 @@ implements Viewport, Resolveable, Cloneable { * @return a copy of this page and associated viewports */ public Object clone() { - PageRefArea p = (PageRefArea)pageRefArea.clone(); - PageViewport ret = new PageViewport(parent, sync, p, (Rectangle2D)viewArea.clone()); - return ret; + PageViewport pv; + try { + pv = (PageViewport)(super.clone()); + } catch (CloneNotSupportedException e) { + throw new RuntimeException(e); + } + pageId = 0; // N.B. This invalidates the page id + pv.pageRefArea = (PageRefArea)pageRefArea.clone(); + return pv; } /**