org.apache.fop.area

## Class RenderPagesModel

- java.lang.Object
- - org.apache.fop.area.AreaTreeModel
  - - org.apache.fop.area.RenderPagesModel

- Direct Known Subclasses:
    CachedRenderPagesModel

      public class RenderPagesModel
      extends AreaTreeModel

  This uses the AreaTreeModel to store the pages Each page is either rendered if ready or prepared for later rendering. Once a page is rendered it is cleared to release the contents but the PageViewport is retained. So even though the pages are stored the contents are discarded.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected java.util.List<PageViewport>` | `prepared` Pages that have been prepared but not rendered yet.
    `protected Renderer` | `renderer` The renderer that will render the pages.

    - ### Fields inherited from class org.apache.fop.area.AreaTreeModel

      `currentPageSequence, log`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `RenderPagesModel(FOUserAgent userAgent, java.lang.String outputFormat, FontInfo fontInfo, java.io.OutputStream stream)` Create a new render pages model with the given renderer.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addPage(PageViewport page)` Add a page to the render page model.
    `protected boolean` | `checkPreparedPages(PageViewport newPageViewport, boolean renderUnresolved)` Check prepared pages
    `void` | `endDocument()` End the document.
    `void` | `handleOffDocumentItem(OffDocumentItem oDI)` Handle an OffDocumentItem
    `protected void` | `preparePage(PageViewport page)` Prepare a page.
    `protected void` | `renderPage(PageViewport pageViewport)` Renders the given page and notified about unresolved IDs if any.
    `void` | `setDocumentLocale(java.util.Locale locale)`
    `void` | `startPageSequence(PageSequence pageSequence)` Start a page sequence on this model.

    - ### Methods inherited from class org.apache.fop.area.AreaTreeModel

      `getCurrentPageSequence, getPage, getPageCount, getPageSequenceCount`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### renderer

          protected Renderer renderer

      The renderer that will render the pages.

    - #### prepared

          protected java.util.List<PageViewport> prepared

      Pages that have been prepared but not rendered yet.

  - ### Constructor Detail

    - #### RenderPagesModel

          public RenderPagesModel(FOUserAgent userAgent,
                                  java.lang.String outputFormat,
                                  FontInfo fontInfo,
                                  java.io.OutputStream stream)
                           throws FOPException

      Create a new render pages model with the given renderer.
      Parameters:
        `userAgent` - FOUserAgent object for process
        `outputFormat` - the MIME type of the output format to use (ex. "application/pdf").
        `fontInfo` - FontInfo object
        `stream` - OutputStream
      Throws:
        `FOPException` - if the renderer cannot be properly initialized

  - ### Method Detail

    - #### setDocumentLocale

          public void setDocumentLocale(java.util.Locale locale)

      Overrides:
        `setDocumentLocale` in class `AreaTreeModel`
      Parameters:
        `locale` - The locale of the document

    - #### startPageSequence

          public void startPageSequence(PageSequence pageSequence)

      Start a page sequence on this model.
      Overrides:
        `startPageSequence` in class `AreaTreeModel`
      Parameters:
        `pageSequence` - the page sequence about to start

    - #### addPage

          public void addPage(PageViewport page)

      Add a page to the render page model. If the page is finished it can be rendered immediately. If the page needs resolving then if the renderer supports out of order rendering it can prepare the page. Otherwise the page is added to a queue.
      Overrides:
        `addPage` in class `AreaTreeModel`
      Parameters:
        `page` - the page to add to the model

    - #### checkPreparedPages

          protected boolean checkPreparedPages(PageViewport newPageViewport,
                                               boolean renderUnresolved)

      Check prepared pages
      Parameters:
        `newPageViewport` - the new page being added
        `renderUnresolved` - render pages with unresolved idref's (done at end-of-document processing)
      Returns:
        true if the current page should be rendered false if the renderer doesn't support out of order rendering and there are pending pages

    - #### renderPage

          protected void renderPage(PageViewport pageViewport)

      Renders the given page and notified about unresolved IDs if any.
      Parameters:
        `pageViewport` - the page to be rendered.

    - #### preparePage

          protected void preparePage(PageViewport page)

      Prepare a page. An unresolved page can be prepared if the renderer supports it and the page will be rendered later.
      Parameters:
        `page` - the page to prepare

    - #### handleOffDocumentItem

          public void handleOffDocumentItem(OffDocumentItem oDI)

      Handle an OffDocumentItem
      Overrides:
        `handleOffDocumentItem` in class `AreaTreeModel`
      Parameters:
        `oDI` - the extension to handle

    - #### endDocument

          public void endDocument()
                           throws org.xml.sax.SAXException

      End the document. Render any end document OffDocumentItems Signal the end of the document for any processing.
      Overrides:
        `endDocument` in class `AreaTreeModel`
      Throws:
        `org.xml.sax.SAXException` - if a problem was encountered.

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