Chapter 4. Phase 2: Building the Area tree

Table of Contents

1. Initiating the layout process
2. Creating the page and body areas
2.1. Overview
2.2. Detailed view

1. Initiating the layout process

In the PageSequence.endOfNode() method, the AreaTreeHandler object foEventHandler's method endPageSequence is called. This method constructs a PageSequenceLayoutManager for the PageSequence FO node, which manages all page-related layout.
-> foTreeBuilder.getFOEventHandler().endPageSequence(this)
-> foEventHandler.endPageSequence(this) (type AreaTreeHandler):

This method creates a new PageSequenceLayoutManager for the PageSequence FO node. The pages in this page sequence are completely layed out by the PageSequenceLayoutManager, in its activateLayout method. The first step in the layout process is getting the page setup from the page masters. Then the FO tree is processed.

  [1] org.apache.fop.layoutmgr.PageSequenceLayoutManager.activateLayout (
  [2] (
  [3] (
  [4] (
  ... parser stuff
  [13] org.apache.xerces.parsers.AbstractSAXParser.parse (null)
  [14] org.apache.xalan.transformer.TransformerIdentityImpl.transform (null)
  [15] org.apache.fop.apps.InputHandler.render (
  [16] org.apache.fop.apps.Fop.main (
main[1] dump pageSLM
 pageSLM = {
    areaTreeHandler= org.apache.fop.area.AreaTreeHandler  (id=79)
    areaTreeModel= org.apache.fop.area.RenderPagesModel  (id=81)
    bFinished= false
    bFirstPage= false
    bInited= false
    childLMiter= org.apache.fop.layoutmgr.LMiter  (id=85)
    childLMs= java.util.ArrayList  (id=89)
    curBody= null
    curChildLM= null
    curFlow= null
    curPage= null
    currentSimplePageMaster= null
    curSpan= null
    curSpanColumns= 0
    flowBPD= 0
    flowIPD= 0
    fobj=  (id=12)
    fobjIter= java.util.AbstractList$ListItr  (id=90)
    isFirstPage= true
    markers= null
    pageCount= 1
    pageNumberGenerator= null
    pageNumberString= null
    parentLM= null
    staticContentLMs= java.util.HashMap  (id=93)

The above calling sequence contains one configuration point. FOP's area tree building process can be modified by registering a different LayoutManagerMaker with the Area tree handler. The LayoutManagerMaker controls the creation of Layout Managers.