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 ac...@apache.org on 2008/07/09 17:58:32 UTC

svn commit: r675239 - in /xmlgraphics/fop/branches/Temp_AFPGOCAResources: ./ src/documentation/content/xdocs/ src/java/org/apache/fop/fo/flow/table/ src/java/org/apache/fop/layoutmgr/ src/java/org/apache/fop/render/ps/ src/java/org/apache/fop/render/xm...

Author: acumiskey
Date: Wed Jul  9 08:58:32 2008
New Revision: 675239

URL: http://svn.apache.org/viewvc?rev=675239&view=rev
Log:
Merged revisions 674484,674486-674487,674489,674540,674561,674564,674599,674602,675231 via svnmerge from 
https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk

........
  r674484 | acumiskey | 2008-07-07 14:28:26 +0100 (Mon, 07 Jul 2008) | 1 line
  
  Added new AbstractXMLRenderer base class.
........
  r674486 | acumiskey | 2008-07-07 14:43:19 +0100 (Mon, 07 Jul 2008) | 1 line
  
  Cleaned up some javadocs.
........
  r674487 | acumiskey | 2008-07-07 14:44:14 +0100 (Mon, 07 Jul 2008) | 2 lines
  
  Refactored this class, moving much of its behaviour to  the base AbstractXMLRenderer class.
........
  r674489 | lfurini | 2008-07-07 14:52:36 +0100 (Mon, 07 Jul 2008) | 1 line
  
  Fixing absolute positioning of block-containers: bottom and right distances were not taken into account
........
  r674540 | adelmelle | 2008-07-07 17:24:54 +0100 (Mon, 07 Jul 2008) | 1 line
  
  Correct indentation
........
  r674561 | adelmelle | 2008-07-07 18:31:12 +0100 (Mon, 07 Jul 2008) | 1 line
  
  Added the change to the FONode interface committed in r670341
........
  r674564 | adelmelle | 2008-07-07 18:46:09 +0100 (Mon, 07 Jul 2008) | 1 line
  
  Fixed typo
........
  r674599 | clay | 2008-07-07 20:15:34 +0100 (Mon, 07 Jul 2008) | 1 line
  
  updated info.
........
  r674602 | clay | 2008-07-07 20:19:00 +0100 (Mon, 07 Jul 2008) | 1 line
  
  One more minor update.
........
  r675231 | acumiskey | 2008-07-09 16:34:01 +0100 (Wed, 09 Jul 2008) | 2 lines
  
  Minor javadoc cleanup.
........

Added:
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/xml/AbstractXMLRenderer.java
      - copied unchanged from r675231, xmlgraphics/fop/trunk/src/java/org/apache/fop/render/xml/AbstractXMLRenderer.java
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/test/layoutengine/standard-testcases/block-container_absolute-position_tblr.xml
      - copied unchanged from r675231, xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/block-container_absolute-position_tblr.xml
Modified:
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/   (props changed)
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/documentation/content/xdocs/team.xml
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/table/TableFObj.java
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/ps/PSRenderer.java
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/xml/XMLRenderer.java
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/status.xml

