arved 01/07/16 03:43:40 Modified: src/org/apache/fop/fo/flow Marker.java Log: AHS: initial marker support Revision Changes Path 1.2 +68 -23 xml-fop/src/org/apache/fop/fo/flow/Marker.java Index: Marker.java =================================================================== RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/flow/Marker.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- Marker.java 2001/07/13 12:36:09 1.1 +++ Marker.java 2001/07/16 10:43:40 1.2 @@ -1,4 +1,5 @@ -/*-- $Id: Marker.java,v 1.1 2001/07/13 12:36:09 keiron Exp $ -- +/*-- $Id: Marker.java,v 1.2 2001/07/16 10:43:40 arved Exp $-- */ +/* * Copyright (C) 2001 The Apache Software Foundation. All rights reserved. * For details on use and redistribution please refer to the * LICENSE file included with these sources. @@ -9,30 +10,74 @@ // FOP import org.apache.fop.fo.*; import org.apache.fop.messaging.MessageHandler; -import org.apache.fop.fo.flow.*; import org.apache.fop.fo.properties.*; -import org.apache.fop.layout.AreaTree; +import org.apache.fop.layout.*; +import org.apache.fop.datatypes.*; import org.apache.fop.apps.FOPException; -/** - */ -public class Marker extends ToBeImplementedElement { - - public static class Maker extends FObj.Maker { - public FObj make(FObj parent, - PropertyList propertyList) throws FOPException { - return new Marker(parent, propertyList); - } - } - - public static FObj.Maker maker() { - return new Marker.Maker(); - } - - protected Marker(FObj parent, - PropertyList propertyList) throws FOPException { - super(parent, propertyList); - this.name = "fo:marker"; - } +public class Marker extends FObjMixed { + private String markerClassName; + private Area registryArea; + + public static class Maker extends FObj.Maker { + public FObj make(FObj parent, PropertyList propertyList) throws FOPException { + return new Marker(parent, propertyList); + } + } + + public static FObj.Maker maker() { + return new Marker.Maker(); + } + + public Marker(FObj parent, PropertyList propertyList) { + super(parent, propertyList); + this.name = "fo:marker"; + + // do check to see that 'this' is under fo:flow + + this.markerClassName = this.properties.get("marker-class-name").getString(); + + // check to ensure that no other marker with same parent + // has this 'marker-class-name' is in addMarker() method + try { + parent.addMarker(this); + } catch (FOPException fopex) { + MessageHandler.error("marker cannot be added to '" + parent + "'"); + } + } + + public Status layout(Area area) throws FOPException { + // no layout action desired + this.registryArea = area; + area.getPage().registerMarker(this); + // System.out.println("Marker being registered in area '" + area + "'"); + return new Status(Status.OK); + } + + public Status layoutMarker(Area area) throws FOPException { + if (this.marker == START) + this.marker = 0; + + int numChildren = this.children.size(); + for (int i = this.marker; i < numChildren; i++) { + FONode fo = (FONode) children.elementAt(i); + + Status status; + if ((status = fo.layout(area)).isIncomplete()) { + this.marker = i; + return status; + } + } + + return new Status(Status.OK); + } + + public String getMarkerClassName() { + return markerClassName; + } + + public Area getRegistryArea() { + return registryArea; + } } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]