]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
store a collection of StaticContentLayoutManager objects, keyed by flow-name, to...
authorWilliam Victor Mote <vmote@apache.org>
Fri, 29 Aug 2003 20:02:11 +0000 (20:02 +0000)
committerWilliam Victor Mote <vmote@apache.org>
Fri, 29 Aug 2003 20:02:11 +0000 (20:02 +0000)
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

index 5a202c2d20f8e4fb3f0900cd962e6bc4ae7fe451..9a292696ba810da5abea2537968ef1f2da23308c 100644 (file)
@@ -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;
     }