Propchange: xmlgraphics/fop/branches/Temp_AFPGOCAResources/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Wed Jul  9 08:58:32 2008
@@ -1 +1 @@
-/xmlgraphics/fop/trunk:1-674475
+/xmlgraphics/fop/trunk:1-675238

Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/documentation/content/xdocs/team.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/documentation/content/xdocs/team.xml?rev=675239&r1=675238&r2=675239&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/documentation/content/xdocs/team.xml (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/documentation/content/xdocs/team.xml Wed Jul  9 08:58:32 2008
@@ -54,7 +54,7 @@
           is a web/WAP/Palm developer from Laguna Beach, California, USA. A 
           recent XML/XSL-FO convert, he has been nit-picking FAQs & assorted web 
           pages since his first webmaster position @brain.com in 1996. Most 
-          important creation? His li&apos;l Jeremy was born June 18, 2002.</li>
+          important creation? He&apos;s got a couple of cool kids.</li>
         <li id="mm"><link href="mailto:manuel@apache.org">Manuel Mall</link> (MM)
           is an independant software engineer resident in Perth, Australia. Born a long time
           ago in Germany he has been involved in Software Engineering (Informatik) since the

Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/table/TableFObj.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/table/TableFObj.java?rev=675239&r1=675238&r2=675239&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/table/TableFObj.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/table/TableFObj.java Wed Jul  9 08:58:32 2008
@@ -256,19 +256,19 @@
         BorderSpecification borderSpec = new BorderSpecification(
                 getCommonBorderPaddingBackground().getBorderInfo(side), getNameId());
         switch (side) {
-            case CommonBorderPaddingBackground.BEFORE:
-                borderBefore = new ConditionalBorder(borderSpec, collapsingBorderModel);
-                break;
-            case CommonBorderPaddingBackground.AFTER:
-                borderAfter = new ConditionalBorder(borderSpec, collapsingBorderModel);
-                break;
-            case CommonBorderPaddingBackground.START:
-                borderStart = borderSpec;
-                break;
-            case CommonBorderPaddingBackground.END:
-                borderEnd = borderSpec;
-                break;
-            default: assert false;
+        case CommonBorderPaddingBackground.BEFORE:
+            borderBefore = new ConditionalBorder(borderSpec, collapsingBorderModel);
+            break;
+        case CommonBorderPaddingBackground.AFTER:
+            borderAfter = new ConditionalBorder(borderSpec, collapsingBorderModel);
+            break;
+        case CommonBorderPaddingBackground.START:
+            borderStart = borderSpec;
+            break;
+        case CommonBorderPaddingBackground.END:
+            borderEnd = borderSpec;
+            break;
+        default: assert false;
         }
     }
 }

Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java?rev=675239&r1=675238&r2=675239&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java Wed Jul  9 08:58:32 2008
@@ -694,9 +694,17 @@
         int y = 0;
         if (abProps.left.getEnum() != EN_AUTO) {
             x = abProps.left.getValue(this);
+        } else if (abProps.right.getEnum() != EN_AUTO
+                && width.getEnum() != EN_AUTO) {
+            x = getReferenceAreaIPD() 
+                - abProps.right.getValue(this) - width.getValue(this);
         }
         if (abProps.top.getEnum() != EN_AUTO) {
             y = abProps.top.getValue(this);
+        } else if (abProps.bottom.getEnum() != EN_AUTO
+                && height.getEnum() != EN_AUTO) {
+            y = getReferenceAreaBPD()
+                - abProps.bottom.getValue(this) - height.getValue(this);
         }
         return new Point(x, y);
     }
@@ -1085,3 +1093,4 @@
 
 }
 
+

Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/ps/PSRenderer.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/ps/PSRenderer.java?rev=675239&r1=675238&r2=675239&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/ps/PSRenderer.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/ps/PSRenderer.java Wed Jul  9 08:58:32 2008
@@ -734,8 +734,7 @@
         gen.useColor(col);
     }
 
-    /** {@inheritDoc}
-     * Area, float, float, float, float) */
+    /** {@inheritDoc} */
     protected void drawBackAndBorders(Area area, float startx, float starty,
             float width, float height) {
         if (area.hasTrait(Trait.BACKGROUND)
@@ -904,9 +903,7 @@
         }
     }
     
-    /**
-     * {@inheritDoc}
-     */
+    /** {@inheritDoc} */
     public void startRenderer(OutputStream outputStream)
                 throws IOException {
         log.debug("Rendering areas to PostScript...");
@@ -980,9 +977,7 @@
         gen.writeDSCComment(DSCConstants.END_SETUP);
     }
 
-    /**
-     * {@inheritDoc}
-     */
+    /** {@inheritDoc} */
     public void stopRenderer() throws IOException {
         //Notify resource usage for font which are not supplied
         /* done in useFont now
@@ -1134,9 +1129,7 @@
         }
     }
 
-    /**
-     * {@inheritDoc}
-     */
+    /** {@inheritDoc} */
     public void renderPage(PageViewport page)
             throws IOException, FOPException {
         log.debug("renderPage(): " + page);
@@ -1313,9 +1306,7 @@
         }
     }
 
-    /**
-     * {@inheritDoc}
-     */
+    /** {@inheritDoc} */
     public void renderText(TextArea area) {
         renderInlineAreaBackAndBorders(area);
         String fontkey = getInternalFontNameForArea(area);
@@ -1346,17 +1337,13 @@
         renderTextDecoration(tf, fontsize, area, bl, rx);
     }
     
-    /**
-     * {@inheritDoc}
-     */
+    /** {@inheritDoc} */
     protected void renderWord(WordArea word) {
         renderText((TextArea)word.getParentArea(), word.getWord(), word.getLetterAdjustArray());
         super.renderWord(word);
     }
 
