Class PageSequence

All Implemented Interfaces:
Cloneable, Constants, CommonAccessibilityHolder, WritingModeTraitsGetter

public class PageSequence extends AbstractPageSequence implements WritingModeTraitsGetter
Class modelling the fo:page-sequence object.
  • Constructor Details

    • PageSequence

      public PageSequence(FONode parent)
      Create a PageSequence instance that is a child of the given FONode.
      Parameters:
      parent - the parent FONode
  • Method Details

    • 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 AbstractPageSequence
      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 AbstractPageSequence
      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 Content Model: (title?,static-content*,flow)
      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
    • addChildNode

      public void addChildNode(FONode child) throws FOPException
      Adds a node as a child of this node. The default implementation of this method just ignores any child node being added. TODO see if addChildNode() should also be called for fo's other than fo:flow.
      Overrides:
      addChildNode in class FObj
      Parameters:
      child - child node to be added to the childNodes of this node
      Throws:
      FOPException - if there's a problem during processing
    • getStaticContent

      public StaticContent getStaticContent(String name)
      Get the static content FO node from the flow map. This gets the static content flow for the given flow name.
      Parameters:
      name - the flow name to find
      Returns:
      the static content FO node
    • getTitleFO

      public Title getTitleFO()
      Accessor method for the fo:title associated with this fo:page-sequence
      Returns:
      titleFO for this object
    • getMainFlow

      public Flow getMainFlow()
      Public accessor for getting the MainFlow to which this PageSequence is attached.
      Returns:
      the MainFlow object to which this PageSequence is attached.
    • hasFlowName

      public boolean hasFlowName(String flowName)
      Determine if this PageSequence already has a flow with the given flow-name Used for validation of incoming fo:flow or fo:static-content objects
      Parameters:
      flowName - The flow-name to search for
      Returns:
      true if flow-name already defined within this page sequence, false otherwise
    • getFlowMap

      public Map<String,FONode> getFlowMap()
      Returns:
      the flow map for this page-sequence
    • getNextSimplePageMaster

      public SimplePageMaster getNextSimplePageMaster(int page, boolean isFirstPage, boolean isLastPage, boolean isBlank, boolean skipPagePositionOnly) throws PageProductionException
      Public accessor for determining the next page master to use within this page sequence.
      Parameters:
      page - the page number of the page to be created
      isFirstPage - indicator whether this page is the first page of the page sequence
      isLastPage - indicator whether this page is the last page of the page sequence
      isBlank - indicator whether the page will be blank
      Returns:
      the SimplePageMaster to use for this page
      Throws:
      PageProductionException - if there's a problem determining the page master
    • goToPreviousSimplePageMaster

      public boolean goToPreviousSimplePageMaster()
      Used to set the "cursor position" for the page masters to the previous item.
      Returns:
      true if there is a previous item, false if the current one was the first one.
    • hasPagePositionLast

      public boolean hasPagePositionLast()
      Returns:
      true if the page-sequence has a page-master with page-position="last"
    • hasPagePositionOnly

      public boolean hasPagePositionOnly()
      Returns:
      true if the page-sequence has a page-master with page-position="only"
    • getMasterReference

      public String getMasterReference()
      Get the value of the master-reference trait.
      Returns:
      the "master-reference" trait
    • 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_PAGE_SEQUENCE
    • getLocale

      public Locale getLocale()
    • getReferenceOrientation

      public int getReferenceOrientation()
      Get the value of the reference-orientation trait.
      Overrides:
      getReferenceOrientation in class AbstractPageSequence
      Returns:
      the reference orientation trait value
    • getInlineProgressionDirection

      public Direction getInlineProgressionDirection()
      Specified by:
      getInlineProgressionDirection in interface WritingModeTraitsGetter
      Returns:
      the "inline-progression-direction" trait
    • getBlockProgressionDirection

      public Direction getBlockProgressionDirection()
      Specified by:
      getBlockProgressionDirection in interface WritingModeTraitsGetter
      Returns:
      the "block-progression-direction" trait
    • getColumnProgressionDirection

      public Direction getColumnProgressionDirection()
      Specified by:
      getColumnProgressionDirection in interface WritingModeTraitsGetter
      Returns:
      the "column-progression-direction" trait
    • getRowProgressionDirection

      public Direction getRowProgressionDirection()
      Specified by:
      getRowProgressionDirection in interface WritingModeTraitsGetter
      Returns:
      the "row-progression-direction" trait
    • getShiftDirection

      public Direction getShiftDirection()
      Specified by:
      getShiftDirection in interface WritingModeTraitsGetter
      Returns:
      the "shift-direction" trait
    • getWritingMode

      public WritingMode getWritingMode()
      Specified by:
      getWritingMode in interface WritingModeTraitsGetter
      Returns:
      the "writing-mode" trait
    • getExplicitWritingMode

      public boolean getExplicitWritingMode()
      Specified by:
      getExplicitWritingMode in interface WritingModeTraitsGetter
      Returns:
      the "explicit-writing-mode" trait
    • collectDelimitedTextRanges

      protected Stack<DelimitedTextRange> collectDelimitedTextRanges(Stack<DelimitedTextRange> ranges, DelimitedTextRange currentRange)
      Description copied from class: FONode
      Collect the sequence of delimited text ranges, where each new range is pushed onto RANGES, where default implementation collects ranges of child nodes.
      Overrides:
      collectDelimitedTextRanges in class FONode
      Parameters:
      ranges - a stack of delimited text ranges
      currentRange - the current range or null (if none)
      Returns:
      the (possibly) updated stack of delimited text ranges
    • isBidiBoundary

      protected boolean isBidiBoundary(boolean propagate)
      Overrides:
      isBidiBoundary in class FObj
    • releasePageSequence

      public void releasePageSequence()
      Releases a page-sequence's children after the page-sequence has been fully processed.
    • getLastSimplePageMaster

      public SimplePageMaster getLastSimplePageMaster(int page, boolean isFirstPage, boolean isBlank)
    • pushChangeBar

      public void pushChangeBar(ChangeBar changeBarBegin)
      Adds the specified change bar to the active change bar list.
      Parameters:
      changeBarBegin - The starting change bar element
    • popChangeBar

      public void popChangeBar(ChangeBar changeBarEnd)
      Removes the couple of the specified change bar from the active change bar list.
      Parameters:
      changeBarEnd - The ending change bar element
    • getChangeBarBegin

      public ChangeBar getChangeBarBegin(ChangeBar changeBarEnd)
      Returns the starting counterpart of the specified ending change bar.
      Parameters:
      changeBarEnd - The ending change bar element
      Returns:
      The starting counterpart of the specified ending change bar
    • hasChangeBars

      public boolean hasChangeBars()
      Tests if there are any active change bars.
      Returns:
      A boolean value true if there are any active change bars
    • getChangeBarList

      public List<ChangeBar> getChangeBarList()
      Returns the list of active change bars.
      Overrides:
      getChangeBarList in class FONode
      Returns:
      The list of active change bars
    • getClonedChangeBarList

      public List<ChangeBar> getClonedChangeBarList()
      Returns the copy of active change bars list.
      Returns:
      The list containing a copy of the active change bars
    • setOnlyTryInfinite

      public void setOnlyTryInfinite(boolean b)