Class Root

All Implemented Interfaces:
Cloneable, Constants, CommonAccessibilityHolder

public class Root extends FObj implements CommonAccessibilityHolder
Class modeling the fo:root formatting object. Contains page masters, page-sequences.
  • Constructor Details

    • Root

      public Root(FONode parent)
      Base constructor
      Parameters:
      parent - FONode that is the parent of this object Note: parent should be null for the fo:root.
  • Method Details

    • setLastSeq

      public void setLastSeq(PageSequence seq)
    • getLastSeq

      public PageSequence getLastSeq()
    • bind

      public void bind(PropertyList pList) throws FOPException
      Bind property values from the property list to the FO node. Must be overridden in all FObj subclasses that have properties applying to it.
      Overrides:
      bind in class FObj
      Parameters:
      pList - the PropertyList where the properties can be found.
      Throws:
      FOPException - if there is a problem binding the values
    • startOfNode

      public void startOfNode() throws FOPException
      Called after processNode() is called. Subclasses can do additional processing.
      Overrides:
      startOfNode in class FObj
      Throws:
      FOPException - FOP Exception
    • endOfNode

      public void endOfNode() throws FOPException
      Primarily used for making final content model validation checks and/or informing the FOEventHandler that the end of this FO has been reached. The default implementation simply calls FONode.finalizeNode(), without sending any event to the FOEventHandler.

      Note: the recommended way to override this method in subclasses is

      super.endOfNode(); // invoke finalizeNode()

      getFOEventHandler().endXXX(); // send endOfNode() notification

      Overrides:
      endOfNode in class FObj
      Throws:
      FOPException - FOP Exception
    • validateChildNode

      protected void validateChildNode(Locator loc, String nsURI, String localName) throws ValidationException
      Checks to make sure, during SAX processing of input document, that the incoming node is valid for this (parent) node (e.g., checking to see that fo:table is not an immediate child of fo:root) called from FOTreeBuilder.startElement(String, String, String, Attributes) before constructing the child FObj.
      XSL 1.0 Spec: (layout-master-set,declarations?,page-sequence+)
      FOP: (layout-master-set, declarations?, fox:bookmarks?, page-sequence+)
      Overrides:
      validateChildNode in class FONode
      Parameters:
      loc - location in the FO source file
      nsURI - namespace of incoming node
      localName - name of the incoming node (without namespace prefix)
      Throws:
      ValidationException - if incoming node not valid for parent
    • validateChildNode

      protected void validateChildNode(Locator loc, FONode child) throws ValidationException
      Parameters:
      loc - location in the source file
      child - the FONode to validate against
      Throws:
      ValidationException - if the incoming node is not a valid child for the given FO
    • getCommonAccessibility

      public CommonAccessibility getCommonAccessibility()
      Returns the accessibility properties.
      Specified by:
      getCommonAccessibility in interface CommonAccessibilityHolder
      Returns:
      the accessibility properties
    • setFOEventHandler

      public void setFOEventHandler(FOEventHandler foEventHandler)
      Sets the FOEventHandler object that this Root is attached to
      Parameters:
      foEventHandler - the FOEventHandler object
    • getFOEventHandler

      public FOEventHandler getFOEventHandler()
      This method overrides the FONode version. The FONode version calls the method by the same name for the parent object. Since Root is at the top of the tree, it returns the actual FOEventHandler object. Thus, any FONode can use this chain to find which FOEventHandler it is being built for.
      Overrides:
      getFOEventHandler in class FONode
      Returns:
      the FOEventHandler implementation that this Root is attached to
    • setBuilderContext

      public void setBuilderContext(FOTreeBuilderContext context)
      Sets the builder context for this FO tree.
      Parameters:
      context - the builder context to be used
    • getBuilderContext

      public FOTreeBuilderContext getBuilderContext()
      Returns the context class providing information used during FO tree building.
      Overrides:
      getBuilderContext in class FONode
      Returns:
      the builder context
    • getEndingPageNumberOfPreviousSequence

      public int getEndingPageNumberOfPreviousSequence()
      Gets the last page number generated by the previous page-sequence
      Returns:
      the last page number, 0 if no page sequences yet generated
    • getTotalPagesGenerated

      public int getTotalPagesGenerated()
      Returns the total number of pages generated by FOP (May not equal endingPageNumberOfPreviousSequence due to initial-page-number property on fo:page-sequences.)
      Returns:
      the last page number, 0 if no page sequences yet generated
    • notifyPageSequenceFinished

      public void notifyPageSequenceFinished(int lastPageNumber, int additionalPages) throws IllegalArgumentException
      Notify additional pages generated to increase the totalPagesGenerated counter
      Parameters:
      lastPageNumber - the last page number generated by the sequence
      additionalPages - the total pages generated by the sequence (for statistics)
      Throws:
      IllegalArgumentException - for negative additional page counts
    • getPageSequenceCount

      public int getPageSequenceCount()
      Returns the number of PageSequence instances.
      Returns:
      the number of PageSequence instances
    • getSucceedingPageSequence

      public PageSequence getSucceedingPageSequence(PageSequence current)
      Some properties, such as 'force-page-count', require a page-sequence to know about some properties of the next.
      Parameters:
      current - the current PageSequence
      Returns:
      succeeding PageSequence; null if none
    • addPageSequence

      public void addPageSequence(PageSequence pageSequence)
      Adds the specified page sequence.
      Parameters:
      pageSequence - The page sequence to add
    • getLastPageSequence

      public PageSequence getLastPageSequence()
      Returns the last page sequence (current while parsing).
      Returns:
      The last page sequence or null
    • getLayoutMasterSet

      public LayoutMasterSet getLayoutMasterSet()
      Returns the associated LayoutMasterSet.
      Returns:
      the LayoutMasterSet instance
    • setLayoutMasterSet

      public void setLayoutMasterSet(LayoutMasterSet layoutMasterSet)
      Sets the associated LayoutMasterSet.
      Parameters:
      layoutMasterSet - the LayoutMasterSet to use
    • getDeclarations

      public Declarations getDeclarations()
      Returns the associated Declarations.
      Returns:
      the Declarations instance
    • setDeclarations

      public void setDeclarations(Declarations declarations)
      Sets the associated Declarations.
      Parameters:
      declarations - the Declarations to use
    • setBookmarkTree

      public void setBookmarkTree(BookmarkTree bookmarkTree)
      Set the BookmarkTree object for this FO
      Parameters:
      bookmarkTree - the BookmarkTree object
    • addDestination

      public void addDestination(Destination destination)
      Add a Destination object to this FO
      Parameters:
      destination - the Destination object to add
    • getDestinationList

      public List getDestinationList()
      Public accessor for the list of Destination objects for this FO
      Returns:
      the Destination object
    • getBookmarkTree

      public BookmarkTree getBookmarkTree()
      Public accessor for the BookmarkTree object for this FO
      Returns:
      the BookmarkTree object
    • getRoot

      public Root getRoot()
      Returns the root node of this tree
      Overrides:
      getRoot in class FONode
      Returns:
      the root node
    • getLocalName

      public String getLocalName()
      Returns the local name (i.e. without namespace prefix) of the node
      Specified by:
      getLocalName in class FONode
      Returns:
      the local name of this node
    • getNameId

      public int getNameId()
      Returns the Constants class integer value of this node
      Overrides:
      getNameId in class FONode
      Returns:
      Constants.FO_ROOT
    • getLocale

      public Locale getLocale()
      Returns:
      locale proprty.