aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam Victor Mote <vmote@apache.org>2003-08-29 20:02:11 +0000
committerWilliam Victor Mote <vmote@apache.org>2003-08-29 20:02:11 +0000
commit5a166c55f092fc3f6e97182ffbaeac7a496d754d (patch)
tree9752a585291261476bd2347d76a6c6f9e6a33c73
parentc64887d60d247f971d7a16e8757bc2bf74c23d4a (diff)
downloadxmlgraphics-fop-5a166c55f092fc3f6e97182ffbaeac7a496d754d.tar.gz
xmlgraphics-fop-5a166c55f092fc3f6e97182ffbaeac7a496d754d.zip
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
-rw-r--r--src/java/org/apache/fop/layoutmgr/PageLayoutManager.java15
1 files changed, 14 insertions, 1 deletions
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;
@@ -149,6 +150,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;
}