jeremias    2005/02/08 01:17:50

  Modified:    src/java/org/apache/fop/layoutmgr AbstractLayoutManager.java
  Log:
  moving retrieve-marker replacement into separate method to make preLoadList 
easier to read and understand.
  
  Revision  Changes    Path
  1.37      +27 -12    
xml-fop/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java
  
  Index: AbstractLayoutManager.java
  ===================================================================
  RCS file: 
/home/cvs/xml-fop/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java,v
  retrieving revision 1.36
  retrieving revision 1.37
  diff -u -r1.36 -r1.37
  --- AbstractLayoutManager.java        7 Feb 2005 11:01:36 -0000       1.36
  +++ AbstractLayoutManager.java        8 Feb 2005 09:17:50 -0000       1.37
  @@ -394,6 +394,29 @@
       }
   
       /**
  +     * 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
        * @return the list with the preloaded child LMs
  @@ -407,19 +430,11 @@
               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;
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to