fop 0.90alpha1

org.apache.fop.area
Class AreaTreeHandler

java.lang.Object
  extended byorg.apache.fop.fo.FOEventHandler
      extended byorg.apache.fop.area.AreaTreeHandler
Direct Known Subclasses:
TXTHandler

public class AreaTreeHandler
extends FOEventHandler

Area tree handler for formatting objects. Concepts: The area tree is to be as small as possible. With minimal classes and data to fully represent an area tree for formatting objects. The area tree needs to be simple to render and follow the spec closely. This area tree has the concept of page sequences. Wherever possible information is discarded or optimized to keep memory use low. The data is also organized to make it possible for renderers to minimize their output. A page can be saved if not fully resolved and once rendered a page contains only size and id reference information. The area tree pages are organized in a model that depends on the type of renderer.


Field Summary
 
Fields inherited from class org.apache.fop.fo.FOEventHandler
fontInfo, foUserAgent, propertyListMaker
 
Constructor Summary
AreaTreeHandler(FOUserAgent userAgent, java.lang.String outputFormat, java.io.OutputStream stream)
          Constructor.
 
Method Summary
 void addUnresolvedIDRef(java.lang.String idref, Resolvable res)
          Add an Resolvable object with an unresolved idref
 void associateIDWithPageViewport(java.lang.String id, PageViewport pv)
          Tie a PageViewport with an ID found on a child area of the PV.
 void endDocument()
          End the document.
 void endPageSequence(PageSequence pageSequence)
          End the PageSequence.
 AreaTreeModel getAreaTreeModel()
          Get the area tree model for this area tree.
 LayoutManagerMaker getLayoutManagerMaker()
          Get the LayoutManager maker for this area tree.
 java.util.List getPageViewportsContainingID(java.lang.String id)
          Get the list of page viewports that have an area with a given id.
 FormattingResults getResults()
          Get information about the rendered output, like number of pages created.
 void notifyPageSequenceFinished(PageSequence pageSequence, int pageCount)
          Called by the PageSequenceLayoutManager when it is finished with a page-sequence.
 void startDocument()
          Prepare AreaTreeHandler for document processing This is called from FOTreeBuilder.startDocument()
 void startPageSequence(PageSequence pageSequence)
           
 void tryIDResolution(PageViewport pv)
          Tries to resolve all unresolved ID references on the given page.
 
Methods inherited from class org.apache.fop.fo.FOEventHandler
character, characters, endBlock, endBlockContainer, endBody, endCell, endColumn, endFlow, endFooter, endFootnote, endFootnoteBody, endHeader, endInline, endLink, endList, endListBody, endListItem, endListLabel, endMarkup, endPageNumber, endRow, endStatic, endTable, foreignObject, getFontInfo, getIDReferences, getPropertyListMaker, getUserAgent, image, leader, pageRef, setPropertyListMaker, startBlock, startBlockContainer, startBody, startCell, startColumn, startFlow, startFooter, startFootnote, startFootnoteBody, startHeader, startInline, startLink, startList, startListBody, startListItem, startListLabel, startMarkup, startPageNumber, startRow, startStatic, startTable
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AreaTreeHandler

public AreaTreeHandler(FOUserAgent userAgent,
                       java.lang.String outputFormat,
                       java.io.OutputStream stream)
                throws FOPException
Constructor.

Parameters:
userAgent - FOUserAgent object for process
outputFormat - the MIME type of the output format to use (ex. "application/pdf").
stream - OutputStream
Throws:
FOPException - if the RenderPagesModel cannot be created
Method Detail

getAreaTreeModel

public AreaTreeModel getAreaTreeModel()
Get the area tree model for this area tree.

Returns:
AreaTreeModel the model being used for this area tree

getLayoutManagerMaker

public LayoutManagerMaker getLayoutManagerMaker()
Get the LayoutManager maker for this area tree.

Returns:
LayoutManagerMaker the LayoutManager maker being used for this area tree

associateIDWithPageViewport

public void associateIDWithPageViewport(java.lang.String id,
                                        PageViewport pv)
Tie a PageViewport with an ID found on a child area of the PV. Note that an area with a given ID may be on more than one PV, hence an ID may have more than one PV associated with it.

Parameters:
id - the property ID of the area
pv - a page viewport that contains the area with this ID

tryIDResolution

public void tryIDResolution(PageViewport pv)
Tries to resolve all unresolved ID references on the given page.

Parameters:
pv - page viewport whose ID refs to resolve

getPageViewportsContainingID

public java.util.List getPageViewportsContainingID(java.lang.String id)
Get the list of page viewports that have an area with a given id.

Parameters:
id - the id to lookup
Returns:
the list of PageViewports

getResults

public FormattingResults getResults()
Get information about the rendered output, like number of pages created.

Returns:
the results structure

addUnresolvedIDRef

public void addUnresolvedIDRef(java.lang.String idref,
                               Resolvable res)
Add an Resolvable object with an unresolved idref

Parameters:
idref - the idref whose target id has not yet been located
res - the Resolvable object needing the idref to be resolved

startDocument

public void startDocument()
                   throws org.xml.sax.SAXException
Prepare AreaTreeHandler for document processing This is called from FOTreeBuilder.startDocument()

Overrides:
startDocument in class FOEventHandler
Throws:
org.xml.sax.SAXException - if there is an error

startPageSequence

public void startPageSequence(PageSequence pageSequence)
Overrides:
startPageSequence in class FOEventHandler
Parameters:
pageSequence - PageSequence that is starting.
See Also:
FOEventHandler

endPageSequence

public void endPageSequence(PageSequence pageSequence)
End the PageSequence. The PageSequence formats Pages and adds them to the AreaTree. The area tree then handles what happens with the pages.

Overrides:
endPageSequence in class FOEventHandler
Parameters:
pageSequence - the page sequence ending

notifyPageSequenceFinished

public void notifyPageSequenceFinished(PageSequence pageSequence,
                                       int pageCount)
Called by the PageSequenceLayoutManager when it is finished with a page-sequence.

Parameters:
pageSequence - the page-sequence just finished
pageCount - The number of pages generated for the page-sequence

endDocument

public void endDocument()
                 throws org.xml.sax.SAXException
End the document.

Overrides:
endDocument in class FOEventHandler
Throws:
org.xml.sax.SAXException - if there is some error

fop 0.90alpha1

Copyright 1999-2005 The Apache Software Foundation. All Rights Reserved.