xmlgraphics-fop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From adelme...@apache.org
Subject svn commit: r554091 - in /xmlgraphics/fop/trunk/src/java/org/apache/fop: apps/FOUserAgent.java fo/FOTreeBuilder.java
Date Fri, 06 Jul 2007 23:44:58 GMT
Author: adelmelle
Date: Fri Jul  6 16:44:57 2007
New Revision: 554091

URL: http://svn.apache.org/viewvc?view=rev&rev=554091
Log:
Tweak: allow control over usage of Locators

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

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/apps/FOUserAgent.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/apps/FOUserAgent.java?view=diff&rev=554091&r1=554090&r2=554091
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/apps/FOUserAgent.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/apps/FOUserAgent.java Fri Jul  6 16:44:57
2007
@@ -86,6 +86,7 @@
     private File outputFile = null;
     private Renderer rendererOverride = null;
     private FOEventHandler foEventHandlerOverride = null;
+    private boolean locatorEnabled = true; // true by default (for error messages).
     
     /** Producer:  Metadata element for the system/software that produces
      * the document. (Some renderers can store this in the document.)
@@ -517,5 +518,25 @@
     public XMLHandlerRegistry getXMLHandlerRegistry() {
         return getFactory().getXMLHandlerRegistry();
     }
+    
+    /**
+     * Controls the use of SAXLocators to provide location information in error
+     * messages.
+     * 
+     * @param enableLocator <code>false</code> if SAX Locators should be disabled
+     * @return true if context information should be stored on each node in the FO tree.
+     */
+    public void setLocatorEnabled(boolean enableLocator) {
+        locatorEnabled = enableLocator;
+    }
+
+    /**
+     * Checks if the use of Locators is enabled
+     * @return true if context information should be stored on each node in the FO tree.
+     */
+    public boolean isLocatorEnabled() {
+        return locatorEnabled;
+    }
+
 }
 

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?view=diff&rev=554091&r1=554090&r2=554091
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/FOTreeBuilder.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/FOTreeBuilder.java Fri Jul  6 16:44:57
2007
@@ -110,11 +110,10 @@
      * 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() {
-        //TODO make this configurable through the FOUserAgent so people can optimize memory
-        //consumption.
-        return false;
+        return !userAgent.isLocatorEnabled();
     }
     
     /**
@@ -127,7 +126,7 @@
     
     /** @return a Locator instance if it is available and not disabled */
     protected Locator getEffectiveLocator() {
-        return (isLocatorDisabled() ? null : this.locator);
+        return (userAgent.isLocatorEnabled() ? this.locator : null);
     }
     
     /**



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


Mime
View raw message