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 ad...@apache.org on 2008/02/28 22:29:05 UTC

svn commit: r632121 - /xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/FOTreeBuilder.java

Author: adelmelle
Date: Thu Feb 28 13:29:04 2008
New Revision: 632121

URL: http://svn.apache.org/viewvc?rev=632121&view=rev
Log:
Minor tweaks/updates:
- change toString() to getLocalizedMessage() for exceptions passed to warning()
- removed deprecated method isLocatorDisabled()
- removed superfluous try-catch block
- some javadoc changes

Modified:
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/FOTreeBuilder.java

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/FOTreeBuilder.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/FOTreeBuilder.java?rev=632121&r1=632120&r2=632121&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/FOTreeBuilder.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/FOTreeBuilder.java Thu Feb 28 13:29:04 2008
@@ -57,9 +57,7 @@
     /** The registry for ElementMapping instances */
     protected ElementMappingRegistry elementMappingRegistry;
 
-    /**
-     * The root of the formatting object tree
-     */
+    /** The root of the formatting object tree */
     protected Root rootFObj = null;
 
     /** Main DefaultHandler that handles the FO namespace. */
@@ -68,10 +66,7 @@
     /** Current delegate ContentHandler to receive the SAX events */
     protected ContentHandler delegate;
     
-    /**
-     * The class that handles formatting and rendering to a stream
-     * (mark-fop@inomial.com)
-     */
+    /** The object that handles formatting and rendering to a stream */
     private FOEventHandler foEventHandler;
 
     /** The SAX locator object managing the line and column counters */
@@ -86,14 +81,18 @@
     private int depth;
     
     /**
-     * FOTreeBuilder constructor
+     * <code>FOTreeBuilder</code> constructor
+     * 
      * @param outputFormat the MIME type of the output format to use (ex. "application/pdf").
-     * @param foUserAgent in effect for this process
-     * @param stream OutputStream to direct results
-     * @throws FOPException if the FOTreeBuilder cannot be properly created
-     */
-    public FOTreeBuilder(String outputFormat, FOUserAgent foUserAgent, 
-        OutputStream stream) throws FOPException {
+     * @param foUserAgent   the {@link FOUserAgent} in effect for this process
+     * @param stream    the <code>OutputStream</code> to direct the results to
+     * @throws FOPException if the <code>FOTreeBuilder</code> cannot be properly created
+     */
+    public FOTreeBuilder(
+                String outputFormat, 
+                FOUserAgent foUserAgent,
+                OutputStream stream) 
+            throws FOPException {
 
         this.userAgent = foUserAgent;
         this.elementMappingRegistry = userAgent.getFactory().getElementMappingRegistry();        
@@ -108,40 +107,25 @@
         });
     }
 
-    /**
-     * This method enables to reduce memory consumption of the FO tree slightly. When it returns
-     * true no Locator is passed to the FO tree nodes which would copy the information into
-     * a SAX LocatorImpl instance.
-     * @return true if no context information should be stored on each node in the FO tree.
-     * @deprecated Use FOUserAgent.isLocatorEnabled() instead.
-     */
-    protected boolean isLocatorDisabled() {
-        return !userAgent.isLocatorEnabled();
-    }
-    
-    /**
-     * {@inheritDoc}
-     */
+    /** {@inheritDoc} */
     public void setDocumentLocator(Locator locator) {
         this.locator = locator;
     }
     
-    /** @return a Locator instance if it is available and not disabled */
+    /** 
+     * @return a {@link Locator} instance if it is available and not disabled
+     */
     protected Locator getEffectiveLocator() {
         return (userAgent.isLocatorEnabled() ? this.locator : null);
     }
     
-    /**
-     * {@inheritDoc} 
-     */
+    /** {@inheritDoc} */
     public void characters(char[] data, int start, int length) 
                 throws SAXException {
         delegate.characters(data, start, length);
     }
 
