You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by je...@apache.org on 2008/08/13 09:13:53 UTC

svn commit: r685472 - in /xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src: java/org/apache/fop/render/intermediate/ java/org/apache/fop/render/pdf/ sandbox/org/apache/fop/render/svg/

Author: jeremias
Date: Wed Aug 13 00:13:52 2008
New Revision: 685472

URL: http://svn.apache.org/viewvc?rev=685472&view=rev
Log:
Added document-trailer element to the IF (for example for the bookmark tree).

Modified:
    xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/intermediate/AbstractIFPainter.java
    xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/intermediate/IFConstants.java
    xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/intermediate/IFPainter.java
    xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/intermediate/IFParser.java
    xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/intermediate/IFRenderer.java
    xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/intermediate/IFSerializer.java
    xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/pdf/PDFPainter.java
    xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/sandbox/org/apache/fop/render/svg/SVGPainter.java

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/intermediate/AbstractIFPainter.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/intermediate/AbstractIFPainter.java?rev=685472&r1=685471&r2=685472&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/intermediate/AbstractIFPainter.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/intermediate/AbstractIFPainter.java Wed Aug 13 00:13:52 2008
@@ -83,6 +83,46 @@
         return this.userAgent;
     }
 
+    /** {@inheritDoc} */
+    public void startDocumentHeader() throws IFException {
+        //nop
+    }
+
+    /** {@inheritDoc} */
+    public void endDocumentHeader() throws IFException {
+        //nop
+    }
+
+    /** {@inheritDoc} */
+    public void startDocumentTrailer() throws IFException {
+        //nop
+    }
+
+    /** {@inheritDoc} */
+    public void endDocumentTrailer() throws IFException {
+        //nop
+    }
+
+    /** {@inheritDoc} */
+    public void startPageHeader() throws IFException {
+        //nop
+    }
+
+    /** {@inheritDoc} */
+    public void endPageHeader() throws IFException {
+        //nop
+    }
+
+    /** {@inheritDoc} */
+    public void startPageTrailer() throws IFException {
+        //nop
+    }
+
+    /** {@inheritDoc} */
+    public void endPageTrailer() throws IFException {
+        //nop
+    }
+
     private AffineTransform combine(AffineTransform[] transforms) {
         AffineTransform at = new AffineTransform();
         for (int i = 0, c = transforms.length; i < c; i++) {

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/intermediate/IFConstants.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/intermediate/IFConstants.java?rev=685472&r1=685471&r2=685472&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/intermediate/IFConstants.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/intermediate/IFConstants.java Wed Aug 13 00:13:52 2008
@@ -35,6 +35,7 @@
 
     String EL_DOCUMENT = "document";
     String EL_HEADER = "header";
+    String EL_TRAILER = "trailer";
     String EL_PAGE_SEQUENCE = "page-sequence";
     String EL_PAGE = "page";
     String EL_PAGE_HEADER = "page-header";

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/intermediate/IFPainter.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/intermediate/IFPainter.java?rev=685472&r1=685471&r2=685472&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/intermediate/IFPainter.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/intermediate/IFPainter.java Wed Aug 13 00:13:52 2008
@@ -60,6 +60,9 @@
  *     ]*
  *   endPageSequence()
  *   ]*
+ *   startDocumentTrailer()
+ *   [handleExtension()]*
+ *   endDocumentTrailer()
  * endDocument()
  *
  * #box:
@@ -149,6 +152,23 @@
     void endDocumentHeader() throws IFException;
 
     /**
+     * Indicates the start of the document trailer. This method is called after the last
+     * page sequence. Extensions sent to the painter between
+     * {@code #startDocumentTrailer()} and {@code #endDocumentTrailer()} apply to the document as
+     * a whole and is used for document-level content that is only known after all pages have
+     * been rendered (like named destinations or the bookmark tree).
+     * @throws IFException if an error occurs while handling this event
+     */
+    void startDocumentTrailer() throws IFException;
+
+    /**
+     * Indicates the end of the document trailer. This method is called right before the
+     * {@code #endDocument()} method.
+     * @throws IFException if an error occurs while handling this event
+     */
+    void endDocumentTrailer() throws IFException;
+
+    /**
      * Indicates the start of a new page sequence.
      * @param id the page sequence's identifier (or null if none is available)
      * @throws IFException if an error occurs while handling this event

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/intermediate/IFParser.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/intermediate/IFParser.java?rev=685472&r1=685471&r2=685472&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/intermediate/IFParser.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/intermediate/IFParser.java Wed Aug 13 00:13:52 2008
@@ -124,6 +124,7 @@
             this.elementMappingRegistry = elementMappingRegistry;
             elementHandlers.put(EL_DOCUMENT, new DocumentHandler());
             elementHandlers.put(EL_HEADER, new DocumentHeaderHandler());
+            elementHandlers.put(EL_TRAILER, new DocumentTrailerHandler());
             elementHandlers.put(EL_PAGE_SEQUENCE, new PageSequenceHandler());
             elementHandlers.put(EL_PAGE, new PageHandler());
             elementHandlers.put(EL_PAGE_HEADER, new PageHeaderHandler());
@@ -293,6 +294,18 @@
 
         }
 
+        private class DocumentTrailerHandler extends AbstractElementHandler {
+
+            public void startElement(Attributes attributes) throws IFException {
+                painter.startDocumentTrailer();
+            }
+
+            public void endElement() throws IFException {
+                painter.endDocumentTrailer();
+            }
+
+        }
+
         private class PageSequenceHandler extends AbstractElementHandler {
 
             public void startElement(Attributes attributes) throws IFException {

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/intermediate/IFRenderer.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/intermediate/IFRenderer.java?rev=685472&r1=685471&r2=685472&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/intermediate/IFRenderer.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/intermediate/IFRenderer.java Wed Aug 13 00:13:52 2008
@@ -232,10 +232,12 @@
                 painter.endPageSequence();
                 this.inPageSequence = false;
             }
+            painter.startDocumentTrailer();
             finishOpenGoTos();
             if (this.bookmarkTree != null) {
                 painter.handleExtensionObject(this.bookmarkTree);
             }
+            painter.endDocumentTrailer();
             painter.endDocument();
         } catch (IFException e) {
             handleIFExceptionWithIOException(e);

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/intermediate/IFSerializer.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/intermediate/IFSerializer.java?rev=685472&r1=685471&r2=685472&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/intermediate/IFSerializer.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/intermediate/IFSerializer.java Wed Aug 13 00:13:52 2008
@@ -99,6 +99,24 @@
     }
 
     /** {@inheritDoc} */
+    public void startDocumentTrailer() throws IFException {
+        try {
+            startElement(EL_TRAILER);
+        } catch (SAXException e) {
+            throw new IFException("SAX error in startDocumentTrailer()", e);
+        }
+    }
+
+    /** {@inheritDoc} */
+    public void endDocumentTrailer() throws IFException {
+        try {
+            endElement(EL_TRAILER);
+        } catch (SAXException e) {
+            throw new IFException("SAX error in startDocumentTrailer()", e);
+        }
+    }
+
+    /** {@inheritDoc} */
     public void endDocument() throws IFException {
         try {
             endElement(EL_DOCUMENT);

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/pdf/PDFPainter.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/pdf/PDFPainter.java?rev=685472&r1=685471&r2=685472&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/pdf/PDFPainter.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/pdf/PDFPainter.java Wed Aug 13 00:13:52 2008
@@ -147,10 +147,6 @@
     }
 
     /** {@inheritDoc} */
-    public void startDocumentHeader() throws IFException {
-    }
-
-    /** {@inheritDoc} */
     public void endDocumentHeader() throws IFException {
         pdfUtil.generateDefaultXMPMetadata();
     }
@@ -208,14 +204,6 @@
     }
 
     /** {@inheritDoc} */
-    public void startPageHeader() throws IFException {
-    }
-
-    /** {@inheritDoc} */
-    public void endPageHeader() throws IFException {
-    }
-
-    /** {@inheritDoc} */
     public void startPageContent() throws IFException {
         this.state = IFState.create();
     }
@@ -226,14 +214,6 @@
     }
 
     /** {@inheritDoc} */
-    public void startPageTrailer() throws IFException {
-    }
-
-    /** {@inheritDoc} */
-    public void endPageTrailer() throws IFException {
-    }
-
-    /** {@inheritDoc} */
     public void endPage() throws IFException {
         try {
             this.pdfDoc.registerObject(generator.getStream());

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/sandbox/org/apache/fop/render/svg/SVGPainter.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/sandbox/org/apache/fop/render/svg/SVGPainter.java?rev=685472&r1=685471&r2=685472&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/sandbox/org/apache/fop/render/svg/SVGPainter.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/sandbox/org/apache/fop/render/svg/SVGPainter.java Wed Aug 13 00:13:52 2008
@@ -117,6 +117,7 @@
 
     /** {@inheritDoc} */
     public void endDocument() throws IFException {
+        //nop
     }
 
     /** {@inheritDoc} */
@@ -219,14 +220,6 @@
     }
 
     /** {@inheritDoc} */
-    public void startPageHeader() throws IFException {
-    }
-
-    /** {@inheritDoc} */
-    public void endPageHeader() throws IFException {
-    }
-
-    /** {@inheritDoc} */
     public void startPageContent() throws IFException {
         super.startPageContent();
         try {
@@ -247,14 +240,6 @@
     }
 
     /** {@inheritDoc} */
-    public void startPageTrailer() throws IFException {
-    }
-
-    /** {@inheritDoc} */
-    public void endPageTrailer() throws IFException {
-    }
-
-    /** {@inheritDoc} */
     public void endPage() throws IFException {
         try {
             endElement("svg");



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org