-    /**
-     * {@inheritDoc}
-     */
+    /** {@inheritDoc} */
     protected void renderSpace(SpaceArea space) {
         AbstractTextArea textArea = (AbstractTextArea)space.getParentArea();
         String s = space.getSpace();

Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/xml/XMLRenderer.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/xml/XMLRenderer.java?rev=675239&r1=675238&r2=675239&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/xml/XMLRenderer.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/xml/XMLRenderer.java Wed Jul  9 08:58:32 2008
@@ -35,11 +35,7 @@
 
 import org.w3c.dom.Document;
 
-import org.xml.sax.Attributes;
-import org.xml.sax.ContentHandler;
 import org.xml.sax.SAXException;
-import org.xml.sax.ext.LexicalHandler;
-import org.xml.sax.helpers.AttributesImpl;
 
 import org.apache.xmlgraphics.util.QName;
 import org.apache.xmlgraphics.util.XMLizable;
@@ -99,39 +95,17 @@
  * The output can be used to build a new area tree which can be 
  * rendered to any renderer.
  */
-public class XMLRenderer extends PrintRenderer {
+public class XMLRenderer extends AbstractXMLRenderer {
 
     /** XML MIME type */
     public static final String XML_MIME_TYPE = MimeConstants.MIME_FOP_AREA_TREE;
 
-    /** Main namespace in use. */
-    public static final String NS = "";
-
-    /** CDATA type */
-    public static final String CDATA = "CDATA";
-
-    /** An empty Attributes object used when no attributes are needed. */
-    public static final Attributes EMPTY_ATTS = new AttributesImpl();
-
     private boolean startedSequence = false;
-    private RendererContext context;
     private boolean compactFormat = false;
 
     /** If not null, the XMLRenderer will mimic another renderer by using its font setup. */
     protected Renderer mimic;
 
-    /** ContentHandler that the generated XML is written to */
-    protected ContentHandler handler;
-
-    /** AttributesImpl instance that can be used during XML generation. */
-    protected AttributesImpl atts = new AttributesImpl();
-
-    /** The OutputStream to write the generated XML to. */
-    protected OutputStream out;
-
-    /** A list of ExtensionAttachements received through processOffDocumentItem() */
-    protected List extensionAttachments;
-
     /**
      * Creates a new XML renderer.
      */
@@ -171,15 +145,6 @@
         }
     }
 
-    /**
-     * Sets an outside TransformerHandler to use instead of the default one
-     * create in this class in startRenderer().
-     * @param handler Overriding TransformerHandler
-     */
-    public void setContentHandler(ContentHandler handler) {
-        this.handler = handler;
-    }
-
     public void setCompactFormat(boolean compact) {
         this.compactFormat = compact;
     }
@@ -189,111 +154,6 @@
     }
 
     /**
-     * Handles SAXExceptions.
-     * @param saxe the SAXException to handle
-     */
-    protected void handleSAXException(SAXException saxe) {
-        throw new RuntimeException(saxe.getMessage());
-    }
-
-    /**
-     * Writes a comment to the generated XML.
-     * @param comment the comment
-     */
-    protected void comment(String comment) {
-        if (handler instanceof LexicalHandler) { 
-            try {
-                ((LexicalHandler) handler).comment(comment.toCharArray(), 0, comment.length());
-            } catch (SAXException saxe) {
-                handleSAXException(saxe);
-            }
-        }
-    }
-    
-    /**
-     * Starts a new element (without attributes).
-     * @param tagName tag name of the element
-     */
-    protected void startElement(String tagName) {
-        startElement(tagName, EMPTY_ATTS);
-    }
-
-    /**
-     * Starts a new element.
-     * @param tagName tag name of the element
-     * @param atts attributes to add
-     */
-    protected void startElement(String tagName, Attributes atts) {
-        try {
-            handler.startElement(NS, tagName, tagName, atts);
-        } catch (SAXException saxe) {
-            handleSAXException(saxe);
-        }
-    }
-
-    /**
-     * Ends an element.
-     * @param tagName tag name of the element
-     */
-    protected void endElement(String tagName) {
-        try {
-            handler.endElement(NS, tagName, tagName);
-        } catch (SAXException saxe) {
-            handleSAXException(saxe);
-        }
-    }
-
-    /**
-     * Sends plain text to the XML
-     * @param text the text
-     */
-    protected void characters(String text) {
-        try {
-            char[] ca = text.toCharArray();
-            handler.characters(ca, 0, ca.length);
-        } catch (SAXException saxe) {
-            handleSAXException(saxe);
-        }
-    }
-
-    /**
-     * Adds a new attribute to the protected member variable "atts".
-     * @param name name of the attribute
-     * @param value value of the attribute
-     */
-    protected void addAttribute(String name, String value) {
-        atts.addAttribute(NS, name, name, CDATA, value);
-    }
-
-    /**
-     * Adds a new attribute to the protected member variable "atts".
-     * @param name name of the attribute
-     * @param value value of the attribute
-     */
-    protected void addAttribute(QName name, String value) {
-        atts.addAttribute(name.getNamespaceURI(), name.getLocalName(), name.getQName(), 
-                CDATA, value);
-    }
-
-    /**
-     * Adds a new attribute to the protected member variable "atts".
-     * @param name name of the attribute
-     * @param value value of the attribute
-     */
-    protected void addAttribute(String name, int value) {
-        addAttribute(name, Integer.toString(value));
-    }
-
-    /**
-     * Adds a new attribute to the protected member variable "atts".
-     * @param name name of the attribute
-     * @param rect a Rectangle2D to format and use as attribute value
-     */
-    protected void addAttribute(String name, Rectangle2D rect) {
-        addAttribute(name, createString(rect));
-    }
-
-    /**
      * Adds the general Area attributes.
      * @param area Area to extract attributes from
      */
