diff options
author | Vincent Hennebert <vhennebert@apache.org> | 2009-10-21 15:02:24 +0000 |
---|---|---|
committer | Vincent Hennebert <vhennebert@apache.org> | 2009-10-21 15:02:24 +0000 |
commit | ac5f083758e5f884c854cc886404aac823545e1b (patch) | |
tree | 9723e855a739240eca4ea1aef13414fc08f665ce /src/java | |
parent | 2a54372f5d918492115fa3e00285af19d6f67055 (diff) | |
download | xmlgraphics-fop-ac5f083758e5f884c854cc886404aac823545e1b.tar.gz xmlgraphics-fop-ac5f083758e5f884c854cc886404aac823545e1b.zip |
Simplified the handling of the accessibility option and made it consistent with other options
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_Accessibility@828039 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java')
-rw-r--r-- | src/java/org/apache/fop/apps/FOUserAgent.java | 17 | ||||
-rw-r--r-- | src/java/org/apache/fop/apps/FopFactory.java | 12 |
2 files changed, 20 insertions, 9 deletions
diff --git a/src/java/org/apache/fop/apps/FOUserAgent.java b/src/java/org/apache/fop/apps/FOUserAgent.java index 0ed5151e0..11de99e33 100644 --- a/src/java/org/apache/fop/apps/FOUserAgent.java +++ b/src/java/org/apache/fop/apps/FOUserAgent.java @@ -156,9 +156,7 @@ public class FOUserAgent { this.factory = factory; setBaseURL(factory.getBaseURL()); setTargetResolution(factory.getTargetResolution()); - if (this.getRendererOptions().get(AccessibilityUtil.ACCESSIBILITY) == null) { - this.rendererOptions.put(AccessibilityUtil.ACCESSIBILITY, Boolean.FALSE); - } + setAccessibility(factory.isAccessibilityEnabled()); } /** @return the associated FopFactory instance */ @@ -360,7 +358,7 @@ public class FOUserAgent { getFactory().getFontManager().setFontBaseURL(fontBaseUrl); } catch (MalformedURLException e) { throw new IllegalArgumentException(e.getMessage()); - } + } } /** @@ -651,6 +649,17 @@ public class FOUserAgent { } /** + * Activates accessibility (for output formats that support it). + * + * @param accessibility <code>true</code> to enable accessibility support + */ + public void setAccessibility(boolean accessibility) { + if (accessibility) { + getRendererOptions().put(AccessibilityUtil.ACCESSIBILITY, Boolean.TRUE); + } + } + + /** * Check if accessibility is enabled. * @return true if accessibility is enabled */ diff --git a/src/java/org/apache/fop/apps/FopFactory.java b/src/java/org/apache/fop/apps/FopFactory.java index 6693f33c4..907895c99 100644 --- a/src/java/org/apache/fop/apps/FopFactory.java +++ b/src/java/org/apache/fop/apps/FopFactory.java @@ -41,7 +41,6 @@ import org.apache.commons.logging.LogFactory; import org.apache.xmlgraphics.image.loader.ImageContext; import org.apache.xmlgraphics.image.loader.ImageManager; -import org.apache.fop.accessibility.AccessibilityUtil; import org.apache.fop.fo.ElementMapping; import org.apache.fop.fo.ElementMappingRegistry; import org.apache.fop.fonts.FontCache; @@ -187,19 +186,22 @@ public class FopFactory implements ImageContext { */ public FOUserAgent newFOUserAgent() { FOUserAgent userAgent = new FOUserAgent(this); - userAgent.getRendererOptions().put(AccessibilityUtil.ACCESSIBILITY, - Boolean.valueOf(this.accessibility)); return userAgent; } /** - * Used for accessibility to pass value to newFOUserAgent - * @param value set through xconf file + * Sets accessibility support. + * + * @param value <code>true</code> to enable accessibility, <code>false</code> otherwise */ void setAccessibility(boolean value) { this.accessibility = value; } + boolean isAccessibilityEnabled() { + return accessibility; + } + /** * Returns a new {@link Fop} instance. FOP will be configured with a default user agent * instance. |