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 vh...@apache.org on 2002/11/12 10:51:35 UTC

cvs commit: xml-batik/samples/tests/spec/interactivity cursorImage.svg cursorImage2.svg cursor.svg

vhardy      2002/11/12 01:51:35

  Modified:    sources/org/apache/batik/bridge
                        BaseScriptingEnvironment.java BridgeContext.java
                        CSSUtilities.java GVTBuilder.java
                        SVGAElementBridge.java SVGImageElementBridge.java
                        SVGTextElementBridge.java SVGUseElementBridge.java
               sources/org/apache/batik/script Interpreter.java
               sources/org/apache/batik/script/jacl JaclInterpreter.java
               sources/org/apache/batik/script/jpython
                        JPythonInterpreter.java
               sources/org/apache/batik/script/rhino RhinoClassLoader.java
                        RhinoInterpreter.java
               sources/org/apache/batik/util SVGConstants.java
               resources/org/apache/batik/bridge/resources
                        Messages.properties
               resources/org/apache/batik/dom/svg/resources
                        dtdids.properties
               samples/tests/spec/interactivity cursor.svg
  Added:       sources/org/apache/batik/bridge CursorManager.java
               samples/tests/spec/interactivity cursorImage.svg
                        cursorImage2.svg
  Log:
  - Added better error reporting for external scripts: errors now include the uri 
    of the external scripts in addition to the line number which is convenient 
    when an SVG file references multiple external scripts.
  
  - Fixed class loader delegation bug in RhinoClassLoader
  
  - Modified the way SVG public identifiers are mapped to system identifiers. 
    The resource file now contains the mapping to the correct SVG DTD instead
    of only containing the allowed SVG 1.0 system identifiers for a hard 
    coded DTD. 
  
  - Added support for predefined cursors. Custom cursor support will follow.
    This preserves the old behavior as much as possible. For details, see the 
    samples/tests/spec/interactivity/cursor.svg sample file.
  
  
  
  Revision  Changes    Path
  1.15      +10 -2     xml-batik/sources/org/apache/batik/bridge/BaseScriptingEnvironment.java
  
  Index: BaseScriptingEnvironment.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/bridge/BaseScriptingEnvironment.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- BaseScriptingEnvironment.java	28 Aug 2002 07:02:37 -0000	1.14
  +++ BaseScriptingEnvironment.java	12 Nov 2002 09:51:34 -0000	1.15
  @@ -60,6 +60,11 @@
    * @version $Id$
    */
   public class BaseScriptingEnvironment {
  +    /**
  +     * Constant used to describe inline scripts
  +     */
  +    public static final String INLINE_SCRIPT_DESCRIPTION 
  +        = "BaseScriptingEnvironment.constant.inline.script.description";
   
       /**
        * Tells whether the given SVG document is dynamic.
  @@ -330,8 +335,11 @@
   
               try {
                   String href = XLinkSupport.getXLinkHref(script);
  +                String desc = Messages.getMessage(INLINE_SCRIPT_DESCRIPTION);
                   Reader reader;
                   if (href.length() > 0) {
  +                    desc = href;
  +
                       // External script.
                       ParsedURL purl = new ParsedURL
                           (XMLBaseSupport.getCascadedXMLBase(script), href);
  @@ -352,7 +360,7 @@
                       }
                   }
   
  -                interpreter.evaluate(reader);
  +                interpreter.evaluate(reader, desc);
   
               } catch (IOException e) {
                   if (userAgent != null) {
  
  
  
  1.53      +107 -2    xml-batik/sources/org/apache/batik/bridge/BridgeContext.java
  
  Index: BridgeContext.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/bridge/BridgeContext.java,v
  retrieving revision 1.52
  retrieving revision 1.53
  diff -u -r1.52 -r1.53
  --- BridgeContext.java	5 Sep 2002 12:58:18 -0000	1.52
  +++ BridgeContext.java	12 Nov 2002 09:51:34 -0000	1.53
  @@ -8,6 +8,8 @@
   
   package org.apache.batik.bridge;
   
  +import java.awt.Cursor;
  +
   import java.awt.geom.Dimension2D;
   import java.io.InterruptedIOException;
   import java.io.IOException;
  @@ -17,7 +19,6 @@
   
   import java.util.Collections;
   import java.util.HashMap;
  -import java.util.HashMap;
   import java.util.Iterator;
   import java.util.LinkedList;
   import java.util.List;
  @@ -751,6 +752,39 @@
       protected FocusManager focusManager;
   
       /**
  +     * Adds EventListeners to the input document to handle the cursor 
  +     * property.
  +     * This is not done in the addDOMListeners method because 
  +     * addDOMListeners is only used for dynamic content whereas 
  +     * cursor support is provided for all content.
  +     * Also note that it is very important that the listeners be
  +     * registered for the capture phase as the 'default' behavior
  +     * for cursors is handled by the BridgeContext during the 
  +     * capture phase and the 'custom' behavior (handling of 'auto'
  +     * on anchors, for example), is handled during the bubling phase.
  +     */
  +    public void addUIEventListeners(Document doc) {
  +        EventTarget evtTarget = (EventTarget)doc.getDocumentElement();
  +
  +        DOMMouseOverEventListener domMouseOverListener =
  +            new DOMMouseOverEventListener();
  +        evtTarget.addEventListener(SVGConstants.SVG_EVENT_MOUSEOVER, 
  +                                   domMouseOverListener,
  +                                   true);
  +        storeEventListener(evtTarget, SVGConstants.SVG_EVENT_MOUSEOVER, 
  +                           domMouseOverListener, true);
  +
  +        DOMMouseOutEventListener domMouseOutListener =
  +            new DOMMouseOutEventListener();
  +        evtTarget.addEventListener(SVGConstants.SVG_EVENT_MOUSEOUT,
  +                                   domMouseOutListener,
  +                                   true);
  +        storeEventListener(evtTarget, SVGConstants.SVG_EVENT_MOUSEOUT, 
  +                           domMouseOutListener, true);
  +
  +    }
  +
  +    /**
        * Adds EventListeners to the DOM and CSSEngineListener to the
        * CSSEngine to handle any modifications on the DOM tree or style
        * properties and update the GVT tree in response.
  @@ -779,6 +813,7 @@
                                      domCharacterDataModifiedListener,
                                      true);
   
  +
           focusManager = new FocusManager(document);
   
           SVGOMDocument svgDocument = (SVGOMDocument)document;
  @@ -899,6 +934,76 @@
           }
       }
   
  +    /**
  +     * The DOM EventListener invoked when the mouse exits an element
  +     */
  +    protected class DOMMouseOutEventListener implements EventListener {
  +        public void handleEvent(Event evt) {
  +            userAgent.setSVGCursor(CursorManager.DEFAULT_CURSOR);
  +        }
  +    }
  +
  +
  +    /**
  +     * The DOM EventListener invoked when the mouse mouves over a new 
  +     * element.
  +     * 
  +     * Here is how cursors are handled:
  +     * 
  +     */
  +    protected class DOMMouseOverEventListener implements EventListener {
  +        /**
  +         * Handles 'mouseover' MouseEvent event type.
  +         */
  +        public void handleEvent(Event evt) {
  +            Element target = (Element)evt.getTarget();
  +            String tag = target.getNodeName();
  +            String cursorStr = CSSUtilities.convertCursor(target);
  +            Cursor cursor = null;
  +
  +            if (SVGConstants.SVG_AUTO_VALUE.equalsIgnoreCase(cursorStr)) {
  +                // Handle 'auto' value.
  +                //
  +                // - <a> The following sets the cursor for <a> element enclosing
  +                //   text nodes. Setting the proper cursor (i.e., depending on the
  +                //   children's 'cursor' property, is handled in the SVGAElementBridge
  +                //   so as to avoid going up the tree on mouseover events (looking for
  +                //   an anchor ancestor.
  +                // - <image> The following does not change the cursor if the 
  +                //   element's cursor property is set to 'auto'. Otherwise, it takes
  +                //   precedence over any child (in case of SVG content) cursor setting.
  +                //   This means that for images referencing SVG content, a cursor 
  +                //   property set to 'auto' on the <image> element will not override 
  +                //   the cursor settings inside the SVG image. Any other cursor property
  +                //   will take precedence.
  +                // - <use> Same behavior as for <image> except that the behavior 
  +                //   is controlled from the <use> element bridge (SVGUseElementBridge).
  +                // - <text>, <tref> and <tspan> : a cursor value of auto will cause the
  +                //   cursor to be set to a text cursor. Note that text content with an
  +                //   'auto' cursor and descendant of an anchor will have its cursor
  +                //   set to the anchor cursor through the SVGAElementBridge.
  +                //
  +                if (SVGConstants.SVG_A_TAG.equalsIgnoreCase(tag)) {
  +                    cursor = CursorManager.ANCHOR_CURSOR;
  +                } else if (SVGConstants.SVG_TEXT_TAG.equalsIgnoreCase(tag) ||
  +                           SVGConstants.SVG_TSPAN_TAG.equalsIgnoreCase(tag) ||
  +                           SVGConstants.SVG_TREF_TAG.equalsIgnoreCase(tag) ) {
  +                    cursor = CursorManager.TEXT_CURSOR;
  +                } else if (SVGConstants.SVG_IMAGE_TAG.equalsIgnoreCase(tag)) {
  +                    // Do not change the cursor 
  +                    return;
  +                } else {
  +                    cursor = CursorManager.DEFAULT_CURSOR;
  +                }
  +            } else {
  +                // Specific, logical cursor
  +                cursor = CursorManager.getCursor(cursorStr);
  +            }
  +
  +            userAgent.setSVGCursor(cursor);
  +        }
  +    }
  +    
       /**
        * The DOM EventListener invoked when a node is added.
        */
  
  
  
  1.38      +38 -1     xml-batik/sources/org/apache/batik/bridge/CSSUtilities.java
  
  Index: CSSUtilities.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/bridge/CSSUtilities.java,v
  retrieving revision 1.37
  retrieving revision 1.38
  diff -u -r1.37 -r1.38
  --- CSSUtilities.java	19 Mar 2002 09:25:40 -0000	1.37
  +++ CSSUtilities.java	12 Nov 2002 09:51:34 -0000	1.38
  @@ -26,6 +26,7 @@
   import org.apache.batik.css.engine.CSSStylableElement;
   import org.apache.batik.css.engine.SVGCSSEngine;
   import org.apache.batik.css.engine.value.ListValue;
  +import org.apache.batik.css.engine.value.StringValue;
   import org.apache.batik.css.engine.value.Value;
   import org.apache.batik.css.engine.value.svg.ICCColor;
   
  @@ -217,6 +218,42 @@
               : MultipleGradientPaint.SRGB;
       }
   
  +    /////////////////////////////////////////////////////////////////////////
  +    // 'cursor'
  +    /////////////////////////////////////////////////////////////////////////
  +
  +    /**
  +     * Returns the cursor string corresponding to the input element's
  +     * cursor property
  +     *
  +     * @param e the element
  +     */
  +    public static String
  +        convertCursor(Element e) {
  +        Value cursorValue 
  +            = CSSUtilities.getComputedStyle(e, 
  +                                            SVGCSSEngine.CURSOR_INDEX);
  +        String cursorStr = SVGConstants.SVG_AUTO_VALUE;
  +        
  +        if (cursorValue != null) {
  +            if (cursorValue instanceof StringValue) {
  +                // Single Value : should be one of the predefined cursors or 
  +                // 'inherit'
  +                cursorStr = cursorValue.getStringValue();
  +            } else if (cursorValue instanceof ListValue) {
  +                // We do not handle custom cursors yet
  +                ListValue l = (ListValue)cursorValue;
  +                int nValues = l.getLength();
  +                if (nValues > 0) {
  +                    cursorStr = l.item(nValues-1).getStringValue();
  +                }
  +            }
  +        } 
  +
  +        return cursorStr;
  +    }
  +
  +       
       ////////////////////////////////////////////////////////////////////////
       // 'color-rendering', 'text-rendering', 'image-rendering',
       // 'shape-rendering'
  
  
  
  1.23      +4 -1      xml-batik/sources/org/apache/batik/bridge/GVTBuilder.java
  
  Index: GVTBuilder.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/bridge/GVTBuilder.java,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- GVTBuilder.java	12 Jun 2002 08:20:34 -0000	1.22
  +++ GVTBuilder.java	12 Nov 2002 09:51:34 -0000	1.23
  @@ -84,6 +84,9 @@
               throw ex; // re-throw the udpated exception
           }
   
  +        // For cursor handling
  +        ctx.addUIEventListeners(document);
  +
           // <!> FIXME: TO BE REMOVED
           if (ctx.isDynamic()) {
               // register GVT listeners for AWT event support
  
  
  
  1.19      +39 -8     xml-batik/sources/org/apache/batik/bridge/SVGAElementBridge.java
  
  Index: SVGAElementBridge.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/bridge/SVGAElementBridge.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- SVGAElementBridge.java	1 Oct 2002 13:07:49 -0000	1.18
  +++ SVGAElementBridge.java	12 Nov 2002 09:51:34 -0000	1.19
  @@ -15,6 +15,7 @@
   import org.apache.batik.gvt.GraphicsNode;
   
   import org.w3c.dom.Element;
  +import org.w3c.dom.Node;
   import org.w3c.dom.events.Event;
   import org.w3c.dom.events.EventListener;
   import org.w3c.dom.events.EventTarget;
  @@ -122,14 +123,40 @@
           }
   
           public void handleEvent(Event evt) {
  +            //
  +            // Only modify the cursor if the target's cursor property is 
  +            // 'auto'. Note that we do not need to check the value of 
  +            // anchor element as the target's cursor value is resulting
  +            // from the CSS cascade which has accounted for inheritance.
  +            // This means that our behavior is to set the cursor to a 
  +            // hand cursor for any content on which the cursor property is
  +            // 'auto' inside an anchor element. If, for example, the 
  +            // content was:
  +            // <a cusor="wait">
  +            //    <g cursor="auto">
  +            //       <rect />
  +            //    </g>
  +            // </a>
  +            //
  +            // The cursor on the inside rect will be set to the hand cursor and
  +            // not the wait cursor
  +            //
  +            String cursorStr = CSSUtilities.convertCursor((Element)evt.getTarget());
  +            
  +            if (SVG_AUTO_VALUE.equalsIgnoreCase(cursorStr)) {
  +                // The target's cursor value is 'auto': use the hand cursor
  +                userAgent.setSVGCursor(CursorManager.ANCHOR_CURSOR);
  +            }
  +            
  +            // 
  +            // In all cases, display the href in the userAgent
  +            //
  +
               SVGAElement elt = (SVGAElement)evt.getCurrentTarget();
  -            Cursor cursor = Cursor.getPredefinedCursor(Cursor.HAND_CURSOR);
  -            userAgent.setSVGCursor(cursor);
               if (elt != null) {
                   String href = XLinkSupport.getXLinkHref(elt);
                   userAgent.displayMessage(href);
               }
  -            evt.stopPropagation();
           }
       }
   
  @@ -145,11 +172,15 @@
           }
   
           public void handleEvent(Event evt) {
  +            // No need to set the cursor on out events: this is taken care of
  +            // by the BridgeContext
  +            
  +            // Hide the href in the userAgent
               SVGAElement elt = (SVGAElement)evt.getCurrentTarget();
  -            Cursor cursor = Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR);
  -            userAgent.setSVGCursor(cursor);
  -            userAgent.displayMessage("");
  -            evt.stopPropagation();
  +            if (elt != null) {
  +                String href = XLinkSupport.getXLinkHref(elt);
  +                userAgent.displayMessage("");
  +            }
           }
       }
   }
  
  
  
  1.52      +3 -1      xml-batik/sources/org/apache/batik/bridge/SVGImageElementBridge.java
  
  Index: SVGImageElementBridge.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/bridge/SVGImageElementBridge.java,v
  retrieving revision 1.51
  retrieving revision 1.52
  diff -u -r1.51 -r1.52
  --- SVGImageElementBridge.java	25 Sep 2002 17:20:31 -0000	1.51
  +++ SVGImageElementBridge.java	12 Nov 2002 09:51:34 -0000	1.52
  @@ -379,6 +379,8 @@
   
           SVGSVGElement svgElement = imgDocument.getRootElement();
           GraphicsNode node = ctx.getGVTBuilder().build(ctx, svgElement);
  +        ctx.addUIEventListeners(imgDocument);
  +
           // HACK: remove the clip set by the SVGSVGElement as the overflow
           // and clip properties must be ignored. The clip will be set later
           // using the overflow and clip of the <image> element.
  
  
  
  1.71      +1 -9      xml-batik/sources/org/apache/batik/bridge/SVGTextElementBridge.java
  
  Index: SVGTextElementBridge.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/bridge/SVGTextElementBridge.java,v
  retrieving revision 1.70
  retrieving revision 1.71
  diff -u -r1.70 -r1.71
  --- SVGTextElementBridge.java	27 Aug 2002 13:17:44 -0000	1.70
  +++ SVGTextElementBridge.java	12 Nov 2002 09:51:34 -0000	1.71
  @@ -740,14 +740,6 @@
                       target.addEventListener(SVG_EVENT_CLICK, l, false);
                       ctx.storeEventListener(target, SVG_EVENT_CLICK, l, false);
                       
  -                    l = new SVGAElementBridge.CursorMouseOverListener(ua);
  -                    target.addEventListener(SVG_EVENT_MOUSEOVER, l, false);
  -                    ctx.storeEventListener(target, SVG_EVENT_MOUSEOVER, l, false);
  -
  -                    l = new SVGAElementBridge.CursorMouseOutListener(ua);
  -                    target.addEventListener(SVG_EVENT_MOUSEOUT, l, false);
  -                    ctx.storeEventListener(target, SVG_EVENT_MOUSEOUT, l, false);
  -
                       fillAttributedStringBuffer(ctx,
                                                  nodeElement,
                                                  false,
  
  
  
  1.26      +50 -1     xml-batik/sources/org/apache/batik/bridge/SVGUseElementBridge.java
  
  Index: SVGUseElementBridge.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/bridge/SVGUseElementBridge.java,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- SVGUseElementBridge.java	21 Jun 2002 14:20:40 -0000	1.25
  +++ SVGUseElementBridge.java	12 Nov 2002 09:51:34 -0000	1.26
  @@ -28,6 +28,9 @@
   import org.w3c.dom.NamedNodeMap;
   import org.w3c.dom.Node;
   import org.w3c.dom.css.ViewCSS;
  +import org.w3c.dom.events.Event;
  +import org.w3c.dom.events.EventListener;
  +import org.w3c.dom.events.EventTarget;
   import org.w3c.dom.events.MutationEvent;
   
   /**
  @@ -214,6 +217,52 @@
        */
       public boolean isComposite() {
           return false;
  +    }
  +
  +    /**
  +     * Builds using the specified BridgeContext and element, the
  +     * specified graphics node.
  +     *
  +     * @param ctx the bridge context to use
  +     * @param e the element that describes the graphics node to build
  +     * @param node the graphics node to build
  +     */
  +    public void buildGraphicsNode(BridgeContext ctx,
  +                                  Element e,
  +                                  GraphicsNode node) {
  +
  +        super.buildGraphicsNode(ctx, e, node);
  +
  +        EventTarget target = (EventTarget)e;
  +
  +        EventListener l = new CursorMouseOverListener(ctx.getUserAgent());
  +        target.addEventListener(SVG_EVENT_MOUSEOVER, l, false);
  +        ctx.storeEventListener(target, SVG_EVENT_MOUSEOVER, l, false);
  +
  +    }
  +
  +    /**
  +     * To handle a mouseover on an anchor and set the cursor.
  +     */
  +    public static class CursorMouseOverListener implements EventListener {
  +
  +        protected UserAgent userAgent;
  +
  +        public CursorMouseOverListener(UserAgent ua) {
  +            userAgent = ua;
  +        }
  +
  +        public void handleEvent(Event evt) {
  +            //
  +            // Only modify the cursor if the current target's (i.e., the <use>) cursor 
  +            // property is *not* 'auto'.
  +            //
  +            String cursorStr = CSSUtilities.convertCursor((Element)evt.getCurrentTarget());
  +            
  +            if (!SVG_AUTO_VALUE.equalsIgnoreCase(cursorStr)) {
  +                userAgent.setSVGCursor(CursorManager.getCursor(cursorStr));
  +            }
  +        }
       }
   
       // BridgeUpdateHandler implementation //////////////////////////////////
  
  
  
  1.1                  xml-batik/sources/org/apache/batik/bridge/CursorManager.java
  
  Index: CursorManager.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.bridge;
  
  import java.awt.Cursor;
  
  import java.util.Map;
  import java.util.Hashtable;
  
  import org.apache.batik.util.SVGConstants;
  
  /**
   * The CursorManager class is a helper class which preloads the cursors 
   * corresponding to the SVG built in cursors.
   *
   * @author <a href="mailto:vincent.hardy@sun.com">Vincent Hardy</a>
   * @version $Id: CursorManager.java,v 1.1 2002/11/12 09:51:34 vhardy Exp $
   */
  public class CursorManager implements SVGConstants {
      /**
       * Maps SVG Cursor Values to Java Cursors
       */
      protected static Map cursorMap;
  
      /**
       * Default cursor when value is not found
       */
      public static final Cursor DEFAULT_CURSOR 
          = Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR);
  
      /**
       * Cursor used over anchors
       */
      public static final Cursor ANCHOR_CURSOR
          = Cursor.getPredefinedCursor(Cursor.HAND_CURSOR);
  
      /**
       * Cursor used over text
       */
      public static final Cursor TEXT_CURSOR
          = Cursor.getPredefinedCursor(Cursor.TEXT_CURSOR);
  
      /**
       * Static initialization of the cursorMap
       */
      static {
          cursorMap = new Hashtable();
          cursorMap.put(SVG_CROSSHAIR_VALUE,
                        Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR));
          cursorMap.put(SVG_DEFAULT_VALUE,
                        Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
          cursorMap.put(SVG_POINTER_VALUE,
                        Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
          cursorMap.put(SVG_MOVE_VALUE,
                        Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR));
          cursorMap.put(SVG_E_RESIZE_VALUE,
                        Cursor.getPredefinedCursor(Cursor.E_RESIZE_CURSOR));
          cursorMap.put(SVG_NE_RESIZE_VALUE,
                        Cursor.getPredefinedCursor(Cursor.NE_RESIZE_CURSOR));
          cursorMap.put(SVG_NW_RESIZE_VALUE,
                        Cursor.getPredefinedCursor(Cursor.NW_RESIZE_CURSOR));
          cursorMap.put(SVG_N_RESIZE_VALUE,
                        Cursor.getPredefinedCursor(Cursor.N_RESIZE_CURSOR));
          cursorMap.put(SVG_SE_RESIZE_VALUE,
                        Cursor.getPredefinedCursor(Cursor.SE_RESIZE_CURSOR));
          cursorMap.put(SVG_SW_RESIZE_VALUE,
                        Cursor.getPredefinedCursor(Cursor.SW_RESIZE_CURSOR));
          cursorMap.put(SVG_S_RESIZE_VALUE,
                        Cursor.getPredefinedCursor(Cursor.S_RESIZE_CURSOR));
          cursorMap.put(SVG_W_RESIZE_VALUE,
                        Cursor.getPredefinedCursor(Cursor.W_RESIZE_CURSOR));
          cursorMap.put(SVG_TEXT_VALUE,
                        Cursor.getPredefinedCursor(Cursor.TEXT_CURSOR));
          cursorMap.put(SVG_WAIT_VALUE,
                        Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
          cursorMap.put(SVG_HELP_VALUE, 
                        Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));  
          
      }
  
      /**
       * Returns a Cursor object for a given cursor value. This initial implementation
       * does not handle user-defined cursors, so it always uses the cursor at the 
       * end of the list
       */
      public static Cursor getCursor(String cursorName){
          Cursor c = (Cursor)cursorMap.get(cursorName);
          return c != null ? c : DEFAULT_CURSOR;
      }
      
  }
  
  
  
  1.6       +14 -1     xml-batik/sources/org/apache/batik/script/Interpreter.java
  
  Index: Interpreter.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/script/Interpreter.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- Interpreter.java	30 Apr 2002 15:05:18 -0000	1.5
  +++ Interpreter.java	12 Nov 2002 09:51:35 -0000	1.6
  @@ -23,6 +23,19 @@
    */
   public interface Interpreter extends org.apache.batik.i18n.Localizable {
       /**
  +     * This method should evaluate a piece of script associated to a given 
  +     * description.
  +     *
  +     * @param scriptreader a <code>java.io.Reader</code> on the piece of script
  +     * @param description description which can be later used (e.g., for error 
  +     *        messages).
  +     * @return if no exception is thrown during the call, should return the
  +     * value of the last expression evaluated in the script
  +     */
  +    public Object evaluate(Reader scriptreader, String description)
  +        throws InterpreterException, IOException;
  +
  +    /**
        * This method should evaluate a piece of script.
        *
        * @param scriptreader a <code>java.io.Reader</code> on the piece of script
  
  
  
  1.6       +5 -1      xml-batik/sources/org/apache/batik/script/jacl/JaclInterpreter.java
  
  Index: JaclInterpreter.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/script/jacl/JaclInterpreter.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- JaclInterpreter.java	23 Aug 2002 09:14:59 -0000	1.5
  +++ JaclInterpreter.java	12 Nov 2002 09:51:35 -0000	1.6
  @@ -37,6 +37,10 @@
   
       public Object evaluate(Reader scriptreader)
           throws InterpreterException, IOException {
  +        return evaluate(scriptreader, "");
  +    }
  +
  +    public Object evaluate(Reader scriptreader, String description) {
           // oups jacl doesn't accept reader in its eval method :-(
           StringBuffer sbuffer = new StringBuffer();
           char[] buffer = new char[1024];
  
  
  
  1.6       +7 -1      xml-batik/sources/org/apache/batik/script/jpython/JPythonInterpreter.java
  
  Index: JPythonInterpreter.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/script/jpython/JPythonInterpreter.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- JPythonInterpreter.java	15 Feb 2002 08:58:24 -0000	1.5
  +++ JPythonInterpreter.java	12 Nov 2002 09:51:35 -0000	1.6
  @@ -33,6 +33,12 @@
   
       public Object evaluate(Reader scriptreader)
           throws InterpreterException, IOException {
  +        return evaluate(scriptreader, "");
  +    }
  +
  +    public Object evaluate(Reader scriptreader, String description)
  +        throws InterpreterException, IOException {
  +
           // oups jpython doesn't accept reader in its eval method :-(
           StringBuffer sbuffer = new StringBuffer();
           char[] buffer = new char[1024];
  
  
  
  1.5       +6 -4      xml-batik/sources/org/apache/batik/script/rhino/RhinoClassLoader.java
  
  Index: RhinoClassLoader.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/script/rhino/RhinoClassLoader.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- RhinoClassLoader.java	8 Jul 2002 11:54:02 -0000	1.4
  +++ RhinoClassLoader.java	12 Nov 2002 09:51:35 -0000	1.5
  @@ -52,15 +52,17 @@
       /**
        * Constructor.
        * @param documentURL the URL from which to load classes and resources 
  +     * @param parent the parent class loader for delegation 
        */
  -    public RhinoClassLoader(URL documentURL){
  -        super(documentURL != null ? new URL[]{documentURL} : new URL[]{});
  +    public RhinoClassLoader(URL documentURL, ClassLoader parent){
  +        super(documentURL != null ? new URL[]{documentURL} : new URL[]{},
  +              parent);
           // super(new URL[]{});
           this.documentURL = documentURL;
           if (documentURL != null){
               codeSource = new CodeSource(documentURL, null);
           }
  -         
  +        
           //
           // Create the Rhino ProtectionDomain
           // and AccessControlContext
  
  
  
  1.22      +18 -3     xml-batik/sources/org/apache/batik/script/rhino/RhinoInterpreter.java
  
  Index: RhinoInterpreter.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/script/rhino/RhinoInterpreter.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- RhinoInterpreter.java	6 Nov 2002 14:43:27 -0000	1.21
  +++ RhinoInterpreter.java	12 Nov 2002 09:51:35 -0000	1.22
  @@ -130,7 +130,8 @@
        * @see org.apache.batik.script.InterpreterPool
        */
       public RhinoInterpreter(URL documentURL) {
  -        rhinoClassLoader = new RhinoClassLoader(documentURL);
  +        rhinoClassLoader = new RhinoClassLoader(documentURL,
  +                                                getClass().getClassLoader());
   
           Context.setCachingEnabled(false); // reset the cache
           Context.setCachingEnabled(true);  // enable caching again
  @@ -203,6 +204,20 @@
        */
       public Object evaluate(Reader scriptreader)
           throws InterpreterException, IOException {
  +        return evaluate(scriptreader, SOURCE_NAME_SVG);
  +    }
  +
  +    /**
  +     * This method evaluates a piece of ECMAScript.
  +     * @param scriptreader a <code>java.io.Reader</code> on the piece of script
  +     * @param description description which can be later used (e.g., for error 
  +     *        messages).
  +     * @return if no exception is thrown during the call, should return the
  +     * value of the last expression evaluated in the script.
  +     */
  +    public Object evaluate(Reader scriptreader, String description)
  +        throws InterpreterException, IOException {
  +
           Object rv = null;
           Context ctx = enterContext();
   
  @@ -210,7 +225,7 @@
           try {
               rv = ctx.evaluateReader(globalObject,
                                       scriptreader,
  -                                    SOURCE_NAME_SVG,
  +                                    description,
                                       1, rhinoClassLoader);
           } catch (JavaScriptException e) {
               // exception from JavaScript (possibly wrapping a Java Ex)
  
  
  
  1.68      +18 -3     xml-batik/sources/org/apache/batik/util/SVGConstants.java
  
  Index: SVGConstants.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/util/SVGConstants.java,v
  retrieving revision 1.67
  retrieving revision 1.68
  diff -u -r1.67 -r1.68
  --- SVGConstants.java	14 Jun 2002 12:08:23 -0000	1.67
  +++ SVGConstants.java	12 Nov 2002 09:51:35 -0000	1.68
  @@ -591,7 +591,9 @@
       String SVG_B_VALUE = "B";
       String SVG_COMPOSITE_VALUE = "composite";
       String SVG_CRISP_EDGES_VALUE = "crispEdges";
  +    String SVG_CROSSHAIR_VALUE = "crosshair";
       String SVG_DARKEN_VALUE = "darken";
  +    String SVG_DEFAULT_VALUE = "default";
       String SVG_DIGIT_ONE_VALUE = "1";
       String SVG_DILATE_VALUE = "dilate";
       String SVG_DISABLE_VALUE = "disable";
  @@ -601,6 +603,7 @@
       String SVG_ERODE_VALUE = "erode";
       String SVG_EVEN_ODD_VALUE = "evenodd";
       String SVG_EXACT_VALUE = "exact";
  +    String SVG_E_RESIZE_VALUE = "e-resize";
       String SVG_FALSE_VALUE = "false";
       String SVG_FILL_PAINT_VALUE = "FillPaint";
       String SVG_FLOOD_VALUE = "flood";
  @@ -608,12 +611,13 @@
       String SVG_GAMMA_VALUE = "gamma";
       String SVG_GEOMETRIC_PRECISION_VALUE = "geometricPrecision";
       String SVG_G_VALUE = "G";
  -    String SVG_H_VALUE = "h";
  +    String SVG_HELP_VALUE = "help";
       String SVG_HUE_ROTATE_VALUE = "hueRotate";
       String SVG_HUNDRED_PERCENT_VALUE = "100%";
  +    String SVG_H_VALUE = "h";
       String SVG_IDENTITY_VALUE = "identity";
  -    String SVG_IN_VALUE = "in";
       String SVG_INITIAL_VALUE = "initial";
  +    String SVG_IN_VALUE = "in";
       String SVG_ISOLATED_VALUE = "isolated";
       String SVG_ITALIC_VALUE = "italic";
       String SVG_LIGHTEN_VALUE = "lighten";
  @@ -626,13 +630,17 @@
       String SVG_MEDIAL_VALUE = "medial";
       String SVG_MIDDLE_VALUE = "middle";
       String SVG_MITER_VALUE = "miter";
  +    String SVG_MOVE_VALUE = "move";
       String SVG_MULTIPLY_VALUE = "multiply";
       String SVG_NEW_VALUE = "new";
  +    String SVG_NE_RESIZE_VALUE = "ne-resize";
       String SVG_NINETY_VALUE = "90";
       String SVG_NONE_VALUE = "none";
       String SVG_NON_ZERO_VALUE = "nonzero";
       String SVG_NORMAL_VALUE = "normal";
       String SVG_NO_STITCH_VALUE = "noStitch";
  +    String SVG_NW_RESIZE_VALUE = "nw-resize";
  +    String SVG_N_RESIZE_VALUE = "n-resize";
       String SVG_OBJECT_BOUNDING_BOX_VALUE = "objectBoundingBox";
       String SVG_OBLIQUE_VALUE = "oblique";
       String SVG_ONE_VALUE = "1";
  @@ -645,6 +653,7 @@
       String SVG_PACED_VALUE = "paced";
       String SVG_PAD_VALUE = "pad";
       String SVG_PERCEPTUAL_VALUE = "perceptual";
  +    String SVG_POINTER_VALUE = "pointer";
       String SVG_PRESERVE_VALUE = "preserve";
       String SVG_REFLECT_VALUE = "reflect";
       String SVG_RELATIVE_COLORIMETRIC_VALUE = "relative-colorimetric";
  @@ -654,6 +663,7 @@
       String SVG_SATURATE_VALUE = "saturate";
       String SVG_SATURATION_VALUE = "saturation";
       String SVG_SCREEN_VALUE = "screen";
  +    String SVG_SE_RESIZE_VALUE = "se-resize";
       String SVG_SOURCE_ALPHA_VALUE = "SourceAlpha";
       String SVG_SOURCE_GRAPHIC_VALUE = "SourceGraphic";
       String SVG_SPACING_AND_GLYPHS_VALUE = "spacingAndGlyphs";
  @@ -665,14 +675,19 @@
       String SVG_STRETCH_VALUE = "stretch";
       String SVG_STROKE_PAINT_VALUE = "StrokePaint";
       String SVG_STROKE_WIDTH_VALUE = "strokeWidth";
  +    String SVG_SW_RESIZE_VALUE = "sw-resize";
  +    String SVG_S_RESIZE_VALUE = "s-resize";
       String SVG_TABLE_VALUE = "table";
       String SVG_TERMINAL_VALUE = "terminal";
  +    String SVG_TEXT_VALUE = "text";
       String SVG_TRANSLATE_VALUE = "translate";
       String SVG_TRUE_VALUE = "true";
       String SVG_TURBULENCE_VALUE = "turbulence";
       String SVG_USER_SPACE_ON_USE_VALUE = "userSpaceOnUse";
       String SVG_V_VALUE = "v";
  +    String SVG_WAIT_VALUE = "wait";
       String SVG_WRAP_VALUE = "wrap";
  +    String SVG_W_RESIZE_VALUE = "w-resize";
       String SVG_XOR_VALUE = "xor";
       String SVG_ZERO_PERCENT_VALUE = "0%";
       String SVG_ZERO_VALUE = "0";
  
  
  
  1.12      +6 -0      xml-batik/resources/org/apache/batik/bridge/resources/Messages.properties
  
  Index: Messages.properties
  ===================================================================
  RCS file: /home/cvs/xml-batik/resources/org/apache/batik/bridge/resources/Messages.properties,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- Messages.properties	14 Jun 2002 13:12:25 -0000	1.11
  +++ Messages.properties	12 Nov 2002 09:51:35 -0000	1.12
  @@ -88,3 +88,9 @@
   NoLoadExternalResourceSecurity.error.no.external.resource.allowed = \
   The security settings do not allow any external resources to be referenced from the document
   
  +##########################################################################
  +# Messages for BaseScriptingEnvironment
  +##########################################################################
  +
  +BaseScriptingEnvironment.constant.inline.script.description = \
  +Inline Script
  
  
  
  1.3       +13 -0     xml-batik/resources/org/apache/batik/dom/svg/resources/dtdids.properties
  
  Index: dtdids.properties
  ===================================================================
  RCS file: /home/cvs/xml-batik/resources/org/apache/batik/dom/svg/resources/dtdids.properties,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- dtdids.properties	14 Nov 2001 16:21:31 -0000	1.2
  +++ dtdids.properties	12 Nov 2002 09:51:35 -0000	1.3
  @@ -9,3 +9,16 @@
       -//W3C//DTD SVG 20001102//EN\
       -//W3C//DTD SVG 20000802//EN\
       -//W3C//DTD SVG 20000303 Stylable//EN
  +
  +#    -//W3C//DTD SVG 1.1//EN\
  +#    -//W3C//DTD SVG 1.1 Basic//EN\
  +#    -//W3C//DTD SVG 1.1 Tiny//EN
  +
  +systemId.-//W3C//DTD_SVG_1.0//EN = resources/svg10.dtd
  +systemId.-//W3C//DTD_SVG_20010904//EN = resources/svg10.dtd
  +systemId.-//W3C//DTD_SVG_20001102//EN = resources/svg10.dtd
  +systemId.-//W3C//DTD_SVG_20000802//EN = resources/svg10.dtd
  +
  +# systemId.-//W3C//DTD_SVG_1.1//EN = resources/svg11-flat.dtd
  +# systemId.-//W3C//DTD_SVG_1.1_Basic//EN = resources/svg11-basic-flat.dtd
  +# systemId.-//W3C//DTD_SVG_1.1_Tiny//EN = resources/svg11-tiny-flat.dtd
  
  
  
  1.2       +108 -5    xml-batik/samples/tests/spec/interactivity/cursor.svg
  
  Index: cursor.svg
  ===================================================================
  RCS file: /home/cvs/xml-batik/samples/tests/spec/interactivity/cursor.svg,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- cursor.svg	26 Feb 2002 09:33:35 -0000	1.1
  +++ cursor.svg	12 Nov 2002 09:51:35 -0000	1.2
  @@ -20,22 +20,23 @@
   <?xml-stylesheet type="text/css" href="../../resources/style/test.css" ?>
   
   <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"  
  -     id="body" width="450" height="500" viewBox="0 0 450 500">
  +     id="body" width="450" height="500" viewBox="0 0 450 500" >
   
       <text class="title" x="50%" y="50">Cursor Property</text>
   
       <defs>
  -        <rect x="-50" y="-16" width="100" height="20" id="cell"/>
  +        <rect x="-95" y="-16" width="190" height="20" id="cell"/>
           <g id="row">
               <use xlink:href="#cell" />
  -            <rect x="50" y="-16" width="20" height="20" fill="gold" stroke="black" />
           </g>
   
           <use id="oddRow" xlink:href="#row" stroke="black" fill="white" />
           <use id="evenRow" xlink:href="#row" stroke="black" fill="#eeeeee" />
  +        <use id="oddRowCursor" xlink:href="#row" stroke="black" fill="crimson" cursor="wait"/>
  +        <use id="evenRowCursor" xlink:href="#row" stroke="black" fill="gold" cursor="wait"/>
       </defs>
   
  -    <g transform="translate(200, 150) scale(1.5)" class="label" text-anchor="middle">
  +    <g transform="translate(120, 120)" class="label" text-anchor="middle">
           <use xlink:href="#oddRow" cursor="auto"/>
           <text>auto</text>
           <g transform="translate(0,20)" cursor="crosshair">
  @@ -66,6 +67,108 @@
               <use xlink:href="#evenRow"/>
               <text>help</text>
           </g>
  +        <a cursor="auto"><g transform="translate(0,160)">
  +            <use xlink:href="#oddRow"/>
  +            <text>&lt;a&gt; cursor=auto</text>
  +        </g></a>
  +        <a cursor="wait"><g transform="translate(0,180)">
  +            <use xlink:href="#evenRow"/>
  +            <text>&lt;a&gt; cursor=wait</text>
  +        </g></a>
  +        <g transform="translate(0,200)">
  +            <use xlink:href="#oddRow"/>
  +            <text cursor="auto">&lt;text&gt; cursor=auto</text>
  +        </g>
  +        <g transform="translate(0,220)">
  +            <use xlink:href="#evenRow"/>
  +            <text cursor="wait">&lt;text&gt; cursor=wait</text>
  +        </g>
  +        <a cursor="auto"><g transform="translate(0,240)">
  +            <use xlink:href="#oddRow"/>
  +            <text>&lt;a&gt;.. &lt;text /&gt;.. &lt;a&gt; cursor=auto</text>
  +        </g></a>
  +        <g transform="translate(0,260)">
  +            <use xlink:href="#evenRow"/>
  +            <a cursor="crosshair"><text>&lt;a&gt; &lt;text /&gt; &lt;a&gt; cursor=crosshair</text></a>
  +        </g>
  +        <g transform="translate(0,280)">
  +            <use xlink:href="#oddRow"/>
  +            <text cursor="auto">&lt;text&gt;<a fill="blue">&lt;a/&gt;</a>&lt;text&gt; cursor=auto</text>
  +        </g>
  +        <g transform="translate(0,300)">
  +            <use xlink:href="#evenRow"/>
  +            <text cursor="wait">&lt;text&gt;<a fill="blue">&lt;a/&gt;</a>&lt;text&gt; cursor=wait</text>
  +        </g>
  +    </g>
  +
  +
  +    <g transform="translate(330, 120)" class="label" text-anchor="middle">
  +        <use xlink:href="#oddRow" cursor="e-resize"/>
  +        <text>e-resize</text>
  +
  +        <g transform="translate(0,20)" cursor="w-resize">
  +            <use xlink:href="#evenRow"/>
  +            <text>w-resize</text>
  +        </g>
  +        <g transform="translate(0,40)" cursor="ne-resize">
  +            <use xlink:href="#oddRow"/>
  +            <text>ne-resize</text>
  +        </g>
  +        <g transform="translate(0,60)" cursor="nw-resize">
  +            <use xlink:href="#evenRow"/>
  +            <text>nw-resize</text>
  +        </g>
  +        <g transform="translate(0,80)" cursor="n-resize">
  +            <use xlink:href="#oddRow"/>
  +            <text>n-resize</text>
  +        </g>
  +        <g transform="translate(0,100)" cursor="se-resize">
  +            <use xlink:href="#evenRow"/>
  +            <text>se-resize</text>
  +        </g>
  +        <g transform="translate(0,120)" cursor="sw-resize">
  +            <use xlink:href="#oddRow"/>
  +            <text>sw-resize</text>
  +        </g>
  +        <g transform="translate(0,140)" cursor="s-resize">
  +            <use xlink:href="#evenRow"/>
  +            <text>s-resize</text>
  +        </g>
  +        <g transform="translate(0,160)" cursor="url(#badCustom), crosshair">
  +            <use xlink:href="#oddRow"/>
  +            <text>Bad url, crosshair</text>
  +        </g>
  +        <g transform="translate(0,180)" cursor="url(#customCursor), wait">
  +            <use xlink:href="#evenRow"/>
  +            <text>Good url, wait</text>
  +        </g>
  +        <g transform="translate(0,200)" cursor="url(#badCustom), url(#customCursor), crosshair">
  +            <use xlink:href="#oddRow"/>
  +            <text>Bad url, good url, crosshair</text>
  +        </g>
  +
  +        <g transform="translate(0,220)">
  +            <use xlink:href="#evenRow"/>
  +            <use xlink:href="#evenRowCursor" cursor="auto"/>
  +            <text>&lt;use cursor=auto (wait)&gt;</text>
  +        </g>
  +        <g transform="translate(0,240)">
  +            <use xlink:href="#oddRow"/>
  +            <use xlink:href="#oddRowCursor" cursor="crosshair" />
  +            <text>&lt;use cursor=crosshair&gt;</text>
  +        </g>
  +
  +        <g transform="translate(0,260)">
  +            <use xlink:href="#evenRow"/>
  +            <image x="-93" y="-14" width="186" height="16" xlink:href="cursorImage2.svg" cursor="auto"/>
  +            <text>&lt;image cursor=auto (wait)&gt;</text>
  +        </g>
  +        <g transform="translate(0,280)">
  +            <use xlink:href="#oddRow"/>
  +            <image x="-93" y="-14" width="186" height="16" xlink:href="cursorImage.svg" cursor="crosshair"/>
  +            <text>&lt;use cursor=crosshair&gt;</text>
  +        </g>
  +    
       </g>
   
   
  
  
  
  1.1                  xml-batik/samples/tests/spec/interactivity/cursorImage.svg
  
  Index: cursorImage.svg
  ===================================================================
  <svg  xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"  
       id="body" width="186" height="16" viewBox="0 0 186 16" >
      <rect x="0" y="0" width="186" height="16" fill="crimson" cursor="wait" />
  </svg>
  
  
  1.1                  xml-batik/samples/tests/spec/interactivity/cursorImage2.svg
  
  Index: cursorImage2.svg
  ===================================================================
  <svg  xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"  
       id="body" width="186" height="16" viewBox="0 0 186 16" >
      <rect x="0" y="0" width="186" height="16" fill="gold" cursor="wait" />
  </svg>
  
  

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