@@ -406,18 +266,6 @@
         }
     }
 
-    private String createString(Rectangle2D rect) {
-        return "" + (int) rect.getX() + " " + (int) rect.getY() + " "
-                  + (int) rect.getWidth() + " " + (int) rect.getHeight();
-    }
-
-    private void handleDocumentExtensionAttachments() {
-        if (extensionAttachments != null && extensionAttachments.size() > 0) {
-            handleExtensionAttachments(extensionAttachments);
-            extensionAttachments.clear();
-        }
-    }
-
     /** {@inheritDoc} */
     public void processOffDocumentItem(OffDocumentItem oDI) {
         if (oDI instanceof BookmarkData) {
@@ -518,9 +366,7 @@
         startElement("areaTree");
     }
 
-    /**
-     * {@inheritDoc}
-     */
+    /** {@inheritDoc} */
     public void stopRenderer() throws IOException {
         endPageSequence();
         endElement("areaTree");
@@ -535,9 +381,7 @@
         log.debug("Written out Area Tree XML");
     }
 
-    /**
-     * {@inheritDoc}
-     */
+    /** {@inheritDoc} */
     public void renderPage(PageViewport page) throws IOException, FOPException {
         atts.clear();
         addAttribute("bounds", page.getViewArea());
@@ -561,7 +405,8 @@
         endElement("pageViewport");
     }
 
-    private void handleExtensionAttachments(List attachments) {
+    /** {@inheritDoc} */
+    protected void handleExtensionAttachments(List attachments) {
         if (attachments != null && attachments.size() > 0) {
             startElement("extension-attachments");
             Iterator i = attachments.iterator();
@@ -582,10 +427,6 @@
         }
     }
 
-    private void handlePageExtensionAttachments(PageViewport page) {
-        handleExtensionAttachments(page.getExtensionAttachments());
-    }
-
     /** {@inheritDoc} */
     public void startPageSequence(PageSequence pageSequence) {
         handleDocumentExtensionAttachments();

Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/status.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/status.xml?rev=675239&r1=675238&r2=675239&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/status.xml (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/status.xml Wed Jul  9 08:58:32 2008
@@ -53,6 +53,10 @@
   
   <changes>
     <release version="FOP Trunk" date="TBD">
+      <action context="Layout" dev="LF" type="fix">
+        Fixed absolute positioning of block-containers when specified
+        using right and bottom instead of left and top.
+      </action>
       <action context="Renderers" dev="AC" type="add">
         Added PDF encryption parameter support in configuration.
       </action>
@@ -65,6 +69,13 @@
         empty areas in pages whose last normal line contains footnotes
         when the page bpd is not the same for all pages.
       </action>
+      <action context="Code" dev="AD" type="update" importance="high">
+        Changed FONode.addCharacters() parameter to closer match the signature of 
+        the standard SAX characters() event (reduces confusion and computations).
+        <em>!! Implementors of extensions that subclass FONode directly, and 
+        offer an implementation for addCharacters() should take care to make 
+        similar modifications in their code !!</em>
+      </action>
       <!-- change reverted, to be added back later
       <action context="Renderers" dev="AC" importance="high" type="add">
         Added SVG support for AFP (GOCA).



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