From 37374bcb6940540641607a8596ae52228596a42a Mon Sep 17 00:00:00 2001 From: Jeremias Maerki Date: Tue, 8 Feb 2005 09:17:50 +0000 Subject: [PATCH] moving retrieve-marker replacement into separate method to make preLoadList easier to read and understand. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@198390 13f79535-47bb-0310-9956-ffa450edef68 --- .../fop/layoutmgr/AbstractLayoutManager.java | 39 +++++++++++++------ 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java b/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java index 0f6770cd4..45ef5e6e3 100644 --- a/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java @@ -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; -- 2.39.5