Package 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 Description protected java.util.List<PageViewport>preparedPages that have been prepared but not rendered yet.protected RendererrendererThe renderer that will render the pages.-
Fields inherited from class org.apache.fop.area.AreaTreeModel
currentPageSequence, log
-
-
Constructor Summary
Constructors Constructor 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 Description voidaddPage(PageViewport page)Add a page to the render page model.protected booleancheckPreparedPages(PageViewport newPageViewport, boolean renderUnresolved)Check prepared pagesvoidendDocument()End the document.voidhandleOffDocumentItem(OffDocumentItem oDI)Handle an OffDocumentItemprotected voidpreparePage(PageViewport page)Prepare a page.protected voidrenderPage(PageViewport pageViewport)Renders the given page and notified about unresolved IDs if any.voidsetDocumentLocale(java.util.Locale locale)voidstartPageSequence(PageSequence pageSequence)Start a page sequence on this model.-
Methods inherited from class org.apache.fop.area.AreaTreeModel
getCurrentPageSequence, getPage, getPageCount, getPageSequenceCount
-
-
-
-
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 processoutputFormat- the MIME type of the output format to use (ex. "application/pdf").fontInfo- FontInfo objectstream- OutputStream- Throws:
FOPException- if the renderer cannot be properly initialized
-
-
Method Detail
-
setDocumentLocale
public void setDocumentLocale(java.util.Locale locale)
- Overrides:
setDocumentLocalein classAreaTreeModel- Parameters:
locale- The locale of the document
-
startPageSequence
public void startPageSequence(PageSequence pageSequence)
Start a page sequence on this model.- Overrides:
startPageSequencein classAreaTreeModel- 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:
addPagein classAreaTreeModel- 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 addedrenderUnresolved- 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:
handleOffDocumentItemin classAreaTreeModel- Parameters:
oDI- the extension to handle
-
endDocument
public void endDocument() throws org.xml.sax.SAXExceptionEnd the document. Render any end document OffDocumentItems Signal the end of the document for any processing.- Overrides:
endDocumentin classAreaTreeModel- Throws:
org.xml.sax.SAXException- if a problem was encountered.
-
-