diff options
Diffstat (limited to 'src/java/org/apache/fop')
-rw-r--r-- | src/java/org/apache/fop/area/AreaTreeHandler.java | 3 | ||||
-rw-r--r-- | src/java/org/apache/fop/area/AreaTreeModel.java | 3 | ||||
-rw-r--r-- | src/java/org/apache/fop/area/BookmarkData.java (renamed from src/java/org/apache/fop/area/extensions/BookmarkData.java) | 14 | ||||
-rw-r--r-- | src/java/org/apache/fop/area/OffDocumentItem.java | 21 | ||||
-rw-r--r-- | src/java/org/apache/fop/area/RenderPagesModel.java | 33 | ||||
-rw-r--r-- | src/java/org/apache/fop/area/StorePagesModel.java | 24 | ||||
-rw-r--r-- | src/java/org/apache/fop/render/pdf/PDFRenderer.java | 2 |
7 files changed, 52 insertions, 48 deletions
diff --git a/src/java/org/apache/fop/area/AreaTreeHandler.java b/src/java/org/apache/fop/area/AreaTreeHandler.java index ca5d2a2a0..911def5be 100644 --- a/src/java/org/apache/fop/area/AreaTreeHandler.java +++ b/src/java/org/apache/fop/area/AreaTreeHandler.java @@ -33,7 +33,6 @@ import org.xml.sax.SAXException; // Apache import org.apache.fop.apps.FOPException; import org.apache.fop.apps.FOUserAgent; -import org.apache.fop.area.extensions.BookmarkData; import org.apache.fop.fo.FOEventHandler; import org.apache.fop.fo.extensions.Outline; import org.apache.fop.fo.extensions.Bookmarks; @@ -317,7 +316,7 @@ public class AreaTreeHandler extends FOEventHandler { } } } else { - model.handleOffDocumentItem(ext, OffDocumentItem.IMMEDIATELY); + model.handleOffDocumentItem(ext); } } } diff --git a/src/java/org/apache/fop/area/AreaTreeModel.java b/src/java/org/apache/fop/area/AreaTreeModel.java index 28d9ff4c5..c1fe32d1e 100644 --- a/src/java/org/apache/fop/area/AreaTreeModel.java +++ b/src/java/org/apache/fop/area/AreaTreeModel.java @@ -45,9 +45,8 @@ public abstract class AreaTreeModel { /** * Handle an OffDocumentItem * @param ext the extension to handle - * @param when when the extension should be handled */ - public abstract void handleOffDocumentItem(OffDocumentItem ext, int when); + public abstract void handleOffDocumentItem(OffDocumentItem ext); /** * Signal the end of the document for any processing. diff --git a/src/java/org/apache/fop/area/extensions/BookmarkData.java b/src/java/org/apache/fop/area/BookmarkData.java index 3f6a2154e..6b1ad7c76 100644 --- a/src/java/org/apache/fop/area/extensions/BookmarkData.java +++ b/src/java/org/apache/fop/area/BookmarkData.java @@ -16,21 +16,16 @@ /* $Id$ */ -package org.apache.fop.area.extensions; - -import org.apache.fop.area.PageViewport; -import org.apache.fop.area.Resolvable; -import org.apache.fop.area.OffDocumentItem; -import org.apache.fop.area.AreaTreeModel; +package org.apache.fop.area; import java.util.ArrayList; import java.util.List; import java.util.HashMap; /** - * This class holds the PDF bookmark extension data. + * This class holds the PDF bookmark OffDocumentItem */ -public class BookmarkData implements Resolvable, OffDocumentItem { +public class BookmarkData extends OffDocumentItem implements Resolvable { private ArrayList subData = new ArrayList(); private HashMap idRefs = new HashMap(); @@ -48,6 +43,7 @@ public class BookmarkData implements Resolvable, OffDocumentItem { */ public BookmarkData() { idRef = null; + whenToProcess = IMMEDIATELY; } /** @@ -201,7 +197,7 @@ public class BookmarkData implements Resolvable, OffDocumentItem { if (idRefs.size() == 0) { idRefs = null; if (areaTreeModel != null) { - areaTreeModel.handleOffDocumentItem(this, OffDocumentItem.AFTER_PAGE); + areaTreeModel.handleOffDocumentItem(this); } } } diff --git a/src/java/org/apache/fop/area/OffDocumentItem.java b/src/java/org/apache/fop/area/OffDocumentItem.java index 78ebb6506..8f740bb1a 100644 --- a/src/java/org/apache/fop/area/OffDocumentItem.java +++ b/src/java/org/apache/fop/area/OffDocumentItem.java @@ -19,28 +19,39 @@ package org.apache.fop.area; /** - * Interface for objects that are processed by the renderer outside + * Abstract base class for objects that are processed by the renderer outside * of the actual document. * This object can be handled by the renderer according to three * possibilities, IMMEDIATELY, AFTER_PAGE, or END_OF_DOC. */ -public interface OffDocumentItem { +public abstract class OffDocumentItem { + /** - * Render this extension immediately when + * Process this extension immediately when * being handled by the area tree. */ public static final int IMMEDIATELY = 0; /** - * Render this extension after the next page is rendered + * Process this extension after the next page is rendered * or prepared when being handled by the area tree. */ public static final int AFTER_PAGE = 1; /** - * Render this extension at the end of the document once + * Process this extension at the end of the document once * all pages have been fully rendered. */ public static final int END_OF_DOC = 2; + + protected int whenToProcess = IMMEDIATELY; + + /** + * Get an indicator of when this item should be processed + * @return int constant (IMMEDIATELY, AFTER_PAGE, END_OF_DOC) + */ + public int getWhenToProcess() { + return whenToProcess; + } } diff --git a/src/java/org/apache/fop/area/RenderPagesModel.java b/src/java/org/apache/fop/area/RenderPagesModel.java index 16135408e..ad8a125b6 100644 --- a/src/java/org/apache/fop/area/RenderPagesModel.java +++ b/src/java/org/apache/fop/area/RenderPagesModel.java @@ -52,8 +52,8 @@ public class RenderPagesModel extends StorePagesModel { * Pages that have been prepared but not rendered yet. */ protected List prepared = new java.util.ArrayList(); - private List pendingExt = new java.util.ArrayList(); - private List endDocExt = new java.util.ArrayList(); + private List pendingODI = new java.util.ArrayList(); + private List endDocODI = new java.util.ArrayList(); /** * Create a new render pages model with the given renderer. @@ -126,8 +126,8 @@ public class RenderPagesModel extends StorePagesModel { boolean cont = checkPreparedPages(page); if (cont) { - processOffDocumentItems(pendingExt); - pendingExt.clear(); + processOffDocumentItems(pendingODI); + pendingODI.clear(); } } @@ -175,41 +175,40 @@ public class RenderPagesModel extends StorePagesModel { } /** - * @see org.apache.fop.area.AreaTreeModel#handleOffDocumentItem(OffDocumentItem, int) + * @see org.apache.fop.area.AreaTreeModel#handleOffDocumentItem(OffDocumentItem) */ - public void handleOffDocumentItem(OffDocumentItem ext, int when) { - switch(when) { + public void handleOffDocumentItem(OffDocumentItem oDI) { + switch(oDI.getWhenToProcess()) { case OffDocumentItem.IMMEDIATELY: - renderer.processOffDocumentItem(ext); + renderer.processOffDocumentItem(oDI); break; case OffDocumentItem.AFTER_PAGE: - pendingExt.add(ext); + pendingODI.add(oDI); break; case OffDocumentItem.END_OF_DOC: - endDocExt.add(ext); + endDocODI.add(oDI); break; } } private void processOffDocumentItems(List list) { for (int count = 0; count < list.size(); count++) { - OffDocumentItem ext = (OffDocumentItem)list.get(count); - renderer.processOffDocumentItem(ext); + OffDocumentItem oDI = (OffDocumentItem)list.get(count); + renderer.processOffDocumentItem(oDI); } } /** - * End the document. Render any end document extensions. + * End the document. Render any end document OffDocumentItems * @see org.apache.fop.area.AreaTreeModel#endDocument() */ public void endDocument() throws SAXException { // render any pages that had unresolved ids checkPreparedPages(null); - processOffDocumentItems(pendingExt); - pendingExt.clear(); - - processOffDocumentItems(endDocExt); + processOffDocumentItems(pendingODI); + pendingODI.clear(); + processOffDocumentItems(endDocODI); try { renderer.stopRenderer(); diff --git a/src/java/org/apache/fop/area/StorePagesModel.java b/src/java/org/apache/fop/area/StorePagesModel.java index 7cfe41434..e293d5faf 100644 --- a/src/java/org/apache/fop/area/StorePagesModel.java +++ b/src/java/org/apache/fop/area/StorePagesModel.java @@ -33,7 +33,7 @@ import org.xml.sax.SAXException; public class StorePagesModel extends AreaTreeModel { private List pageSequence = null; private List currSequence; - private List extensions = new java.util.ArrayList(); + private List offDocumentItems = new java.util.ArrayList(); /** * Create a new store pages model @@ -92,11 +92,11 @@ public class StorePagesModel extends AreaTreeModel { } /** - * @see org.apache.fop.area.AreaTreeModel#handleOffDocumentItem(OffDocumentItem, int) + * @see org.apache.fop.area.AreaTreeModel#handleOffDocumentItem(OffDocumentItem) */ - public void handleOffDocumentItem(OffDocumentItem ext, int when) { + public void handleOffDocumentItem(OffDocumentItem ext) { int seq, page; - switch(when) { + switch(ext.getWhenToProcess()) { case OffDocumentItem.IMMEDIATELY: seq = pageSequence == null ? 0 : pageSequence.size(); page = currSequence == null ? 0 : currSequence.size(); @@ -106,26 +106,26 @@ public class StorePagesModel extends AreaTreeModel { case OffDocumentItem.END_OF_DOC: break; } - extensions.add(ext); + offDocumentItems.add(ext); } /** - * Get the list of extensions that apply at a particular + * Get the list of OffDocumentItems that apply at a particular * position in the document. * @param seq the page sequence number * @param count the page count in the sequence - * @return the list of extensions + * @return the list of OffDocumentItems */ - public List getExtensions(int seq, int count) { + public List getOffDocumentItems(int seq, int count) { return null; } /** - * Get the end of document extensions for this stroe pages model. - * @return the list of end extensions + * Get the end of document OffDocumentItems for this store pages model. + * @return the list of end OffDocumentItems */ - public List getEndExtensions() { - return extensions; + public List getEndOffDocumentItems() { + return offDocumentItems; } /** diff --git a/src/java/org/apache/fop/render/pdf/PDFRenderer.java b/src/java/org/apache/fop/render/pdf/PDFRenderer.java index 340617580..13d1edb1a 100644 --- a/src/java/org/apache/fop/render/pdf/PDFRenderer.java +++ b/src/java/org/apache/fop/render/pdf/PDFRenderer.java @@ -47,7 +47,7 @@ import org.apache.fop.area.PageViewport; import org.apache.fop.area.RegionViewport; import org.apache.fop.area.Trait; import org.apache.fop.area.OffDocumentItem; -import org.apache.fop.area.extensions.BookmarkData; +import org.apache.fop.area.BookmarkData; import org.apache.fop.area.inline.Character; import org.apache.fop.area.inline.TextArea; import org.apache.fop.area.inline.Viewport; |