diff options
author | Glen Mazza <gmazza@apache.org> | 2003-07-12 21:22:04 +0000 |
---|---|---|
committer | Glen Mazza <gmazza@apache.org> | 2003-07-12 21:22:04 +0000 |
commit | 0e6c2209be64649074f003d33d049c2420664248 (patch) | |
tree | cd969e91e5af4877ecb9a17c684b15ee84e3726c /src/java/org/apache/fop/svg | |
parent | e22802340b91f6c6eb2b9f81d168d59a3ae1c01c (diff) | |
download | xmlgraphics-fop-0e6c2209be64649074f003d33d049c2420664248.tar.gz xmlgraphics-fop-0e6c2209be64649074f003d33d049c2420664248.zip |
Reconfigured ElementMapping from an interface to an abstract base class
Removed FOTreeBuilder references from all ElementMapping subclasses
Simplified FOTreeBuilder ElementMapping instantiation somewhat
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@196687 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/svg')
-rw-r--r-- | src/java/org/apache/fop/svg/SVGElementMapping.java | 38 |
1 files changed, 14 insertions, 24 deletions
diff --git a/src/java/org/apache/fop/svg/SVGElementMapping.java b/src/java/org/apache/fop/svg/SVGElementMapping.java index dd6296cd5..36135c17d 100644 --- a/src/java/org/apache/fop/svg/SVGElementMapping.java +++ b/src/java/org/apache/fop/svg/SVGElementMapping.java @@ -53,7 +53,6 @@ package org.apache.fop.svg; import java.util.HashMap; import org.apache.fop.fo.FONode; -import org.apache.fop.fo.FOTreeBuilder; import org.apache.fop.fo.ElementMapping; import org.apache.fop.apps.Driver; @@ -65,34 +64,25 @@ import org.apache.batik.dom.svg.SVGDOMImplementation; * This adds the svg element mappings used to create the objects * that create the SVG Document. */ -public class SVGElementMapping implements ElementMapping { - private static HashMap foObjs = null; - private static boolean batik = true; +public class SVGElementMapping extends ElementMapping { + private boolean batik = true; - private static synchronized void setupSVG() { - if (foObjs == null) { + public SVGElementMapping() { + URI = SVGDOMImplementation.SVG_NAMESPACE_URI; + } + + protected void initialize() { + if (foObjs == null && batik == true) { // this sets the parser that will be used // by default (SVGBrokenLinkProvider) // normally the user agent value is used - XMLResourceDescriptor.setXMLParserClassName( - Driver.getParserClassName()); - - foObjs = new HashMap(); - foObjs.put("svg", new SE()); - foObjs.put(DEFAULT, new SVGMaker()); - } - } - - /** - * Add the SVG element mappings to the tree builder. - * @param builder the FOTreeBuilder to add the mappings to - */ - public void addToBuilder(FOTreeBuilder builder) { - if (batik) { try { - setupSVG(); - String svgNS = SVGDOMImplementation.SVG_NAMESPACE_URI; - builder.addMapping(svgNS, foObjs); + XMLResourceDescriptor.setXMLParserClassName( + Driver.getParserClassName()); + + foObjs = new HashMap(); + foObjs.put("svg", new SE()); + foObjs.put(DEFAULT, new SVGMaker()); } catch (Throwable t) { // if the classes are not available // the DISPLAY is not checked |