From: Peter Bernard West Date: Sun, 2 May 2004 05:52:55 +0000 (+0000) Subject: Created AreaNode, extending Node, as a superclass of Area, X-Git-Tag: Defoe_export~205 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=6e281208cf9d6b18f19a3a2404342554fff8f7dd;p=xmlgraphics-fop.git Created AreaNode, extending Node, as a superclass of Area, without any geometry. Done to support Page, a class at the root of all page areas, which maintains meta-data about the page, without generating any geometry. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/FOP_0-20-0_Alt-Design@197549 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/java/org/apache/fop/area/AreaNode.java b/src/java/org/apache/fop/area/AreaNode.java new file mode 100644 index 000000000..32e001b8a --- /dev/null +++ b/src/java/org/apache/fop/area/AreaNode.java @@ -0,0 +1,110 @@ +/* + * + * Copyright 2004 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Created on 1/05/2004 + * $Id$ + */ +package org.apache.fop.area; + +import org.apache.fop.datastructs.Node; +import org.apache.fop.datastructs.SyncedNode; +import org.apache.fop.fo.FONode; +import org.apache.fop.fo.flow.FoPageSequence; + +/** + * A pseudo-area base class for all areas. It contains no actual area. + * Sub-classed by Page, which maintains meta-information on + * all areas within a page. + * @author pbw + * @version $Revision$ $Name$ + */ +public abstract class AreaNode extends SyncedNode implements Cloneable { + + /** The page-sequence which generated this area. */ + protected FoPageSequence pageSeq = null; + /** The FO node that generated this node. */ + protected FONode generatedBy = null; + + private void setup(FoPageSequence pageSeq, FONode generatedBy) { + this.pageSeq = pageSeq; + this.generatedBy = generatedBy; + } + + /** + * @param pageSeq through which this area was generated + * @param generatedBy the given FONode generated this + * @param parent Node of this + * @param index of this in children of parent + * @param sync the object on which this area is synchronized + * @throws IndexOutOfBoundsException + */ + public AreaNode( + FoPageSequence pageSeq, + FONode generatedBy, + Node parent, + int index, + Object sync) + throws IndexOutOfBoundsException { + super(parent, index, sync); + setup(pageSeq, generatedBy); + } + + /** + * @param pageSeq through which this area was generated + * @param generatedBy the given FONode generated this + * @param parent Node of this + * @param sync the object on which this area is synchronized + * @throws IndexOutOfBoundsException + */ + public AreaNode( + FoPageSequence pageSeq, + FONode generatedBy, + Node parent, + Object sync) { + super(parent, sync); + setup(pageSeq, generatedBy); + } + + /** + * Construct an AreaNode which is the root of a tree, and is + * synchronized on itself + * @param pageSeq through which this area was generated + * @param generatedBy the given FONode generated this + */ + public AreaNode( + FoPageSequence pageSeq, + FONode generatedBy) { + super(); + setup(pageSeq, generatedBy); + } + + /** + * @return the generatedBy + */ + public FONode getGeneratedBy() { + synchronized (sync) { + return generatedBy; + } + } + /** + * @param generatedBy to set + */ + public void setGeneratedBy(FONode generatedBy) { + synchronized (sync) { + this.generatedBy = generatedBy; + } + } +}