From 689efe91aaa2b41e8f40f61483612815ed5a25f8 Mon Sep 17 00:00:00 2001 From: Peter Bernard West Date: Thu, 3 Jun 2004 13:28:47 +0000 Subject: [PATCH] Added mapFlowName() and unmapFlowName() git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/FOP_0-20-0_Alt-Design@197681 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/fop/fo/flow/FoPageSequence.java | 42 +++++++++++++++++-- 1 file changed, 38 insertions(+), 4 deletions(-) diff --git a/src/java/org/apache/fop/fo/flow/FoPageSequence.java b/src/java/org/apache/fop/fo/flow/FoPageSequence.java index 14d35f92d..fb3201203 100644 --- a/src/java/org/apache/fop/fo/flow/FoPageSequence.java +++ b/src/java/org/apache/fop/fo/flow/FoPageSequence.java @@ -41,6 +41,7 @@ import org.apache.fop.area.PageSet; import org.apache.fop.area.PageSetElement; import org.apache.fop.datastructs.TreeException; import org.apache.fop.fo.FONode; +import org.apache.fop.fo.FOPageSeqNode; import org.apache.fop.fo.FOTree; import org.apache.fop.fo.FObjectNames; import org.apache.fop.fo.PropNames; @@ -126,10 +127,6 @@ public class FoPageSequence extends FONode { public Map staticContents = null; /** Child index of fo:flow child. */ private int flowChild = -1; - /** The PageList for this page-sequence */ - private PageList pagelist = null; - /** The index of the current element in the pagelist */ - private int pgListIndex = -1; /** The page currently being processed by this page-sequence */ private Page page = null; /** @@ -140,6 +137,11 @@ public class FoPageSequence extends FONode { return page; } + /** The PageList for this page-sequence */ + private PageList pagelist = null; + /** The index of the current element in the pagelist */ + private int pgListIndex = -1; + /** * @return the pagelist */ @@ -183,6 +185,38 @@ public class FoPageSequence extends FONode { return (Page)firstPage; } + /** Maps flownames to fo:flow and fo:static-content objects */ + private HashMap flowMap = new HashMap(10); + /** + * Maps a flow name to a FoFlow or FoStaticContent + * object. + * @param flowname the name of the flow + * @param flow the flow or static-content object + * @throws FOPException if object that the name is being mapped to is + * not a flow or static-content + */ + public void mapFlowName(String flowname, FOPageSeqNode flow) + throws FOPException { + synchronized (flowMap) { + if ( ! (flow.type == FObjectNames.FLOW + || flow.type == FObjectNames.STATIC_CONTENT)) { + throw new FOPException( + "Only fo:flow or fo:static-content allowed in flowmap"); + } + flowMap.put(flowname, flow); + } + } + + + /** + * @param flowname + * @return + */ + public FOPageSeqNode unmapFlowName(String flowname) { + synchronized (flowMap) { + return (FOPageSeqNode)(flowMap.get(flowname)); + } + } /** An image on which to draw areas */ private BufferedImage pageSpread = null; /** -- 2.39.5