-    /**
-     * {@inheritDoc}
-     */
+    /** {@inheritDoc} */
     public void startDocument() throws SAXException {
         if (used) {
             throw new IllegalStateException("FOTreeBuilder (and the Fop class) cannot be reused."
@@ -159,9 +143,7 @@
         this.delegate = this.mainFOHandler;
     }
 
-    /**
-     * {@inheritDoc}
-     */
+    /** {@inheritDoc} */
     public void endDocument() throws SAXException {
         this.delegate.endDocument();
         if (this.rootFObj == null && empty) {
@@ -179,18 +161,14 @@
         imageFactory.removeContext(this.userAgent);
     }
 
-    /**
-     * {@inheritDoc} 
-     */
+    /** {@inheritDoc} */
     public void startElement(String namespaceURI, String localName, String rawName,
                              Attributes attlist) throws SAXException {
         this.depth++;
         delegate.startElement(namespaceURI, localName, rawName, attlist);
     }
 
-    /**
-     * {@inheritDoc} 
-     */
+    /** {@inheritDoc} */
     public void endElement(String uri, String localName, String rawName)
                 throws SAXException {
         this.delegate.endElement(uri, localName, rawName);
@@ -206,7 +184,8 @@
     }
 
     /**
-     * Finds the Maker used to create node objects of a particular type
+     * Finds the {@link Maker} used to create {@link FONode} objects of a particular type
+     * 
      * @param namespaceURI URI for the namespace of the element
      * @param localName name of the Element
      * @return the ElementMapping.Maker that can create an FO object for this element
@@ -218,7 +197,7 @@
 
     /** {@inheritDoc} */
     public void warning(SAXParseException e) {
-        log.warn(e.toString());
+        log.warn(e.getLocalizedMessage());
     }
 
     /** {@inheritDoc} */
@@ -233,7 +212,8 @@
     }
 
     /**
-     * Provides access to the underlying FOEventHandler object.
+     * Provides access to the underlying {@link FOEventHandler} object.
+     * 
      * @return the FOEventHandler object
      */
     public FOEventHandler getEventHandler() {
@@ -244,6 +224,7 @@
      * Returns the results of the rendering process. Information includes
      * the total number of pages generated and the number of pages per
      * page-sequence.
+     * 
      * @return the results of the rendering process.
      */
     public FormattingResults getResults() {
@@ -257,23 +238,17 @@
     }
     
     /**
-     * Main DefaultHandler implementation which builds the FO tree.
+     * Main <code>DefaultHandler</code> implementation which builds the FO tree.
      */
     private class MainFOHandler extends DefaultHandler {
         
-        /**
-         * Current formatting object being handled
-         */
+        /** Current formatting object being handled */
         protected FONode currentFObj = null;
 
-        /**
-         * Current propertyList for the node being handled.
-         */
+        /** Current propertyList for the node being handled */
         protected PropertyList currentPropertyList;
         
-        /**
-         * Current marker nesting-depth
-         */
+        /** Current marker nesting-depth */
         private int nestedMarkerDepth = 0;
 
         /** {@inheritDoc} */
@@ -298,11 +273,7 @@
             } else { // check that incoming node is valid for currentFObj
                 if (namespaceURI.equals(FOElementMapping.URI)
                     || namespaceURI.equals(ExtensionElementMapping.URI)) {
-                    try {
-                        currentFObj.validateChildNode(locator, namespaceURI, localName);
-                    } catch (ValidationException e) {
-                        throw e;
-                    }
+                    currentFObj.validateChildNode(locator, namespaceURI, localName);
                 }
             }
             
@@ -391,12 +362,11 @@
             if (currentFObj.getParent() == null) {
                 log.debug("endElement for top-level " + currentFObj.getName());
             }
+            
             currentFObj = currentFObj.getParent();
         }
 
-        /**
-         * {@inheritDoc} 
-         */
+        /** {@inheritDoc} */
         public void characters(char[] data, int start, int length) 
             throws FOPException {
             if (currentFObj != null) {
@@ -405,6 +375,7 @@
             }
         }
 
+        /** {@inheritDoc} */
         public void endDocument() throws SAXException {
             currentFObj = null;
         }        



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