pbwest 2004/02/25 14:02:25 Modified: src/java/org/apache/fop/area Tag: FOP_0-20-0_Alt-Design PageViewport.java Log: Added long pageId. Modified constructors to match. Removed getKey() method. Added constructor for self-synchronized tree root object. Revision Changes Path No revision No revision 1.2.2.2 +42 -23 xml-fop/src/java/org/apache/fop/area/PageViewport.java Index: PageViewport.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/area/PageViewport.java,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -u -r1.2.2.1 -r1.2.2.2 --- PageViewport.java 24 Feb 2004 07:54:00 -0000 1.2.2.1 +++ PageViewport.java 25 Feb 2004 22:02:25 -0000 1.2.2.2 @@ -41,7 +41,8 @@ public class PageViewport extends Area implements Viewport, Resolveable, Cloneable { - + + private long pageId = 0; private PageRefArea pageRefArea; private Rectangle2D viewArea; private boolean clip = false; @@ -66,22 +67,45 @@ 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. - */ - public PageViewport(Node parent, Object areaSync) { - super(parent, areaSync); + * Create a page viewport with a given parent node, sync object and ID + * @param parent + * @param sync + * @param pageId + */ + public PageViewport(Node parent, Object sync, long pageId) { + super(parent, sync); + this.pageId = pageId; pageRefArea = null; viewArea = null; } @@ -127,17 +151,6 @@ } /** - * 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 * added to this page. This is so that the resolvers can be @@ -363,9 +376,15 @@ * @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; } /**
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]