You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-dev@xmlgraphics.apache.org by tk...@apache.org on 2001/05/08 01:49:53 UTC

cvs commit: xml-batik/sources/org/apache/batik/util XMLResourceDescriptor.java

tkormann    01/05/07 16:49:53

  Modified:    resources/org/apache/batik/apps/svgbrowser/resources
                        FindDialog.properties Main.properties
               sources/org/apache/batik/apps/rasterizer Main.java
               sources/org/apache/batik/apps/svgbrowser FindDialog.java
                        Main.java
               sources/org/apache/batik/gvt/renderer BasicTextPainter.java
               sources/org/apache/batik/transcoder
                        XMLAbstractTranscoder.java
               sources/org/apache/batik/transcoder/image
                        ImageTranscoder.java
               sources/org/apache/batik/transcoder/print
                        PrintTranscoder.java
  Added:       resources/org/apache/batik/util/resources
                        XMLResourceDescriptor.properties
               sources/org/apache/batik/util XMLResourceDescriptor.java
  Removed:     resources/org/apache/batik/apps/regsvggen/resources
                        Messages.properties
  Log:
  1. Put in place a way to get global resources for Batik. The class
  XMLResourceDescriptor is used to get the XML parser classname for all apps.
  
  2. Add an option that lets the user choose if he wants to zoom or not while
  searching a string
  
  Revision  Changes    Path
  1.2       +4 -1      xml-batik/resources/org/apache/batik/apps/svgbrowser/resources/FindDialog.properties
  
  Index: FindDialog.properties
  ===================================================================
  RCS file: /home/cvs/xml-batik/resources/org/apache/batik/apps/svgbrowser/resources/FindDialog.properties,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- FindDialog.properties	2001/05/04 17:04:06	1.1
  +++ FindDialog.properties	2001/05/07 23:49:51	1.2
  @@ -9,7 +9,7 @@
   # FindDialog properties file
   #
   # Author: tkormann@apache.org
  -# $Id: FindDialog.properties,v 1.1 2001/05/04 17:04:06 tkormann Exp $
  +# $Id: FindDialog.properties,v 1.2 2001/05/07 23:49:51 tkormann Exp $
   #
   
   Dialog.title = Find...
  @@ -19,6 +19,9 @@
   
   CaseSensitiveCheckBox.text = Case sensitive
   CaseSensitiveCheckBox.mnemonic = S
  +
  +EnableZoomCheckBox.text = Enable zoom
  +EnableZoomCheckBox.mnemonic = A
   
   NextButton.text = Next
   NextButton.mnemonic = N
  
  
  
  1.3       +1 -7      xml-batik/resources/org/apache/batik/apps/svgbrowser/resources/Main.properties
  
  Index: Main.properties
  ===================================================================
  RCS file: /home/cvs/xml-batik/resources/org/apache/batik/apps/svgbrowser/resources/Main.properties,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Main.properties	2001/05/07 22:48:33	1.2
  +++ Main.properties	2001/05/07 23:49:51	1.3
  @@ -9,7 +9,7 @@
   # The application-wide resources.
   #
   # Author: stephane@hillion.org
  -# $Id: Main.properties,v 1.2 2001/05/07 22:48:33 vhardy Exp $
  +# $Id: Main.properties,v 1.3 2001/05/07 23:49:51 tkormann Exp $
   #
   
   #
  @@ -24,12 +24,6 @@
   
   org.w3c.css.sac.parser = org.apache.batik.css.parser.Parser
   #org.w3c.css.sac.parser = org.w3c.flute.parser.Parser
  -
  -# The XML parser class name.
  -
  -org.xml.sax.driver = org.apache.crimson.parser.XMLReaderImpl
  -#org.xml.sax.driver = org.apache.xerces.parsers.SAXParser
  -#org.xml.sax.driver = org.brownell.xml.aelfred2.SAXDriver
   
   #
   # Command-line options.
  
  
  
  1.1                  xml-batik/resources/org/apache/batik/util/resources/XMLResourceDescriptor.properties
  
  Index: XMLResourceDescriptor.properties
  ===================================================================
  #############################################################################
  # Copyright (C) The Apache Software Foundation. All rights reserved.        #
  #############################################################################
  # This software is published under the terms of the Apache Software License #
  # version 1.1, a copy of which has been included with this distribution in  #
  # the LICENSE file.                                                         #
  #############################################################################
  #
  # Author: Thierry Kormann
  
  org.xml.sax.driver = org.apache.crimson.parser.XMLReaderImpl
  
  
  
  
  1.9       +31 -34    xml-batik/sources/org/apache/batik/apps/rasterizer/Main.java
  
  Index: Main.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/apps/rasterizer/Main.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- Main.java	2001/04/18 23:18:16	1.8
  +++ Main.java	2001/05/07 23:49:52	1.9
  @@ -30,7 +30,7 @@
    * A simple class that can generate images from svg documents.
    *
    * @author <a href="mailto:Thierry.Kormann@sophia.inria.fr">Thierry Kormann</a>
  - * @version $Id: Main.java,v 1.8 2001/04/18 23:18:16 vhardy Exp $
  + * @version $Id: Main.java,v 1.9 2001/05/07 23:49:52 tkormann Exp $
    */
   public class Main {
   
  @@ -45,6 +45,7 @@
               ostream.flush();
               ostream.close();
           } catch(Exception ex) {
  +            ex.printStackTrace();
               System.out.println("Error while writing "+uri+" to "+output);
           }
       }
  @@ -136,12 +137,8 @@
               mimeType.equals("image/jpeg") ||
               mimeType.equals("image/jpe")) {
               t = new JPEGTranscoder();
  -            t.addTranscodingHint(JPEGTranscoder.KEY_XML_PARSER_CLASSNAME,
  -                                 "org.apache.crimson.parser.XMLReaderImpl");
           } else if (mimeType.equals("image/png")) {
               t = new PNGTranscoder();
  -            t.addTranscodingHint(PNGTranscoder.KEY_XML_PARSER_CLASSNAME,
  -                                 "org.apache.crimson.parser.XMLReaderImpl");
           }
           if (t == null) {
               error("No transcoder found for mime type : "+mimeType);
  @@ -152,7 +149,7 @@
               t.addTranscodingHint(ImageTranscoder.KEY_WIDTH,
                                    new Float(width));
           }
  -        
  +
           if(!Float.isNaN(height)){
               t.addTranscodingHint(ImageTranscoder.KEY_HEIGHT,
                                    new Float(height));
  @@ -183,10 +180,10 @@
                   if (directory == null) {
                       directory = getDirectory(s);
                   }
  -						
  +
                   if (directory != null) {
                       File output = new File(directory, uri);
  -							
  +
                       writeImage((ImageTranscoder)t,
                                  url.toString(),
                                  output.getAbsolutePath());
  @@ -199,34 +196,34 @@
           }
           System.exit(0);
       }
  +
  +        public static URL getSVGURL(String s) {
  +                URL url = null;
   
  -	public static URL getSVGURL(String s) {
  -		URL url = null;
  +                try{
  +                        File f = new File(s);
  +                        if(f.exists()){
  +                                url = f.toURL();
  +                        }
  +                        else{
  +                                url = new URL(s);
  +                        }
  +                }catch(MalformedURLException e){
  +                        error("Bad svg file: " + s);
  +                }
   
  -		try{
  -			File f = new File(s);
  -			if(f.exists()){
  -				url = f.toURL();
  -			}
  -			else{
  -				url = new URL(s);
  -			}
  -		}catch(MalformedURLException e){
  -			error("Bad svg file: " + s);
  -		}
  -
  -		return url;
  -	}
  -
  -	public static String getDirectory(String s){
  -		File f = new File(s);
  -		if(f.exists()){
  -			return f.getParent();
  -		}
  -		else{
  -			return null;
  -		}
  -	}
  +                return url;
  +        }
  +
  +        public static String getDirectory(String s){
  +                File f = new File(s);
  +                if(f.exists()){
  +                        return f.getParent();
  +                }
  +                else{
  +                        return null;
  +                }
  +        }
   
   }
   
  
  
  
  1.2       +25 -13    xml-batik/sources/org/apache/batik/apps/svgbrowser/FindDialog.java
  
  Index: FindDialog.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/apps/svgbrowser/FindDialog.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- FindDialog.java	2001/05/04 17:04:17	1.1
  +++ FindDialog.java	2001/05/07 23:49:52	1.2
  @@ -58,7 +58,7 @@
    * an SVG document.
    *
    * @author <a href="mailto:tkormann@apache.org">Thierry Kormann</a>
  - * @version $Id: FindDialog.java,v 1.1 2001/05/04 17:04:17 tkormann Exp $
  + * @version $Id: FindDialog.java,v 1.2 2001/05/07 23:49:52 tkormann Exp $
    */
   public class FindDialog extends JDialog implements ActionMap {
   
  @@ -112,6 +112,9 @@
       /** The case sensitive button. */
       protected JCheckBox caseSensitive;
   
  +    /** The zoom button. */
  +    protected JCheckBox enableZoom;
  +
       /** The canvas. */
       protected JSVGCanvas svgCanvas;
   
  @@ -160,7 +163,7 @@
   
           gbc.fill = ExtendedGridBagConstraints.HORIZONTAL;
           gbc.setWeight(1.0, 0);
  -        gbc.setGridBounds(1, 0, 1, 1);
  +        gbc.setGridBounds(1, 0, 2, 1);
           panel.add(search = new JTextField(20), gbc);
           search.getDocument().addDocumentListener(new TextTracker());
   
  @@ -171,6 +174,13 @@
           caseSensitive = buttonFactory.createJCheckBox("CaseSensitiveCheckBox");
           panel.add(caseSensitive, gbc);
   
  +        gbc.fill = ExtendedGridBagConstraints.NONE;
  +        gbc.anchor = ExtendedGridBagConstraints.WEST;
  +        gbc.setWeight(0, 0);
  +        gbc.setGridBounds(2, 1, 1, 1);
  +        enableZoom = buttonFactory.createJCheckBox("EnableZoomCheckBox");
  +        panel.add(enableZoom, gbc);
  +
           return panel;
       }
   
  @@ -274,18 +284,20 @@
           GraphicsNode gn = walker.getCurrentGraphicsNode();
           if (!(gn instanceof TextNode)) {
               return;
  +        }
  +        System.out.println(((TextNode)gn).getText());
  +        if (enableZoom.isSelected()) {
  +            Rectangle2D bounds = gn.getBounds(svgCanvas.getRenderContext());
  +            bounds = gn.getGlobalTransform().createTransformedShape
  +                (bounds).getBounds();
  +            Dimension dim = svgCanvas.getSize();
  +            AffineTransform Tx = new AffineTransform();
  +            double s = Math.min(dim.width/bounds.getWidth(),
  +                                dim.height/bounds.getHeight());
  +            Tx.scale(s*.8, s*.8);
  +            Tx.translate(-bounds.getX(), -bounds.getY());
  +            svgCanvas.setRenderingTransform(Tx);
           }
  -        Rectangle2D bounds = gn.getBounds(svgCanvas.getRenderContext());
  -        bounds = gn.getGlobalTransform().createTransformedShape
  -            (bounds).getBounds();
  -        Dimension dim = svgCanvas.getSize();
  -        AffineTransform Tx = new AffineTransform();
  -        double s = Math.min(dim.width/bounds.getWidth(),
  -                            dim.height/bounds.getHeight());
  -        Tx.scale(s*.8, s*.8);
  -        Tx.translate(-bounds.getX(), -bounds.getY());
  -        svgCanvas.setRenderingTransform(Tx);
  -        //System.out.println(gn+" "+((TextNode)gn).getText()+" "+bounds);
       }
   
   
  
  
  
  1.7       +10 -16    xml-batik/sources/org/apache/batik/apps/svgbrowser/Main.java
  
  Index: Main.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/apps/svgbrowser/Main.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- Main.java	2001/05/07 22:47:03	1.6
  +++ Main.java	2001/05/07 23:49:52	1.7
  @@ -31,6 +31,7 @@
   import javax.swing.plaf.FontUIResource;
   
   import org.apache.batik.css.CSSDocumentHandler;
  +import org.apache.batik.util.XMLResourceDescriptor;
   
   import org.apache.batik.util.gui.resource.ResourceManager;
   
  @@ -38,7 +39,7 @@
    * This class contains the main method of an SVG viewer.
    *
    * @author <a href="mailto:stephane@hillion.org">Stephane Hillion</a>
  - * @version $Id: Main.java,v 1.6 2001/05/07 22:47:03 vhardy Exp $
  + * @version $Id: Main.java,v 1.7 2001/05/07 23:49:52 tkormann Exp $
    */
   public class Main implements Application {
   
  @@ -82,12 +83,6 @@
       }
   
       /**
  -     * The XML parser class name.
  -     */
  -    protected static String xmlParserClassName =
  -        resources.getString(XML_PARSER_CLASS_NAME_KEY);
  -
  -    /**
        * The frame's icon.
        */
       protected static ImageIcon frameIcon = new ImageIcon
  @@ -148,9 +143,9 @@
   
                   File file = new File(arguments[i]);
                   if (file.canRead()) {
  -                    if (frame == null) 
  +                    if (frame == null)
                           frame = createAndShowJSVGViewerFrame();
  -                    
  +
                       frame.getJSVGCanvas().loadSVGDocument
                           (file.toURL().toString());
                       frame = null;
  @@ -158,15 +153,15 @@
                       // Let the user know that we are
                       // skipping this file...
   
  -                    // Note that frame may be null, which is 
  +                    // Note that frame may be null, which is
                       // a valid argument for showMessageDialog
   
                       // NOTE: Need to revisit Resources/Messages usage to
  -                    //       have a single entry point. Should have a 
  +                    //       have a single entry point. Should have a
                       //       formated message here instead of a + ...
                       JOptionPane.showMessageDialog
  -                        (frame, 
  -                         resources.getString("Error.skipping.file") 
  +                        (frame,
  +                         resources.getString("Error.skipping.file")
                            + file.getAbsolutePath());
                   }
                   i++;
  @@ -283,7 +278,7 @@
           }
           f.setVisible(false);
       }
  -    
  +
       /**
        * Creates a new application exit action.
        */
  @@ -307,7 +302,6 @@
        * Returns the XML parser class name.
        */
       public String getXMLParserClassName() {
  -        return xmlParserClassName;
  +        return XMLResourceDescriptor.getXMLParserClassName();
       }
  -
   }
  
  
  
  1.4       +22 -16    xml-batik/sources/org/apache/batik/gvt/renderer/BasicTextPainter.java
  
  Index: BasicTextPainter.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/gvt/renderer/BasicTextPainter.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- BasicTextPainter.java	2001/04/29 08:22:26	1.3
  +++ BasicTextPainter.java	2001/05/07 23:49:52	1.4
  @@ -8,28 +8,34 @@
   
   package org.apache.batik.gvt.renderer;
   
  -import org.apache.batik.gvt.TextNode;
  -import org.apache.batik.gvt.TextPainter;
  -import org.apache.batik.gvt.GraphicsNodeRenderContext;
  -import org.apache.batik.gvt.text.GVTAttributedCharacterIterator;
  -import org.apache.batik.gvt.text.TextSpanLayout;
  -import org.apache.batik.gvt.text.TextLayoutFactory;
  -import org.apache.batik.gvt.text.TextHit;
  -import org.apache.batik.gvt.text.ConcreteTextLayoutFactory;
  -import java.awt.Graphics2D;
  +import java.awt.BasicStroke;
   import java.awt.Color;
  +import java.awt.Composite;
  +import java.awt.Graphics2D;
   import java.awt.Paint;
  -import java.awt.Stroke;
  -import java.awt.BasicStroke;
   import java.awt.Shape;
  -import java.awt.Composite;
  +import java.awt.Stroke;
  +
  +import java.awt.font.FontRenderContext;
  +import java.awt.font.TextAttribute;
  +
  +import java.awt.geom.AffineTransform;
   import java.awt.geom.GeneralPath;
   import java.awt.geom.Point2D;
   import java.awt.geom.Rectangle2D;
  -import java.awt.geom.AffineTransform;
  +
   import java.text.AttributedCharacterIterator;
  -import java.awt.font.TextAttribute;
  -import java.awt.font.FontRenderContext;
  +
  +import org.apache.batik.gvt.GraphicsNodeRenderContext;
  +import org.apache.batik.gvt.TextNode;
  +import org.apache.batik.gvt.TextPainter;
  +
  +import org.apache.batik.gvt.text.ConcreteTextLayoutFactory;
  +import org.apache.batik.gvt.text.GVTAttributedCharacterIterator;
  +import org.apache.batik.gvt.text.Mark;
  +import org.apache.batik.gvt.text.TextHit;
  +import org.apache.batik.gvt.text.TextLayoutFactory;
  +import org.apache.batik.gvt.text.TextSpanLayout;
   
   /**
    * Basic implementation of TextPainter which
  @@ -39,7 +45,7 @@
    *
    * @author <a href="bill.haneman@ireland.sun.com>Bill Haneman</a>
    * @author <a href="vincent.hardy@sun.com>Vincent Hardy</a>
  - * @version $Id: BasicTextPainter.java,v 1.3 2001/04/29 08:22:26 dino Exp $
  + * @version $Id: BasicTextPainter.java,v 1.4 2001/05/07 23:49:52 tkormann Exp $
    */
   public abstract class BasicTextPainter implements TextPainter {
   
  
  
  
  1.9       +4 -6      xml-batik/sources/org/apache/batik/transcoder/XMLAbstractTranscoder.java
  
  Index: XMLAbstractTranscoder.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/transcoder/XMLAbstractTranscoder.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- XMLAbstractTranscoder.java	2001/04/13 13:11:32	1.8
  +++ XMLAbstractTranscoder.java	2001/05/07 23:49:52	1.9
  @@ -18,6 +18,8 @@
   import org.apache.batik.transcoder.keys.DOMImplementationKey;
   import org.apache.batik.transcoder.keys.StringKey;
   
  +import org.apache.batik.util.XMLResourceDescriptor;
  +
   import org.w3c.dom.DOMException;
   import org.w3c.dom.DOMImplementation;
   import org.w3c.dom.Document;
  @@ -29,8 +31,6 @@
    * transcoding hints:
    *
    * <ul>
  - * <li><tt>KEY_XML_PARSER_CLASSNAME</tt>: the XML parser to use
  - *
    * <li><tt>KEY_DOM_IMPLEMENTATION</tt>: the DOM Implementation to use
    *
    * <li><tt>KEY_DOCUMENT_ELEMENT_NAMESPACE_URI</tt>: the namespace URI of the
  @@ -41,7 +41,7 @@
    * </ul>
    *
    * @author <a href="mailto:Thierry.Kormann@sophia.inria.fr">Thierry Kormann</a>
  - * @version $Id: XMLAbstractTranscoder.java,v 1.8 2001/04/13 13:11:32 tkormann Exp $
  + * @version $Id: XMLAbstractTranscoder.java,v 1.9 2001/05/07 23:49:52 tkormann Exp $
    */
   public abstract class XMLAbstractTranscoder extends AbstractTranscoder {
   
  @@ -78,9 +78,7 @@
                   (DOMImplementation)hints.get(KEY_DOM_IMPLEMENTATION);
   
               if (parserClassname == null) {
  -                handler.fatalError(new TranscoderException(
  -                   "Unspecified transcoding hints: KEY_XML_PARSER_CLASSNAME"));
  -                return;
  +                parserClassname = XMLResourceDescriptor.getXMLParserClassName();
               }
               if (domImpl == null) {
                   handler.fatalError(new TranscoderException(
  
  
  
  1.22      +7 -3      xml-batik/sources/org/apache/batik/transcoder/image/ImageTranscoder.java
  
  Index: ImageTranscoder.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/transcoder/image/ImageTranscoder.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- ImageTranscoder.java	2001/04/18 13:51:09	1.21
  +++ ImageTranscoder.java	2001/05/07 23:49:52	1.22
  @@ -63,6 +63,7 @@
   import org.apache.batik.transcoder.keys.StringKey;
   
   import org.apache.batik.util.SVGConstants;
  +import org.apache.batik.util.XMLResourceDescriptor;
   
   import org.w3c.dom.DOMException;
   import org.w3c.dom.DOMImplementation;
  @@ -99,7 +100,7 @@
    * millimeter conversion factor.
    *
    * @author <a href="mailto:Thierry.Kormann@sophia.inria.fr">Thierry Kormann</a>
  - * @version $Id: ImageTranscoder.java,v 1.21 2001/04/18 13:51:09 hillion Exp $
  + * @version $Id: ImageTranscoder.java,v 1.22 2001/05/07 23:49:52 tkormann Exp $
    */
   public abstract class ImageTranscoder extends XMLAbstractTranscoder {
   
  @@ -138,7 +139,6 @@
           SVGDocument svgDoc = (SVGDocument)document;
           SVGSVGElement root = svgDoc.getRootElement();
           // initialize the SVG document with the appropriate context
  -        String parserClassname = (String)hints.get(KEY_XML_PARSER_CLASSNAME);
           DefaultSVGContext svgCtx = new DefaultSVGContext();
           svgCtx.setPixelToMM(userAgent.getPixelToMM());
           ((SVGOMDocument)document).setSVGContext(svgCtx);
  @@ -376,7 +376,11 @@
            * Returns the XML parser to use from the TranscodingHints.
            */
           public String getXMLParserClassName() {
  -            return (String)hints.get(KEY_XML_PARSER_CLASSNAME);
  +            if (hints.containsKey(KEY_XML_PARSER_CLASSNAME)) {
  +                return (String)hints.get(KEY_XML_PARSER_CLASSNAME);
  +            } else {
  +                return XMLResourceDescriptor.getXMLParserClassName();
  +            }
           }
   
           /**
  
  
  
  1.7       +7 -2      xml-batik/sources/org/apache/batik/transcoder/print/PrintTranscoder.java
  
  Index: PrintTranscoder.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/transcoder/print/PrintTranscoder.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- PrintTranscoder.java	2001/04/18 13:51:13	1.6
  +++ PrintTranscoder.java	2001/05/07 23:49:53	1.7
  @@ -73,6 +73,7 @@
   import org.apache.batik.transcoder.keys.StringKey;
   
   import org.apache.batik.util.SVGConstants;
  +import org.apache.batik.util.XMLResourceDescriptor;
   
   import org.w3c.dom.DOMException;
   import org.w3c.dom.DOMImplementation;
  @@ -107,7 +108,7 @@
    * </ul>
    *
    * @author <a href="mailto:vincent.hardy@eng.sun.com">Vincent Hardy</a>
  - * @version $Id: PrintTranscoder.java,v 1.6 2001/04/18 13:51:13 hillion Exp $
  + * @version $Id: PrintTranscoder.java,v 1.7 2001/05/07 23:49:53 tkormann Exp $
    */
   public class PrintTranscoder extends XMLAbstractTranscoder
       implements Printable {
  @@ -832,7 +833,11 @@
            * <tt>TranscodingHints</tt> or null if any.
            */
           public String getUserStyleSheetURI() {
  -            return (String)hints.get(KEY_USER_STYLESHEET_URI);
  +            if (hints.containsKey(KEY_XML_PARSER_CLASSNAME)) {
  +                return (String)hints.get(KEY_XML_PARSER_CLASSNAME);
  +            } else {
  +                return XMLResourceDescriptor.getXMLParserClassName();
  +            }
           }
   
           /**
  
  
  
  1.1                  xml-batik/sources/org/apache/batik/util/XMLResourceDescriptor.java
  
  Index: XMLResourceDescriptor.java
  ===================================================================
  /*****************************************************************************
   * Copyright (C) The Apache Software Foundation. All rights reserved.        *
   * ------------------------------------------------------------------------- *
   * This software is published under the terms of the Apache Software License *
   * version 1.1, a copy of which has been included with this distribution in  *
   * the LICENSE file.                                                         *
   *****************************************************************************/
  
  package org.apache.batik.util;
  
  import java.util.Locale;
  import java.util.ResourceBundle;
  
  /**
   * This class describes the XML resources needed to use the various batik
   * modules.
   *
   * @author <a href="mailto:Thierry.Kormann@sophia.inria.fr">Thierry Kormann</a>
   * @version $Id: XMLResourceDescriptor.java,v 1.1 2001/05/07 23:49:53 tkormann Exp $
   */
  public class XMLResourceDescriptor {
  
      /**
       * The XML parser class name key.
       */
      public final static String XML_PARSER_CLASS_NAME_KEY = "org.xml.sax.driver";
  
      /**
       * The resources file name
       */
      public final static String RESOURCES =
          "org.apache.batik.util.resources.XMLResourceDescriptor";
  
      /**
       * The resource bundle
       */
      protected static ResourceBundle bundle;
  
      /**
       * The class name of the XML parser to use.
       */
      protected static String xmlParserClassName;
  
      static {
          bundle = ResourceBundle.getBundle(RESOURCES, Locale.getDefault());
      }
  
      /**
       * Returns the class name of the XML parser to use.
       *
       * <p>This method first checks if any XML parser has been specified using
       * the <tt>setXMLParserClassName</tt> method. If any, this method will
       * return the value of the property 'org.xml.sax.driver' specified in the
       * <tt>resources/XMLResourceDescriptor.properties</tt> resource file.
       */
      public static String getXMLParserClassName() {
          if (xmlParserClassName == null) {
              xmlParserClassName = bundle.getString(XML_PARSER_CLASS_NAME_KEY);
          }
          return xmlParserClassName;
      }
  
      /**
       * Sets the class name of the XML parser to use.
       *
       * @param xmlParserClassName the classname of the XML parser
       */
      public static void setXMLParserClassName(String xmlParserClassName) {
          XMLResourceDescriptor.xmlParserClassName = xmlParserClassName;
      }
  }
  
  
  

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