]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
moving retrieve-marker replacement into separate method to make preLoadList easier...
authorJeremias Maerki <jeremias@apache.org>
Tue, 8 Feb 2005 09:17:50 +0000 (09:17 +0000)
committerJeremias Maerki <jeremias@apache.org>
Tue, 8 Feb 2005 09:17:50 +0000 (09:17 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@198390 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java

index 0f6770cd4fc2e32b7cfb9947ac4edfbc62836bd2..45ef5e6e39a28c84fd353b5282ae6bfa826396cb 100644 (file)
@@ -393,6 +393,29 @@ public abstract class AbstractLayoutManager implements LayoutManager, Constants
         return parentLM.getAreaTreeHandler();
     }
 
+    /**
+     * Handles retrieve-marker nodes as they occur.
+     * @param foNode FO node to check
+     * @return the original foNode or in case of a retrieve-marker the replaced
+     *     FO node. null if the the replacement results in no nodes to be 
+     *     processed.
+     */
+    private FONode handleRetrieveMarker(FONode foNode) {
+        if (foNode instanceof RetrieveMarker) {
+            RetrieveMarker rm = (RetrieveMarker) foNode;
+            Marker marker = retrieveMarker(rm.getRetrieveClassName(),
+                                           rm.getRetrievePosition(),
+                                           rm.getRetrieveBoundary());
+            if (marker == null) {
+                return null;
+            }
+            rm.bindMarker(marker);
+            return rm;
+        } else {
+            return foNode;
+        }
+    }
+    
     /**
      * Convenience method: preload a number of child LMs
      * @param size the requested number of child LMs
@@ -407,19 +430,11 @@ public abstract class AbstractLayoutManager implements LayoutManager, Constants
             Object theobj = fobjIter.next();
             if (theobj instanceof FONode) {
                 FONode foNode = (FONode) theobj;
-                if (foNode instanceof RetrieveMarker) {
-                    RetrieveMarker rm = (RetrieveMarker) foNode;
-                    Marker marker = retrieveMarker(rm.getRetrieveClassName(),
-                                                   rm.getRetrievePosition(),
-                                                   rm.getRetrieveBoundary());
-                    if (marker == null) {
-                        continue;
-                    }
-                    rm.bindMarker(marker);
-                    foNode = rm;
+                foNode = handleRetrieveMarker(foNode);
+                if (foNode != null) {
+                    getAreaTreeHandler().getLayoutManagerMaker().
+                        makeLayoutManagers(foNode, newLMs);
                 }
-                getAreaTreeHandler().getLayoutManagerMaker().
-                    makeLayoutManagers(foNode, newLMs);
             }
         }
         return newLMs;