Class AbstractPageSequenceLayoutManager

All Implemented Interfaces:
PercentBaseContext, Constants, LayoutManager, TopLevelLayoutManager
Direct Known Subclasses:
ExternalDocumentLayoutManager, PageSequenceLayoutManager

public abstract class AbstractPageSequenceLayoutManager extends AbstractLayoutManager implements TopLevelLayoutManager
Abstract base class for a page sequence layout manager.
  • Field Details

    • areaTreeHandler

      protected AreaTreeHandler areaTreeHandler
      AreaTreeHandler which activates the PSLM and controls the rendering of its pages.
    • idTracker

      protected IDTracker idTracker
      ID tracker supplied by the AreaTreeHandler
    • pageSeq

      protected AbstractPageSequence pageSeq
      page sequence formatting object being processed by this class
    • curPage

      protected Page curPage
      Current page with page-viewport-area being filled by the PSLM.
    • currentPageNum

      protected int currentPageNum
      the current page number
    • startPageNum

      protected int startPageNum
      The stating page number
  • Constructor Details

    • AbstractPageSequenceLayoutManager

      public AbstractPageSequenceLayoutManager(AreaTreeHandler ath, AbstractPageSequence pseq)
      Constructor
      Parameters:
      ath - the area tree handler object
      pseq - fo:page-sequence to process
  • Method Details

    • getLayoutManagerMaker

      public LayoutManagerMaker getLayoutManagerMaker()
      Returns:
      the LayoutManagerMaker object associated to the areaTreeHandler
    • getCurrentPage

      public Page getCurrentPage()
      Provides access to the current page.
      Overrides:
      getCurrentPage in class AbstractLayoutManager
      Returns:
      the current Page
      See Also:
    • setCurrentPage

      protected void setCurrentPage(Page currentPage)
      Provides access for setting the current page.
      Parameters:
      currentPage - the new current Page
    • getCurrentPageNum

      protected int getCurrentPageNum()
      Provides access to the current page number
      Returns:
      the current page number
    • initialize

      public void initialize()
      initialize the layout manager. Allows each layout manager to calculate often used values.
      Specified by:
      initialize in interface LayoutManager
      Overrides:
      initialize in class AbstractLayoutManager
    • getFirstPVWithID

      public PageViewport getFirstPVWithID(String idref)
      This returns the first PageViewport that contains an id trait matching the idref argument, or null if no such PV exists.
      Parameters:
      idref - the idref trait needing to be resolved
      Returns:
      the first PageViewport that contains the ID trait
    • getLastPVWithID

      public PageViewport getLastPVWithID(String idref)
      This returns the last PageViewport that contains an id trait matching the idref argument, or null if no such PV exists.
      Parameters:
      idref - the idref trait needing to be resolved
      Returns:
      the last PageViewport that contains the ID trait
    • addIDToPage

      public void addIDToPage(String id)
      Add an ID reference to the current page. When adding areas the area adds its ID reference. For the page layout manager it adds the id reference with the current page to the area tree.
      Parameters:
      id - the ID reference to add
    • associateLayoutManagerID

      public boolean associateLayoutManagerID(String id)
      Add an id reference of the layout manager in the AreaTreeHandler, if the id hasn't been resolved yet
      Parameters:
      id - the id to track
      Returns:
      a boolean indicating if the id has already been resolved TODO Maybe give this a better name
    • notifyEndOfLayout

      public void notifyEndOfLayout(String id)
      Notify the areaTreeHandler that the LayoutManagers containing idrefs have finished creating areas
      Parameters:
      id - the id for which layout has finished
    • addUnresolvedArea

      public void addUnresolvedArea(String id, Resolvable res)
      Identify an unresolved area (one needing an idref to be resolved, e.g. the internal-destination of an fo:basic-link) for both the AreaTreeHandler and PageViewport object. The IDTracker keeps a document-wide list of idref's and the PV's needing them to be resolved. It uses this to send notifications to the PV's when an id has been resolved. The PageViewport keeps lists of id's needing resolving, along with the child areas (page-number-citation, basic-link, etc.) of the PV needing their resolution.
      Parameters:
      id - the ID reference to add
      res - the resolvable object that needs resolving
    • resolveRetrieveMarker

      public RetrieveMarker resolveRetrieveMarker(RetrieveMarker rm)
      Bind the RetrieveMarker to the corresponding Marker subtree. If the boundary is page then it will only check the current page. For page-sequence and document it will lookup preceding pages from the area tree and try to find a marker. If we retrieve a marker from a preceding page, then the containing page does not have a qualifying area, and all qualifying areas have ended. Therefore we use last-ending-within-page (Constants.EN_LEWP) as the position.
      Parameters:
      rm - the RetrieveMarker instance whose properties are to used to find the matching Marker.
      Returns:
      a bound RetrieveMarker instance, or null if no Marker could be found.
    • createPage

      protected abstract Page createPage(int pageNumber, boolean isBlank)
      Creates and returns a new page.
      Parameters:
      pageNumber - the page number
      isBlank - true if it's a blank page
      Returns:
      the newly created page
    • makeNewPage

      protected Page makeNewPage(boolean isBlank)
      Makes a new page
      Parameters:
      isBlank - whether this page is blank or not
      Returns:
      a new page
    • finishPage

      protected void finishPage()
      Finishes a page in preparation for a new page.
    • doForcePageCount

      public void doForcePageCount(Numeric nextPageSeqInitialPageNumber)
      Act upon the force-page-count trait, in relation to the initial-page-number trait of the following page-sequence.
      Specified by:
      doForcePageCount in interface TopLevelLayoutManager
      Parameters:
      nextPageSeqInitialPageNumber - initial-page-number trait of next page-sequence
    • reset

      public void reset()
      Re-initializes this layout manager in order to re-generate its Knuth elements according to a new IPD value.
      Specified by:
      reset in interface LayoutManager
      Overrides:
      reset in class AbstractLayoutManager
    • getLastPageNumber

      protected int getLastPageNumber()