From 5a166c55f092fc3f6e97182ffbaeac7a496d754d Mon Sep 17 00:00:00 2001 From: William Victor Mote Date: Fri, 29 Aug 2003 20:02:11 +0000 Subject: store a collection of StaticContentLayoutManager objects, keyed by flow-name, to be used instead of creating new ones each time one is needed git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@196873 13f79535-47bb-0310-9956-ffa450edef68 --- src/java/org/apache/fop/layoutmgr/PageLayoutManager.java | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/java/org/apache/fop/layoutmgr/PageLayoutManager.java b/src/java/org/apache/fop/layoutmgr/PageLayoutManager.java index 5a202c2d2..9a292696b 100644 --- a/src/java/org/apache/fop/layoutmgr/PageLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/PageLayoutManager.java @@ -88,6 +88,7 @@ import org.apache.fop.fo.properties.Overflow; import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.HashMap; import java.awt.Rectangle; import java.util.Iterator; import java.awt.geom.Rectangle2D; @@ -148,6 +149,12 @@ public class PageLayoutManager extends AbstractLayoutManager implements Runnable */ private SimplePageMaster currentSimplePageMaster; + /** + * The collection of StaticContentLayoutManager objects that are associated + * with this Page Sequence, keyed by flow-name. + */ + private HashMap staticContentLMs = new HashMap(4); + /** * This is the top level layout manager. * It is created by the PageSequence FO. @@ -896,9 +903,15 @@ public class PageLayoutManager extends AbstractLayoutManager implements Runnable * @return a StaticContent layout manager */ public StaticContentLayoutManager getStaticContentLayoutManager(StaticContent sc) { - StaticContentLayoutManager lm = new StaticContentLayoutManager(); + StaticContentLayoutManager lm = + (StaticContentLayoutManager)staticContentLMs.get(sc.getFlowName()); + if (lm != null) { + return lm; + } + lm = new StaticContentLayoutManager(); lm.setUserAgent(getUserAgent()); lm.setFObj(sc); + staticContentLMs.put(sc.getFlowName(), lm); return lm; } -- cgit v1.2.3