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 ke...@apache.org on 2001/07/12 15:03:43 UTC

cvs commit: xml-fop/src/org/apache/fop/svg SVGElementMapping.java

keiron      01/07/12 06:03:42

  Modified:    src/org/apache/fop/apps Driver.java
               src/org/apache/fop/configuration Configuration.java
                        ConfigurationReader.java
               src/org/apache/fop/extensions ExtensionElementMapping.java
               src/org/apache/fop/fo ElementMapping.java
                        StandardElementMapping.java
               src/org/apache/fop/image SVGImage.java
               src/org/apache/fop/render/awt AWTRenderer.java
               src/org/apache/fop/render/pdf PDFRenderer.java
               src/org/apache/fop/render/ps PSRenderer.java
               src/org/apache/fop/svg SVGElementMapping.java
  Log:
  combined property list setting into element setting
  also always get parser class name from one place
  
  Revision  Changes    Path
  1.28      +96 -53    xml-fop/src/org/apache/fop/apps/Driver.java
  
  Index: Driver.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/apps/Driver.java,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- Driver.java	2001/07/02 10:48:01	1.27
  +++ Driver.java	2001/07/12 13:02:56	1.28
  @@ -1,4 +1,4 @@
  -/* $Id: Driver.java,v 1.27 2001/07/02 10:48:01 keiron Exp $
  +/* $Id: Driver.java,v 1.28 2001/07/12 13:02:56 keiron Exp $
    * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
  @@ -9,7 +9,6 @@
   // FOP
   import org.apache.fop.fo.FOTreeBuilder;
   import org.apache.fop.fo.ElementMapping;
  -import org.apache.fop.fo.PropertyListMapping;
   import org.apache.fop.layout.AreaTree;
   import org.apache.fop.layout.FontInfo;
   import org.apache.fop.render.Renderer;
  @@ -136,6 +135,18 @@
       /** the system resources that FOP will use    */
       private BufferManager _bufferManager;
   
  +    public static final String getParserClassName() {
  +        String parserClassName = null;
  +        try {
  +            parserClassName = System.getProperty("org.xml.sax.parser");
  +        } catch(SecurityException se) {
  +        }
  +        if (parserClassName == null) {
  +            parserClassName = "org.apache.xerces.parsers.SAXParser";
  +        }
  +        return parserClassName;
  +    }
  +
       /** create a new Driver */
       public Driver() {
           _stream = null;
  @@ -200,30 +211,24 @@
           _reader = reader;
       }
   
  -
       /**
        * Sets all the element and property list mappings to their default values.
        *
        */
       public void setupDefaultMappings() {
           addElementMapping("org.apache.fop.fo.StandardElementMapping");
  -        addPropertyList ("org.apache.fop.fo.StandardPropertyListMapping");
  -
           addElementMapping("org.apache.fop.svg.SVGElementMapping");
  -        addPropertyList ("org.apache.fop.svg.SVGPropertyListMapping");
  -
           addElementMapping("org.apache.fop.extensions.ExtensionElementMapping");
  -        addPropertyList ("org.apache.fop.extensions.ExtensionPropertyListMapping");
   
  -        // add mappings from user configuration
  -        Hashtable mappings = Configuration.getHashtableValue("mappings");
  -        if (mappings != null) {
  -            String prop = (String) mappings.get("property");
  -            String ele = (String) mappings.get("element");
  -            try {
  -                addElementMapping(ele);
  -                addPropertyList(prop);
  -            } catch (IllegalArgumentException e) {
  +        // add mappings from available services
  +        Enumeration providers = Service.providers(org.apache.fop.fo.ElementMapping.class);
  +        if (providers != null) {
  +            while(providers.hasMoreElements()) {
  +                String str = (String)providers.nextElement();
  +                try {
  +                    addElementMapping(str);
  +                } catch (IllegalArgumentException e) {
  +                }
               }
           }
       }
  @@ -271,7 +276,6 @@
   
       }
   
  -
       /**
        * Set the Renderer to use
        * @param renderer the renderer instance to use
  @@ -361,41 +365,6 @@
       }
   
       /**
  -     * Add the PropertyListMapping.
  -     */
  -    public void addPropertyList(PropertyListMapping mapping) {
  -        mapping.addToBuilder(_treeBuilder);
  -    }
  -
  -    /**
  -     * Add the PropertyListMapping with the given class name.
  -     */
  -    public void addPropertyList(String listClassName)
  -    throws IllegalArgumentException {
  -        try {
  -            PropertyListMapping mapping =
  -              (PropertyListMapping) Class.forName(
  -                listClassName).newInstance();
  -            addPropertyList(mapping);
  -
  -        } catch (ClassNotFoundException e) {
  -            throw new IllegalArgumentException("Could not find " +
  -                                               listClassName);
  -        }
  -        catch (InstantiationException e) {
  -            throw new IllegalArgumentException(
  -              "Could not instantiate " + listClassName);
  -        }
  -        catch (IllegalAccessException e) {
  -            throw new IllegalArgumentException("Could not access " +
  -                                               listClassName);
  -        }
  -        catch (ClassCastException e) {
  -            throw new IllegalArgumentException(listClassName + " is not an ElementMapping");
  -        }
  -    }
  -
  -    /**
        * Returns the tree builder (a SAX ContentHandler).
        *
        * Used in situations where SAX is used but not via a FOP-invoked
  @@ -522,5 +491,79 @@
           format();
           render();
       }
  +}
  +
  +// code stolen from org.apache.batik.util and modified slightly
  +// does what sun.misc.Service probably does, but it cannot be relied on.
  +// hopefully will be part of standard jdk sometime.
  +/**
  + * This class loads services present in the class path.
  + */
  +class Service {
  +
  +    static Hashtable providerMap = new Hashtable();
  +
  +    public static synchronized Enumeration providers(Class cls) {
  +        ClassLoader cl = cls.getClassLoader();
  +        String serviceFile = "META-INF/services/"+cls.getName();
   
  +        // System.out.println("File: " + serviceFile);
  +
  +        Vector v = (Vector)providerMap.get(serviceFile);
  +        if (v != null)
  +            return v.elements();
  +
  +        v = new Vector();
  +        providerMap.put(serviceFile, v);
  +
  +        Enumeration e;
  +        try {
  +            e = cl.getResources(serviceFile);
  +        } catch (IOException ioe) {
  +            return v.elements();
  +        }
  +
  +        while (e.hasMoreElements()) {
  +            try {
  +                java.net.URL u = (java.net.URL)e.nextElement();
  +                // System.out.println("URL: " + u);
  +
  +                InputStream    is = u.openStream();
  +                Reader         r  = new InputStreamReader(is, "UTF-8");
  +                BufferedReader br = new BufferedReader(r);
  +
  +                String line = br.readLine();
  +                while (line != null) {
  +                    try {
  +                        // First strip any comment...
  +                        int idx = line.indexOf('#');
  +                        if (idx != -1)
  +                            line = line.substring(0, idx);
  +
  +                        // Trim whitespace.
  +                        line = line.trim();
  +
  +                        // If nothing left then loop around...
  +                        if (line.length() == 0) {
  +                            line = br.readLine();
  +                            continue;
  +                        }
  +                        // System.out.println("Line: " + line);
  +
  +                        // Try and load the class
  +                        //Object obj = cl.loadClass(line).newInstance();
  +                        // stick it into our vector...
  +                        v.add(line);
  +                    } catch (Exception ex) {
  +                        // Just try the next line
  +                    }
  +                    line = br.readLine();
  +                }
  +            } catch (Exception ex) {
  +                // Just try the next file...
  +            }
  +        }
  +        return v.elements();
  +    }
   }
  +
  
  
  
  1.5       +1 -2      xml-fop/src/org/apache/fop/configuration/Configuration.java
  
  Index: Configuration.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/configuration/Configuration.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Configuration.java	2001/02/27 12:28:14	1.4
  +++ Configuration.java	2001/07/12 13:03:02	1.5
  @@ -1,9 +1,8 @@
   /* 
    * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the 
  - * LICENSE file included with these sources."
  + * LICENSE file included with these sources.
    */
  -
   
   package org.apache.fop.configuration;
   
  
  
  
  1.7       +24 -77    xml-fop/src/org/apache/fop/configuration/ConfigurationReader.java
  
  Index: ConfigurationReader.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/configuration/ConfigurationReader.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ConfigurationReader.java	2001/04/12 00:12:47	1.6
  +++ ConfigurationReader.java	2001/07/12 13:03:03	1.7
  @@ -1,52 +1,7 @@
  -/*
  -
  - ============================================================================
  -                   The Apache Software License, Version 1.1
  - ============================================================================
  -
  -    Copyright (C) 1999 The Apache Software Foundation. All rights reserved.
  -
  - Redistribution and use in source and binary forms, with or without modifica-
  - tion, are permitted provided that the following conditions are met:
  -
  - 1. Redistributions of  source code must  retain the above copyright  notice,
  -    this list of conditions and the following disclaimer.
  -
  - 2. Redistributions in binary form must reproduce the above copyright notice,
  -    this list of conditions and the following disclaimer in the documentation
  -    and/or other materials provided with the distribution.
  -
  - 3. The end-user documentation included with the redistribution, if any, must
  -    include  the following  acknowledgment:  "This product includes  software
  -    developed  by the  Apache Software Foundation  (http://www.apache.org/)."
  -    Alternately, this  acknowledgment may  appear in the software itself,  if
  -    and wherever such third-party acknowledgments normally appear.
  -
  - 4. The names "Fop" and  "Apache Software Foundation"  must not be used to
  -    endorse  or promote  products derived  from this  software without  prior
  -    written permission. For written permission, please contact
  -    apache@apache.org.
  -
  - 5. Products  derived from this software may not  be called "Apache", nor may
  -    "Apache" appear  in their name,  without prior written permission  of the
  -    Apache Software Foundation.
  -
  - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
  - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  - FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
  - APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
  - INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
  - DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
  - OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
  - ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
  - (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
  - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  -
  - This software  consists of voluntary contributions made  by many individuals
  - on  behalf of the Apache Software  Foundation and was  originally created by
  - James Tauber <jt...@jtauber.com>. For more  information on the Apache
  - Software Foundation, please see <http://www.apache.org/>.
  -
  +/* $Id: ConfigurationReader.java,v 1.7 2001/07/12 13:03:03 keiron Exp $
  + * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
  + * For details on use and redistribution please refer to the
  + * LICENSE file included with these sources.
    */
   
   package org.apache.fop.configuration;
  @@ -59,6 +14,7 @@
   import org.xml.sax.InputSource;
   
   //fop
  +import org.apache.fop.apps.Driver;
   import org.apache.fop.messaging.MessageHandler;
   import org.apache.fop.apps.FOPException;
   import org.apache.fop.configuration.Configuration;
  @@ -77,7 +33,6 @@
    *  Once the configuration has been setup, the information can be accessed with
    *  the methods of StandardConfiguration.
    */
  -
   public class ConfigurationReader {
       /** show a full dump on error */
       private static boolean errorDump = false;
  @@ -94,10 +49,9 @@
           this.filename = filename;
       }
   
  -
       /**
  -      * intantiates parser and starts parsing of config file
  -      */
  +     * intantiates parser and starts parsing of config file
  +     */
       public void start () throws FOPException {
           XMLReader parser = createParser();
   
  @@ -106,7 +60,7 @@
               parser.setFeature("http://xml.org/sax/features/namespace-prefixes",
                                 false);
           } catch (SAXException e) {
  -	    throw new FOPException("You need a parser which supports SAX version 2",e);
  +            throw new FOPException("You need a parser which supports SAX version 2",e);
           }
           ConfigurationParser configurationParser = new ConfigurationParser();
           parser.setContentHandler(configurationParser);
  @@ -125,20 +79,14 @@
           }
       }
   
  -
       /**
  -       * creates a SAX parser, using the value of org.xml.sax.parser
  -       * defaulting to org.apache.xerces.parsers.SAXParser
  -       *
  -       * @return the created SAX parser
  -       */
  -    public static XMLReader createParser()
  -	throws FOPException
  -    {
  -        String parserClassName = System.getProperty("org.xml.sax.parser");
  -        if (parserClassName == null) {
  -            parserClassName = "org.apache.xerces.parsers.SAXParser";
  -        }
  +     * creates a SAX parser, using the value of org.xml.sax.parser
  +     * defaulting to org.apache.xerces.parsers.SAXParser
  +     *
  +     * @return the created SAX parser
  +     */
  +    public static XMLReader createParser() throws FOPException {
  +        String parserClassName = Driver.getParserClassName();
           if (errorDump) {
               MessageHandler.logln( "configuration reader using SAX parser " +
                                     parserClassName);
  @@ -148,14 +96,15 @@
               return (XMLReader) Class.forName(
                        parserClassName).newInstance();
           } catch (ClassNotFoundException e) {
  -	    throw new FOPException("Could not find " + parserClassName,e);
  +            throw new FOPException("Could not find " + parserClassName, e);
           }
           catch (InstantiationException e) {
               throw new FOPException("Could not instantiate " +
  -                                   parserClassName,e);
  +                                   parserClassName, e);
           }
           catch (IllegalAccessException e) {
  -            throw new FOPException("Could not access " + parserClassName,e);
  +            throw new FOPException("Could not access " +
  +                                   parserClassName, e);
           }
           catch (ClassCastException e) {
               throw new FOPException(parserClassName + " is not a SAX driver",e);
  @@ -163,8 +112,8 @@
       }
   
       /**
  -       * Dumps an error
  -       */
  +     * Dumps an error
  +     */
       public void dumpError(Exception e) {
           if (errorDump) {
               if (e instanceof SAXException) {
  @@ -177,14 +126,12 @@
               }
           }
       }
  -    
   
       /**
  -      *  long or short error messages
  -      *
  -      */
  +     *  long or short error messages
  +     *
  +     */
       public void setDumpError(boolean dumpError) {
           errorDump = dumpError;
       }
  -
   }
  
  
  
  1.2       +23 -51    xml-fop/src/org/apache/fop/extensions/ExtensionElementMapping.java
  
  Index: ExtensionElementMapping.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/extensions/ExtensionElementMapping.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ExtensionElementMapping.java	2001/02/06 07:34:47	1.1
  +++ ExtensionElementMapping.java	2001/07/12 13:03:08	1.2
  @@ -1,64 +1,36 @@
  -/*-- $Id: ExtensionElementMapping.java,v 1.1 2001/02/06 07:34:47 kellyc Exp $ --
  -
  - ============================================================================
  -                   The Apache Software License, Version 1.1
  - ============================================================================
  -
  -    Copyright (C) 1999 The Apache Software Foundation. All rights reserved.
  -
  - Redistribution and use in source and binary forms, with or without modifica-
  - tion, are permitted provided that the following conditions are met:
  -
  - 1. Redistributions of  source code must  retain the above copyright  notice,
  -    this list of conditions and the following disclaimer.
  -
  - 2. Redistributions in binary form must reproduce the above copyright notice,
  -    this list of conditions and the following disclaimer in the documentation
  -    and/or other materials provided with the distribution.
  -
  - 3. The end-user documentation included with the redistribution, if any, must
  -    include  the following  acknowledgment:  "This product includes  software
  -    developed  by the  Apache Software Foundation  (http://www.apache.org/)."
  -    Alternately, this  acknowledgment may  appear in the software itself,  if
  -    and wherever such third-party acknowledgments normally appear.
  -
  - 4. The names "FOP" and  "Apache Software Foundation"  must not be used to
  -    endorse  or promote  products derived  from this  software without  prior
  -    written permission. For written permission, please contact
  -    apache@apache.org.
  -
  - 5. Products  derived from this software may not  be called "Apache", nor may
  -    "Apache" appear  in their name,  without prior written permission  of the
  -    Apache Software Foundation.
  -
  - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
  - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  - FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
  - APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
  - INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
  - DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
  - OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
  - ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
  - (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
  - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  -
  - This software  consists of voluntary contributions made  by many individuals
  - on  behalf of the Apache Software  Foundation and was  originally created by
  - James Tauber <jt...@jtauber.com>. For more  information on the Apache
  - Software Foundation, please see <http://www.apache.org/>.
  -
  +/* $Id: ExtensionElementMapping.java,v 1.2 2001/07/12 13:03:08 keiron Exp $
  + * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
  + * For details on use and redistribution please refer to the
  + * LICENSE file included with these sources.
    */
   
   package org.apache.fop.extensions;
   
   import org.apache.fop.fo.*;
  +import org.apache.fop.fo.properties.ExtensionPropertyMapping;
  +import org.apache.fop.fo.TreeBuilder;
  +
  +import java.util.Enumeration;
  +import java.util.Hashtable;
   
   public class ExtensionElementMapping implements ElementMapping {
   
       public static final String URI = "http://xml.apache.org/fop/extensions";
   
       public void addToBuilder(TreeBuilder builder) {
  -	builder.addMapping(URI, "outline", Outline.maker());
  -	builder.addMapping(URI, "label",   Label.maker());
  +        builder.addMapping(URI, "outline", Outline.maker());
  +        builder.addMapping(URI, "label", Label.maker());
  +
  +
  +        builder.addPropertyList(ExtensionElementMapping.URI,
  +                                ExtensionPropertyMapping.getGenericMappings());
  +        /* Add any element mappings */
  +        for (Enumeration e = ExtensionPropertyMapping.getElementMappings();
  +                e.hasMoreElements();) {
  +            String elem = (String) e.nextElement();
  +            builder.addElementPropertyList(ExtensionElementMapping.URI,
  +                                           elem, ExtensionPropertyMapping.getElementMapping(
  +                                             elem));
  +        }
       }
   }
  
  
  
  1.7       +9 -50     xml-fop/src/org/apache/fop/fo/ElementMapping.java
  
  Index: ElementMapping.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/ElementMapping.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ElementMapping.java	2000/08/29 00:09:40	1.6
  +++ ElementMapping.java	2001/07/12 13:03:13	1.7
  @@ -1,56 +1,15 @@
  -/*-- $Id: ElementMapping.java,v 1.6 2000/08/29 00:09:40 keiron Exp $ -- 
  -
  - ============================================================================
  -                   The Apache Software License, Version 1.1
  - ============================================================================
  - 
  -    Copyright (C) 1999 The Apache Software Foundation. All rights reserved.
  - 
  - Redistribution and use in source and binary forms, with or without modifica-
  - tion, are permitted provided that the following conditions are met:
  - 
  - 1. Redistributions of  source code must  retain the above copyright  notice,
  -    this list of conditions and the following disclaimer.
  - 
  - 2. Redistributions in binary form must reproduce the above copyright notice,
  -    this list of conditions and the following disclaimer in the documentation
  -    and/or other materials provided with the distribution.
  - 
  - 3. The end-user documentation included with the redistribution, if any, must
  -    include  the following  acknowledgment:  "This product includes  software
  -    developed  by the  Apache Software Foundation  (http://www.apache.org/)."
  -    Alternately, this  acknowledgment may  appear in the software itself,  if
  -    and wherever such third-party acknowledgments normally appear.
  - 
  - 4. The names "Fop" and  "Apache Software Foundation"  must not be used to
  -    endorse  or promote  products derived  from this  software without  prior
  -    written permission. For written permission, please contact
  -    apache@apache.org.
  - 
  - 5. Products  derived from this software may not  be called "Apache", nor may
  -    "Apache" appear  in their name,  without prior written permission  of the
  -    Apache Software Foundation.
  - 
  - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
  - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  - FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
  - APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
  - INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
  - DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
  - OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
  - ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
  - (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
  - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  - 
  - This software  consists of voluntary contributions made  by many individuals
  - on  behalf of the Apache Software  Foundation and was  originally created by
  - James Tauber <jt...@jtauber.com>. For more  information on the Apache 
  - Software Foundation, please see <http://www.apache.org/>.
  - 
  +/*-- $Id: ElementMapping.java,v 1.7 2001/07/12 13:03:13 keiron Exp $ --
  + * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
  + * For details on use and redistribution please refer to the
  + * LICENSE file included with these sources.
    */
  +
   package org.apache.fop.fo;
   
  +/**
  + * Interface for adding supported element and property mappings to
  + * the given builder.
  + */
   public interface ElementMapping {
  -
       public void addToBuilder(TreeBuilder builder);
   }
  
  
  
  1.23      +72 -57    xml-fop/src/org/apache/fop/fo/StandardElementMapping.java
  
  Index: StandardElementMapping.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/StandardElementMapping.java,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- StandardElementMapping.java	2001/03/04 23:08:57	1.22
  +++ StandardElementMapping.java	2001/07/12 13:03:14	1.23
  @@ -1,12 +1,15 @@
  -/*-- $Id: StandardElementMapping.java,v 1.22 2001/03/04 23:08:57 arved Exp $ --
  - *
  +/*-- $Id: StandardElementMapping.java,v 1.23 2001/07/12 13:03:14 keiron Exp $ --
    * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
  - * For details on use and redistribution please refer to the 
  - * LICENSE file included with these sources."
  + * For details on use and redistribution please refer to the
  + * LICENSE file included with these sources.
    */
   
   package org.apache.fop.fo;
   
  +import java.util.Enumeration;
  +import java.util.Hashtable;
  +
  +import org.apache.fop.fo.properties.FOPropertyMapping;
   import org.apache.fop.fo.flow.*;
   import org.apache.fop.fo.pagination.*;
   
  @@ -14,60 +17,72 @@
   
       public void addToBuilder(TreeBuilder builder) {
   
  -	String uri = "http://www.w3.org/1999/XSL/Format";
  +        String uri = "http://www.w3.org/1999/XSL/Format";
   
  -	builder.addMapping(uri, "root", Root.maker());
  -	builder.addMapping(uri, "layout-master-set",
  -			   LayoutMasterSet.maker());
  -	builder.addMapping(uri, "simple-page-master",
  -			   SimplePageMaster.maker());
  -	builder.addMapping(uri, "region-body", RegionBody.maker());
  -	builder.addMapping(uri, "region-before", RegionBefore.maker());
  -	builder.addMapping(uri, "region-after", RegionAfter.maker());
  -	builder.addMapping(uri, "region-start", RegionStart.maker());
  -	builder.addMapping(uri, "region-end", RegionEnd.maker());
  -	builder.addMapping(uri, "page-sequence", PageSequence.maker());
  -	builder.addMapping(uri, "page-sequence-master",
  -			   PageSequenceMaster.maker());
  -	builder.addMapping(uri, "single-page-master-reference",
  -			   SinglePageMasterReference.maker());
  -	builder.addMapping(uri, "repeatable-page-master-reference",
  -			   RepeatablePageMasterReference.maker());
  -	builder.addMapping(uri, "conditional-page-master-reference",
  -			   ConditionalPageMasterReference.maker());
  -	builder.addMapping(uri, "repeatable-page-master-alternatives",
  -			   RepeatablePageMasterAlternatives.maker());
  -	builder.addMapping(uri, "flow", Flow.maker());
  -	builder.addMapping(uri, "static-content",
  -			   StaticContent.maker());
  -	builder.addMapping(uri, "block", Block.maker());
  -	builder.addMapping(uri, "block-container", BlockContainer.maker());
  -	builder.addMapping(uri, "list-block", ListBlock.maker());
  -	builder.addMapping(uri, "list-item", ListItem.maker());
  -	builder.addMapping(uri, "list-item-label",
  -			   ListItemLabel.maker());
  -	builder.addMapping(uri, "list-item-body", ListItemBody.maker());
  -	builder.addMapping(uri, "page-number", PageNumber.maker());
  -	builder.addMapping(uri, "page-number-citation", PageNumberCitation.maker());
  -	builder.addMapping(uri, "display-sequence",
  -			   DisplaySequence.maker());
  -	builder.addMapping(uri, "inline",
  -			   Inline.maker());
  -  builder.addMapping(uri, "external-graphic",
  +        builder.addMapping(uri, "root", Root.maker());
  +        builder.addMapping(uri, "layout-master-set",
  +                           LayoutMasterSet.maker());
  +        builder.addMapping(uri, "simple-page-master",
  +                           SimplePageMaster.maker());
  +        builder.addMapping(uri, "region-body", RegionBody.maker());
  +        builder.addMapping(uri, "region-before", RegionBefore.maker());
  +        builder.addMapping(uri, "region-after", RegionAfter.maker());
  +        builder.addMapping(uri, "region-start", RegionStart.maker());
  +        builder.addMapping(uri, "region-end", RegionEnd.maker());
  +        builder.addMapping(uri, "page-sequence", PageSequence.maker());
  +        builder.addMapping(uri, "page-sequence-master",
  +                           PageSequenceMaster.maker());
  +        builder.addMapping(uri, "single-page-master-reference",
  +                           SinglePageMasterReference.maker());
  +        builder.addMapping(uri, "repeatable-page-master-reference",
  +                           RepeatablePageMasterReference.maker());
  +        builder.addMapping(uri, "conditional-page-master-reference",
  +                           ConditionalPageMasterReference.maker());
  +        builder.addMapping(uri, "repeatable-page-master-alternatives",
  +                           RepeatablePageMasterAlternatives.maker());
  +        builder.addMapping(uri, "flow", Flow.maker());
  +        builder.addMapping(uri, "static-content", StaticContent.maker());
  +        builder.addMapping(uri, "block", Block.maker());
  +        builder.addMapping(uri, "block-container", BlockContainer.maker());
  +        builder.addMapping(uri, "list-block", ListBlock.maker());
  +        builder.addMapping(uri, "list-item", ListItem.maker());
  +        builder.addMapping(uri, "list-item-label", ListItemLabel.maker());
  +        builder.addMapping(uri, "list-item-body", ListItemBody.maker());
  +        builder.addMapping(uri, "page-number", PageNumber.maker());
  +        builder.addMapping(uri, "page-number-citation",
  +                           PageNumberCitation.maker());
  +        builder.addMapping(uri, "display-sequence",
  +                           DisplaySequence.maker());
  +        builder.addMapping(uri, "inline", Inline.maker());
  +        builder.addMapping(uri, "external-graphic",
                              ExternalGraphic.maker());
  -	builder.addMapping(uri, "table", Table.maker());
  -	builder.addMapping(uri, "table-column", TableColumn.maker());
  -	builder.addMapping(uri, "table-header", TableHeader.maker());
  -	builder.addMapping(uri, "table-body", TableBody.maker());
  -	builder.addMapping(uri, "table-footer", TableFooter.maker());
  -	builder.addMapping(uri, "table-row", TableRow.maker());
  -	builder.addMapping(uri, "table-cell", TableCell.maker());
  -	builder.addMapping(uri, "basic-link", BasicLink.maker());
  -	builder.addMapping(uri, "instream-foreign-object", InstreamForeignObject.maker());
  -	builder.addMapping(uri, "leader", Leader.maker());
  -	builder.addMapping(uri, "character", org.apache.fop.fo.flow.Character.maker());
  -	builder.addMapping(uri, "footnote", Footnote.maker());
  -	builder.addMapping(uri, "footnote-body", FootnoteBody.maker());
  -	builder.addMapping(uri, "wrapper", Wrapper.maker());
  +        builder.addMapping(uri, "table", Table.maker());
  +        builder.addMapping(uri, "table-column", TableColumn.maker());
  +        builder.addMapping(uri, "table-header", TableHeader.maker());
  +        builder.addMapping(uri, "table-body", TableBody.maker());
  +        builder.addMapping(uri, "table-footer", TableFooter.maker());
  +        builder.addMapping(uri, "table-row", TableRow.maker());
  +        builder.addMapping(uri, "table-cell", TableCell.maker());
  +        builder.addMapping(uri, "basic-link", BasicLink.maker());
  +        builder.addMapping(uri, "instream-foreign-object",
  +                           InstreamForeignObject.maker());
  +        builder.addMapping(uri, "leader", Leader.maker());
  +        builder.addMapping(uri, "character",
  +                           org.apache.fop.fo.flow.Character.maker());
  +        builder.addMapping(uri, "footnote", Footnote.maker());
  +        builder.addMapping(uri, "footnote-body", FootnoteBody.maker());
  +        builder.addMapping(uri, "wrapper", Wrapper.maker());
  +
  +
  +        builder.addPropertyList(uri,
  +                                FOPropertyMapping.getGenericMappings());
  +        /* Add any element mappings */
  +        for (Enumeration e = FOPropertyMapping.getElementMappings();
  +                e.hasMoreElements();) {
  +            String elem = (String) e.nextElement();
  +            builder.addElementPropertyList(uri, elem,
  +                                           FOPropertyMapping.getElementMapping(elem));
  +        }
  +
       }
   }
  
  
  
  1.5       +3 -5      xml-fop/src/org/apache/fop/image/SVGImage.java
  
  Index: SVGImage.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/image/SVGImage.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- SVGImage.java	2001/05/21 12:10:16	1.4
  +++ SVGImage.java	2001/07/12 13:03:19	1.5
  @@ -1,4 +1,4 @@
  -/* $Id: SVGImage.java,v 1.4 2001/05/21 12:10:16 keiron Exp $
  +/* $Id: SVGImage.java,v 1.5 2001/07/12 13:03:19 keiron Exp $
    * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources."
  @@ -11,6 +11,7 @@
   import org.w3c.dom.svg.SVGDocument;
   
   // FOP
  +import org.apache.fop.apps.Driver;
   import org.apache.fop.messaging.*;
   import org.apache.fop.datatypes.ColorSpace;
   import org.apache.fop.pdf.PDFColor;
  @@ -44,10 +45,7 @@
        * @return the created SAX parser
        */
       public static String getParserName() {
  -        String parserClassName = System.getProperty("org.xml.sax.parser");
  -        if (parserClassName == null) {
  -            parserClassName = "org.apache.xerces.parsers.SAXParser";
  -        }
  +        String parserClassName = Driver.getParserClassName();
           return parserClassName;
       }
   
  
  
  
  1.25      +1 -5      xml-fop/src/org/apache/fop/render/awt/AWTRenderer.java
  
  Index: AWTRenderer.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/render/awt/AWTRenderer.java,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- AWTRenderer.java	2001/05/21 18:33:33	1.24
  +++ AWTRenderer.java	2001/07/12 13:03:24	1.25
  @@ -917,11 +917,7 @@
            * Returns the class name of the XML parser.
            */
           public String getXMLParserClassName() {
  -            String parserClassName = System.getProperty("org.xml.sax.parser");
  -            if (parserClassName == null) {
  -                parserClassName = "org.apache.xerces.parsers.SAXParser";
  -            }
  -            return parserClassName;//application.getXMLParserClassName();
  +            return Driver.getParserClassName();
           }
   
           /**
  
  
  
  1.72      +2 -6      xml-fop/src/org/apache/fop/render/pdf/PDFRenderer.java
  
  Index: PDFRenderer.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/render/pdf/PDFRenderer.java,v
  retrieving revision 1.71
  retrieving revision 1.72
  diff -u -r1.71 -r1.72
  --- PDFRenderer.java	2001/06/26 12:21:34	1.71
  +++ PDFRenderer.java	2001/07/12 13:03:29	1.72
  @@ -1,4 +1,4 @@
  -/* $Id: PDFRenderer.java,v 1.71 2001/06/26 12:21:34 keiron Exp $
  +/* $Id: PDFRenderer.java,v 1.72 2001/07/12 13:03:29 keiron Exp $
    * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources."
  @@ -829,11 +829,7 @@
            * Returns the class name of the XML parser.
            */
           public String getXMLParserClassName() {
  -            String parserClassName = System.getProperty("org.xml.sax.parser");
  -            if (parserClassName == null) {
  -                parserClassName = "org.apache.xerces.parsers.SAXParser";
  -            }
  -            return parserClassName;//application.getXMLParserClassName();
  +            return org.apache.fop.apps.Driver.getParserClassName();
           }
   
           /**
  
  
  
  1.3       +4 -8      xml-fop/src/org/apache/fop/render/ps/PSRenderer.java
  
  Index: PSRenderer.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/render/ps/PSRenderer.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- PSRenderer.java	2001/06/22 14:16:46	1.2
  +++ PSRenderer.java	2001/07/12 13:03:34	1.3
  @@ -1,4 +1,4 @@
  -/* $Id: PSRenderer.java,v 1.2 2001/06/22 14:16:46 keiron Exp $
  +/* $Id: PSRenderer.java,v 1.3 2001/07/12 13:03:34 keiron Exp $
    * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
  @@ -438,7 +438,7 @@
           comment("% --- SVG Area");
           write("gsave");
           if (w != 0 && h != 0) {
  -/*            write("newpath");
  +            write("newpath");
               write(x / 1000f + " " + y / 1000f + " M");
               write((x + w) / 1000f + " " + y / 1000f + " rlineto");
               write((x + w) / 1000f + " " + (y - h) / 1000f +
  @@ -446,7 +446,7 @@
               write(x / 1000f + " " + (y - h) / 1000f + " rlineto");
               write("closepath");
               write("clippath");
  -*/        }
  +        }
           // transform so that the coordinates (0,0) is from the top left
           // and positive is down and to the right. (0,0) is where the
           // viewBox puts it.
  @@ -1012,11 +1012,7 @@
            * Returns the class name of the XML parser.
            */
           public String getXMLParserClassName() {
  -            String parserClassName = System.getProperty("org.xml.sax.parser");
  -            if (parserClassName == null) {
  -                parserClassName = "org.apache.xerces.parsers.SAXParser";
  -            }
  -            return parserClassName;//application.getXMLParserClassName();
  +            return org.apache.fop.apps.Driver.getParserClassName();
           }
   
           /**
  
  
  
  1.13      +16 -2     xml-fop/src/org/apache/fop/svg/SVGElementMapping.java
  
  Index: SVGElementMapping.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/svg/SVGElementMapping.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- SVGElementMapping.java	2001/05/17 11:02:14	1.12
  +++ SVGElementMapping.java	2001/07/12 13:03:39	1.13
  @@ -1,11 +1,14 @@
  -/* $Id: SVGElementMapping.java,v 1.12 2001/05/17 11:02:14 keiron Exp $
  +/* $Id: SVGElementMapping.java,v 1.13 2001/07/12 13:03:39 keiron Exp $
    * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
  - * LICENSE file included with these sources."
  + * LICENSE file included with these sources.
    */
   
   package org.apache.fop.svg;
   
  +import java.util.Enumeration;
  +
  +import org.apache.fop.fo.properties.SVGPropertyMapping;
   import org.apache.fop.fo.TreeBuilder;
   import org.apache.fop.fo.FOTreeBuilder;
   import org.apache.fop.fo.ElementMapping;
  @@ -67,5 +70,16 @@
           builder.addMapping(uri, "feOffset", FeOffset.maker());
           builder.addMapping(uri, "feMerge", FeMerge.maker());
           builder.addMapping(uri, "feMergeNode", FeMergeNode.maker());
  +
  +
  +        builder.addPropertyList(uri,
  +                                SVGPropertyMapping.getGenericMappings());
  +        /* Add any element mappings */
  +        for (Enumeration e = SVGPropertyMapping.getElementMappings();
  +                e.hasMoreElements();) {
  +            String elem = (String) e.nextElement();
  +            builder.addElementPropertyList(uri, elem,
  +                                           SVGPropertyMapping.getElementMapping(elem));
  +        }
       }
   }
  
  
  

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