deweese     2003/06/11 15:07:28

  Modified:    .        build.xml
               samples/tests/spec/interactivity cursor.svg
               samples/tests/spec/scripting xyModifOnLoad.svg
               sources/org/apache/batik/bridge
                        AbstractGraphicsNodeBridge.java
                        BaseScriptingEnvironment.java BridgeContext.java
                        BridgeEventSupport.java GVTBuilder.java
                        SVGAElementBridge.java SVGImageElementBridge.java
                        SVGSVGElementBridge.java
                        SVGSwitchElementBridge.java
                        SVGTextElementBridge.java SVGUseElementBridge.java
                        ScriptingEnvironment.java ViewBox.java
               sources/org/apache/batik/css/engine CSSContext.java
                        CSSEngine.java
               sources/org/apache/batik/extension/svg
                        BatikMultiImageElementBridge.java
                        SVGFlowTextElementBridge.java
               sources/org/apache/batik/swing JSVGCanvas.java
               sources/org/apache/batik/swing/svg JSVGComponent.java
               sources/org/apache/batik/transcoder
                        SVGAbstractTranscoder.java
  Added:       test-references/samples/extensions/opera .cvsignore
                        opera-subImage.png opera-subImageRef.png
  Log:
  1) JSVGComponent/BridgeContext now has three levels of interactivity.
     STATIC - No Event listeners are registered on any elements.
              The GVT tree is independent of the SVGDocument,
              however the Document is still kept in the JSVGComponent
              because of publicly used methods like 'getSVGDocument' on
              JSVGComponent. Elements and Graphics Nodes are not 'bound'
              in the Bridge Context.
     INTERACTIVE - Event listeners are registered for user 'interaction'
                   This includes, anchors (linking), and cursors.
                   In this mode however Bridges are not cloned for each element
                   as they are for DYNAMIC.  Because DOM events are used the
                   Document and Bridge Context is required. Elements
                   and Graphics Nodes are 'bound' in the BridgeContext.
     DYNAMIC - Event listeners are registered for essentially all DOM events.
               In this mode Bridges are cloned for each element (this
               is needed to support the SVG DOM and other things).  Elements
               and Graphics Nodes are 'bound' in the BridgeContext. The
               Document and Bridge context is required.
  
     One note on autodetect.  It useually gets it right but if only
  cursors are use and they are only present in 'style' attributes or
  in stylesheets it won't detect that the document is INTERACTIVE.  This
  is really hard to fix as the decision on state needs to be made before
  the CSS Engine is booted.
  
  2) Script interpreters are now lazily evaluated.  This means that unless you
     use them (by having event attributes set) you don't need any script
     engines.
  
  Revision  Changes    Path
  1.129     +4 -1      xml-batik/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/xml-batik/build.xml,v
  retrieving revision 1.128
  retrieving revision 1.129
  diff -u -r1.128 -r1.129
  --- build.xml 19 May 2003 12:49:25 -0000      1.128
  +++ build.xml 11 Jun 2003 22:07:23 -0000      1.129
  @@ -1033,6 +1033,9 @@
       <mkdir dir="${test-references}/samples/extensions/accepted-variation"/>
       <mkdir dir="${test-references}/samples/extensions/candidate-variation"/>
       <mkdir dir="${test-references}/samples/extensions/candidate-reference"/>
  +    <mkdir dir="${test-references}/samples/extensions/opera/accepted-variation"/>
  +    <mkdir dir="${test-references}/samples/extensions/opera/candidate-variation"/>
  +    <mkdir dir="${test-references}/samples/extensions/opera/candidate-reference"/>
       <mkdir dir="${test-references}/svgbe/accepted-variation"/>
       <mkdir dir="${test-references}/svgbe/candidate-variation"/>
       <mkdir dir="${test-references}/svgbe/candidate-reference"/>
  
  
  
  1.4       +6 -6      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.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- cursor.svg        14 Nov 2002 14:57:23 -0000      1.3
  +++ cursor.svg        11 Jun 2003 22:07:23 -0000      1.4
  @@ -107,8 +107,10 @@
   
   
       <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,0)" cursor="e-resize">
  +          <use xlink:href="#oddRow"/>
  +          <text>e-resize</text>
  +        </g>
   
           <g transform="translate(0,20)" cursor="w-resize">
               <use xlink:href="#evenRow"/>
  @@ -170,11 +172,9 @@
           <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>
  +            <text>&lt;image cursor=crosshair&gt;</text>
           </g>
  -    
       </g>
  -
   
       <!-- ============================================================= -->
       <!-- Batik sample mark                                             -->
  
  
  
  1.2       +13 -13    xml-batik/samples/tests/spec/scripting/xyModifOnLoad.svg
  
  Index: xyModifOnLoad.svg
  ===================================================================
  RCS file: /home/cvs/xml-batik/samples/tests/spec/scripting/xyModifOnLoad.svg,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- xyModifOnLoad.svg 23 Jan 2002 14:14:07 -0000      1.1
  +++ xyModifOnLoad.svg 11 Jun 2003 22:07:24 -0000      1.2
  @@ -2,20 +2,20 @@
   <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20000802//EN"
   "http://www.w3.org/TR/2000/CR-SVG-20000802/DTD/svg-20000802.dtd";>
   
  -<!-- ========================================================================= -->
  -<!-- 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.                                                         -->
  -<!-- ========================================================================= -->
  +<!-- ====================================================================== -->
  +<!-- 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.                                     -->
  +<!-- ====================================================================== -->
   
  -<!-- ========================================================================= -->
  -<!-- Modification of an element used in a BackgroundImage                      -->
  -<!--                                                                           -->
  -<!-- @author [EMAIL PROTECTED]                                                 -->
  +<!-- ====================================================================== -->
  +<!-- Modification of an element used in a BackgroundImage                   -->
  +<!--                                                                        -->
  +<!-- @author [EMAIL PROTECTED]                                              -->
   <!-- @version $Id$  -->
  -<!-- ========================================================================= -->
  +<!-- ====================================================================== -->
   <?xml-stylesheet type="text/css" href="../../resources/style/test.css" ?>  
   <svg id="body" width="450" height="500" viewBox="0 0 450 500">
       <title>&lt;rect&gt; x modification in 'onload'</title>
  
  
  
  1.31      +15 -8     
xml-batik/sources/org/apache/batik/bridge/AbstractGraphicsNodeBridge.java
  
  Index: AbstractGraphicsNodeBridge.java
  ===================================================================
  RCS file: 
/home/cvs/xml-batik/sources/org/apache/batik/bridge/AbstractGraphicsNodeBridge.java,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- AbstractGraphicsNodeBridge.java   11 Apr 2003 13:54:40 -0000      1.30
  +++ AbstractGraphicsNodeBridge.java   11 Jun 2003 22:07:24 -0000      1.31
  @@ -123,9 +123,8 @@
           // 'pointer-events'
           node.setPointerEventType(CSSUtilities.convertPointerEvents(e));
   
  -        if (ctx.isDynamic()) {
  -            initializeDynamicSupport(ctx, e, node);
  -        }
  +        initializeDynamicSupport(ctx, e, node);
  +
           // Handle children elements such as <title>
           SVGUtilities.bridgeChildren(ctx, e);
       }
  @@ -147,11 +146,19 @@
       protected void initializeDynamicSupport(BridgeContext ctx,
                                               Element e,
                                               GraphicsNode node) {
  -        this.e = e;
  -        this.node = node;
  -        this.ctx = ctx;
  +        if (!ctx.isInteractive())
  +            return;
  +
  +        // Bind the nodes for interactive and dynamic
           ctx.bind(e, node);
  -        ((SVGOMElement)e).setSVGContext(this);
  +
  +        if (ctx.isDynamic()) {
  +            // only set context for dynamic documents not interactive.
  +            this.e = e;
  +            this.node = node;
  +            this.ctx = ctx;
  +            ((SVGOMElement)e).setSVGContext(this);
  +        }
       }
   
       // BridgeUpdateHandler implementation //////////////////////////////////
  
  
  
  1.19      +87 -56    
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.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- BaseScriptingEnvironment.java     11 Apr 2003 13:54:41 -0000      1.18
  +++ BaseScriptingEnvironment.java     11 Jun 2003 22:07:24 -0000      1.19
  @@ -191,6 +191,13 @@
        */
       protected ParsedURL docPURL;
   
  +    protected Set languages = new HashSet();
  +
  +    /**
  +     * The default Interpreter for the document
  +     */
  +    protected Interpreter interpreter;
  +
       /**
        * Creates a new BaseScriptingEnvironment.
        * @param ctx the bridge context
  @@ -218,6 +225,41 @@
       }
   
       /**
  +     * Returns the default Interpreter for this document.
  +     */
  +    public Interpreter getInterpreter() {
  +        if (interpreter != null)
  +            return interpreter;
  +
  +        SVGSVGElement root = (SVGSVGElement)document.getDocumentElement();
  +        String lang = root.getContentScriptType();
  +        return getInterpreter(lang);
  +    }
  +
  +    public Interpreter getInterpreter(String lang) {
  +        interpreter = bridgeContext.getInterpreter(lang);
  +        if (interpreter == null) {
  +            if (languages.contains(lang)) 
  +                // Already issued warning so just return null;
  +                return null;
  +
  +            UserAgent ua = bridgeContext.getUserAgent();
  +            if (ua != null) {
  +                ua.displayError(new Exception("Unknown language: " + lang));
  +            }
  +            // So we know we have processed this interpreter.
  +            languages.add(lang);
  +            return null;
  +        }
  +
  +        if (!languages.contains(lang)) {
  +            languages.add(lang);
  +            initializeEnvironment(interpreter, lang);
  +        }
  +        return interpreter;
  +    }
  +
  +    /**
        * Initializes the environment of the given interpreter.
        */
       public void initializeEnvironment(Interpreter interp, String lang) {
  @@ -238,8 +280,6 @@
               return;
           }
   
  -        Set languages = new HashSet();
  -
           for (int i = 0; i < len; i++) {
               Element script = (Element)scripts.item(i);
               String type = script.getAttributeNS
  @@ -302,20 +342,10 @@
               //
               // Scripting language invocation.
               //
  -            Interpreter interpreter = bridgeContext.getInterpreter(type);
  -
  -            if (interpreter == null) {
  -                UserAgent ua = bridgeContext.getUserAgent();
  -                if (ua != null) {
  -                    ua.displayError(new Exception("Unknown language: "+type));
  -                }
  -                return;
  -            }
  -
  -            if (!languages.contains(type)) {
  -                languages.add(type);
  -                initializeEnvironment(interpreter, type);
  -            }
  +            Interpreter interpreter = getInterpreter(type);
  +            if (interpreter == null)
  +                // Can't find interpreter so just skip this script block.
  +                continue;
   
               try {
                   String href = XLinkSupport.getXLinkHref(script);
  @@ -376,31 +406,22 @@
        * Recursively dispatch the SVG 'onload' event.
        */
       public void dispatchSVGLoadEvent() {
  -        SVGSVGElement root =
  -            (SVGSVGElement)document.getDocumentElement();
  +        SVGSVGElement root = (SVGSVGElement)document.getDocumentElement();
           String lang = root.getContentScriptType();
  -        Interpreter interp = bridgeContext.getInterpreter(lang);
  -        if (interp == null) {
  -            UserAgent ua = bridgeContext.getUserAgent();
  -            if (ua != null) {
  -                ua.displayError(new Exception("Unknown language: " + lang));
  -            }
  -            return;
  -        }
  -
  -        dispatchSVGLoad(root, interp, true, lang);
  +        dispatchSVGLoad(root, true, lang);
       }
   
       /**
        * Auxiliary method for dispatchSVGLoad.
        */
  -    protected void dispatchSVGLoad(Element elt, final Interpreter interp,
  -                                   boolean checkCanRun, String lang) {
  +    protected void dispatchSVGLoad(Element elt, 
  +                                   boolean checkCanRun, 
  +                                   String lang) {
           for (Node n = elt.getFirstChild();
                n != null;
                n = n.getNextSibling()) {
               if (n.getNodeType() == n.ELEMENT_NODE) {
  -                dispatchSVGLoad((Element)n, interp, checkCanRun, lang);
  +                dispatchSVGLoad((Element)n, checkCanRun, lang);
               }
           }
   
  @@ -412,32 +433,42 @@
   
           final String s =
               elt.getAttributeNS(null, SVGConstants.SVG_ONLOAD_ATTRIBUTE);
  -        EventListener l = null;
  -        if (s.length() > 0) {
  -            if (checkCanRun) {
  -                // Check that it is ok to run embeded scripts
  -                checkCompatibleScriptURL(lang, docPURL);
  -                checkCanRun = false; // we only check once for onload handlers
  -            }
  +        if (s.length() == 0) {
  +            // No script to run so just dispatch the event to DOM
  +            // (For java presumably).
  +            t.dispatchEvent(ev);
  +            return;
  +        }
   
  -            l = new EventListener() {
  -                    public void handleEvent(Event evt) {
  -                        try {
  -                            interp.bindObject(EVENT_NAME, evt);
  -                            interp.bindObject(ALTERNATE_EVENT_NAME, evt);
  -                            interp.evaluate(new StringReader(s));
  -                        } catch (IOException io) {
  -                        } catch (InterpreterException e) {
  -                            handleInterpreterException(e);
  -                        }
  -                    }
  -                };
  -            t.addEventListener("SVGLoad", l, false);
  +        final Interpreter interp = getInterpreter();
  +        if (interp == null) {
  +            // Can't load interpreter so just dispatch normal event
  +            // to the DOM (for java presumably).
  +            t.dispatchEvent(ev);
  +            return;
           }
  -        t.dispatchEvent(ev);
  -        if (s.length() > 0) {
  -            t.removeEventListener("SVGLoad", l, false);
  +        
  +        if (checkCanRun) {
  +            // Check that it is ok to run embeded scripts
  +            checkCompatibleScriptURL(lang, docPURL);
  +            checkCanRun = false; // we only check once for onload handlers
           }
  +
  +        EventListener l = new EventListener() {
  +                public void handleEvent(Event evt) {
  +                    try {
  +                        interp.bindObject(EVENT_NAME, evt);
  +                        interp.bindObject(ALTERNATE_EVENT_NAME, evt);
  +                        interp.evaluate(new StringReader(s));
  +                    } catch (IOException io) {
  +                    } catch (InterpreterException e) {
  +                        handleInterpreterException(e);
  +                    }
  +                }
  +            };
  +        t.addEventListener("SVGLoad", l, false);
  +        t.dispatchEvent(ev);
  +        t.removeEventListener("SVGLoad", l, false);
       }
   
       /**
  
  
  
  1.62      +133 -10   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.61
  retrieving revision 1.62
  diff -u -r1.61 -r1.62
  --- BridgeContext.java        28 May 2003 14:40:57 -0000      1.61
  +++ BridgeContext.java        11 Jun 2003 22:07:24 -0000      1.62
  @@ -25,6 +25,7 @@
   import org.apache.batik.css.engine.CSSEngine;
   import org.apache.batik.css.engine.CSSEngineEvent;
   import org.apache.batik.css.engine.CSSEngineListener;
  +import org.apache.batik.css.engine.SVGCSSEngine;
   import org.apache.batik.css.engine.SystemColorSupport;
   import org.apache.batik.css.engine.value.Value;
   import org.apache.batik.dom.svg.SVGContext;
  @@ -35,12 +36,15 @@
   import org.apache.batik.gvt.TextPainter;
   import org.apache.batik.script.Interpreter;
   import org.apache.batik.script.InterpreterPool;
  +import org.apache.batik.util.CSSConstants;
   import org.apache.batik.util.ParsedURL;
   import org.apache.batik.util.SVGConstants;
   import org.apache.batik.util.Service;
   import org.w3c.dom.Document;
   import org.w3c.dom.Element;
   import org.w3c.dom.Node;
  +import org.w3c.dom.css.CSSPrimitiveValue;
  +import org.w3c.dom.css.CSSValue;
   import org.w3c.dom.events.Event;
   import org.w3c.dom.events.EventListener;
   import org.w3c.dom.events.EventTarget;
  @@ -147,9 +151,29 @@
       protected TextPainter textPainter;
   
       /**
  -     * Whether the bridge must support dynamic features.
  +     * Indicates that no DOM listeners should be registered.
  +     * In this case the generated GVT tree should be totally
  +     * independent of the DOM tree.
        */
  -    protected boolean dynamic;
  +    public final static int STATIC      = 0;
  +    /**
  +     * Indicates that DOM listeners should be registered to support,
  +     * 'interactivity' this includes anchors and cursors, but does not
  +     * include support for DOM modifications.
  +     */
  +    public final static int INTERACTIVE = 1;
  +
  +    /**
  +     * Indicates that all DOM listeners should be registered. This supports
  +     * 'interactivity' (anchors and cursors), as well as DOM modifications
  +     * listeners to update the GVT rendering tree.
  +     */
  +    public final static int DYNAMIC     = 2;
  +
  +    /**
  +     * Whether the bridge should support dynamic, or interactive features.
  +     */
  +    protected int dynamicStatus = STATIC;
   
       /**
        * The update manager.
  @@ -399,20 +423,51 @@
        * Returns true if the document is dynamic, false otherwise.
        */
       public boolean isDynamic() {
  -        return dynamic;
  +        return (dynamicStatus == DYNAMIC);
  +    }
  +
  +    /**
  +     * Returns true if the document is interactive, false otherwise.
  +     */
  +    public boolean isInteractive() {
  +        return (dynamicStatus != STATIC);
       }
   
       /**
  -     * Sets the document as a dynamic document. Call this method
  -     * before the build phase (ie. before <tt>gvtBuilder.build(...)</tt>)
  +     * Sets the document as a STATIC, INTERACTIVE or DYNAMIC document. 
  +     * Call this method before the build phase 
  +     * (ie. before <tt>gvtBuilder.build(...)</tt>)
        * otherwise, that will have no effect.
        *
  -     [EMAIL PROTECTED] b the document state
  +     [EMAIL PROTECTED] status the document dynamicStatus
  +     */
  +    public void setDynamicState(int status) {
  +        dynamicStatus = status;
  +    }
  +
  +    /**
  +     * Sets the document as DYNAMIC if <tt>dynamic</tt> is true
  +     * STATIC otherwise.
  +     */
  +    public void setDynamic(boolean dynamic) {
  +        if (dynamic)
  +            setDynamicState(DYNAMIC);
  +        else
  +            setDynamicState(STATIC);
  +    }
  +
  +    /**
  +     * Sets the document as INTERACTIVE if <tt>interactive</tt> is
  +     * true STATIC otherwise.
        */
  -    public void setDynamic(boolean b) {
  -        dynamic = b;
  +    public void setInteractive(boolean interactive) {
  +        if (interactive)
  +            setDynamicState(INTERACTIVE);
  +        else
  +            setDynamicState(STATIC);
       }
   
  +
       /**
        * Returns the update manager, if the bridge supports dynamic features.
        */
  @@ -636,7 +691,7 @@
               return null;
           }
           Bridge bridge = (Bridge)localNameMap.get(localName);
  -        if (dynamic) {
  +        if (isDynamic()) {
               return bridge == null ? null : bridge.getInstance();
           } else {
               return bridge;
  @@ -1156,6 +1211,74 @@
                                               docURL);
       }
   
  +
  +    /**
  +     * Tells whether the given SVG document is dynamic.
  +     */
  +    public static boolean isDynamicDocument(Document doc) {
  +        return BaseScriptingEnvironment.isDynamicDocument(doc);
  +    }
  +    
  +    /**
  +     * Tells whether the given SVG document is Interactive.
  +     * We say it is, if it has any <title>, <desc>, or <a> elements,
  +     * of if the 'cursor' property is anything but Auto on any element.
  +     */
  +    public static boolean isInteractiveDocument(Document doc) {
  +        
  +        Element root = ((SVGDocument)doc).getRootElement();
  +        if (!SVGConstants.SVG_NAMESPACE_URI.equals(root.getNamespaceURI()))
  +            return false;
  +
  +        return checkInteractiveElement(root);
  +    }
  +
  +    public static boolean checkInteractiveElement(Element e) {
  +        String tag = e.getNodeName();
  +
  +        // Check if it's one of our important element.
  +        if (SVGConstants.SVG_A_TAG.equals(tag))
  +            return true;
  +        if (SVGConstants.SVG_TITLE_TAG.equals(tag))
  +            return true;
  +        if (SVGConstants.SVG_DESC_TAG.equals(tag))
  +            return true;
  +        if (SVGConstants.SVG_CURSOR_TAG.equals(tag))
  +            return true;
  +
  +        // I am well aware that this is not 100% accurate but it's
  +        // the best I can do w/o booting the CSSEngine.
  +        if (e.getAttribute(CSSConstants.CSS_CURSOR_PROPERTY).length() >0)
  +            return true;
  +
  +        /* We would like to do this but the CSS Engine isn't setup when
  +           we want to do this.
  +           
  +        // Check if cursor property is set to something other than 'auto'.
  +        Value cursorValue = CSSUtilities.getComputedStyle
  +            (e, SVGCSSEngine.CURSOR_INDEX);
  +        if ((cursorValue != null) &&
  +            (cursorValue.getCssValueType()  == CSSValue.CSS_PRIMITIVE_VALUE) &&
  +            (cursorValue.getPrimitiveType() == CSSPrimitiveValue.CSS_IDENT) &&
  +            (SVGConstants.SVG_AUTO_VALUE.equals(cursorValue.getStringValue())))
  +            return true;
  +        */
  +
  +        // Check all the child elements for any of the above.
  +        final String svg_ns = SVGConstants.SVG_NAMESPACE_URI;
  +        for (Node n = e.getFirstChild();
  +             n != null;
  +             n = n.getNextSibling()) {
  +            if (n.getNodeType() == Node.ELEMENT_NODE) {
  +                Element child = (Element)n;
  +                if (svg_ns.equals(child.getNamespaceURI()))
  +                    if (checkInteractiveElement(child))
  +                        return true;
  +            }
  +        }
  +        return false;
  +    }
  +    
   
       // bridge extensions support //////////////////////////////////////////////
   
  
  
  
  1.48      +5 -3      
xml-batik/sources/org/apache/batik/bridge/BridgeEventSupport.java
  
  Index: BridgeEventSupport.java
  ===================================================================
  RCS file: 
/home/cvs/xml-batik/sources/org/apache/batik/bridge/BridgeEventSupport.java,v
  retrieving revision 1.47
  retrieving revision 1.48
  diff -u -r1.47 -r1.48
  --- BridgeEventSupport.java   11 Apr 2003 13:54:42 -0000      1.47
  +++ BridgeEventSupport.java   11 Jun 2003 22:07:24 -0000      1.48
  @@ -135,8 +135,10 @@
   
           protected void dispatchKeyEvent(String eventType, 
                                           GraphicsNodeKeyEvent evt) {
  -            Element targetElement = 
  -                (Element)context.getFocusManager().getCurrentEventTarget();
  +            FocusManager fmgr = context.getFocusManager();
  +            if (fmgr == null) return;
  +
  +            Element targetElement = (Element)fmgr.getCurrentEventTarget();
               if (targetElement == null) {
                   return;
               }
  
  
  
  1.25      +7 -4      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.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- GVTBuilder.java   11 Apr 2003 13:54:43 -0000      1.24
  +++ GVTBuilder.java   11 Jun 2003 22:07:24 -0000      1.25
  @@ -75,12 +75,15 @@
           }
   
           // For cursor handling
  -        ctx.addUIEventListeners(document);
  +        if (ctx.isInteractive()) {
  +            ctx.addUIEventListeners(document);
   
  -        // <!> FIXME: TO BE REMOVED
  -        if (ctx.isDynamic()) {
               // register GVT listeners for AWT event support
               BridgeEventSupport.addGVTListener(ctx, document);
  +        }
  +
  +        // <!> FIXME: TO BE REMOVED
  +        if (ctx.isDynamic()) {
               // register DOM listeners for dynamic support
               ctx.addDOMListeners();
           }
  
  
  
  1.22      +15 -14    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.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- SVGAElementBridge.java    11 Apr 2003 13:54:44 -0000      1.21
  +++ SVGAElementBridge.java    11 Jun 2003 22:07:24 -0000      1.22
  @@ -67,19 +67,20 @@
   
           super.buildGraphicsNode(ctx, e, node);
   
  -        EventTarget target = (EventTarget)e;
  +        if (ctx.isInteractive()) {
  +            EventTarget target = (EventTarget)e;
  +            EventListener l = new AnchorListener(ctx.getUserAgent());
  +            target.addEventListener(SVG_EVENT_CLICK, l, false);
  +            ctx.storeEventListener(target, SVG_EVENT_CLICK, l, false);
   
  -        EventListener l = new AnchorListener(ctx.getUserAgent());
  -        target.addEventListener(SVG_EVENT_CLICK, l, false);
  -        ctx.storeEventListener(target, SVG_EVENT_CLICK, l, false);
  +            l = new CursorMouseOverListener(ctx.getUserAgent());
  +            target.addEventListener(SVG_EVENT_MOUSEOVER, l, false);
  +            ctx.storeEventListener(target, SVG_EVENT_MOUSEOVER, l, false);
   
  -        l = new CursorMouseOverListener(ctx.getUserAgent());
  -        target.addEventListener(SVG_EVENT_MOUSEOVER, l, false);
  -        ctx.storeEventListener(target, SVG_EVENT_MOUSEOVER, l, false);
  -
  -        l = new CursorMouseOutListener(ctx.getUserAgent());
  -        target.addEventListener(SVG_EVENT_MOUSEOUT, l, false);
  -        ctx.storeEventListener(target, SVG_EVENT_MOUSEOUT, l, false);
  +            l = new CursorMouseOutListener(ctx.getUserAgent());
  +            target.addEventListener(SVG_EVENT_MOUSEOUT, l, false);
  +            ctx.storeEventListener(target, SVG_EVENT_MOUSEOUT, l, false);
  +        }
       }
   
       /**
  
  
  
  1.55      +14 -6     
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.54
  retrieving revision 1.55
  diff -u -r1.54 -r1.55
  --- SVGImageElementBridge.java        7 Jun 2003 17:19:18 -0000       1.54
  +++ SVGImageElementBridge.java        11 Jun 2003 22:07:24 -0000      1.55
  @@ -190,9 +190,10 @@
       protected void initializeDynamicSupport(BridgeContext ctx,
                                               Element e,
                                               GraphicsNode node) {
  -        this.e = e;
  -        this.node = node;
  -        this.ctx = ctx;
  +        if (!ctx.isInteractive())
  +            return;
  +
  +        // Bind the nodes for interactive and dynamic
           // HACK due to the way images are represented in GVT
           ImageNode imgNode = (ImageNode)node;
           if (imgNode.getImage() instanceof RasterImageNode) {
  @@ -201,7 +202,14 @@
           } else {
               ctx.bind(e, node);
           }
  -        ((SVGOMElement)e).setSVGContext(this);
  +
  +        if (ctx.isDynamic()) {
  +            // Only do this for dynamic not interactive.
  +            this.e = e;
  +            this.node = node;
  +            this.ctx = ctx;
  +            ((SVGOMElement)e).setSVGContext(this);
  +        }
       }
   
       // BridgeUpdateHandler implementation //////////////////////////////////
  @@ -396,7 +404,7 @@
           // add a listener on the outermost svg element of the SVG image.
           // if an event occured inside the SVG image document, send it
           // to the <image> element (inside the original document).
  -        if (ctx.isDynamic()) {
  +        if (ctx.isInteractive()) {
               EventListener listener = new ForwardEventListener(svgElement, e);
               EventTarget target = (EventTarget)svgElement;
   
  
  
  
  1.35      +3 -4      
xml-batik/sources/org/apache/batik/bridge/SVGSVGElementBridge.java
  
  Index: SVGSVGElementBridge.java
  ===================================================================
  RCS file: 
/home/cvs/xml-batik/sources/org/apache/batik/bridge/SVGSVGElementBridge.java,v
  retrieving revision 1.34
  retrieving revision 1.35
  diff -u -r1.34 -r1.35
  --- SVGSVGElementBridge.java  7 Jun 2003 17:19:18 -0000       1.34
  +++ SVGSVGElementBridge.java  11 Jun 2003 22:07:25 -0000      1.35
  @@ -195,9 +195,8 @@
       public void buildGraphicsNode(BridgeContext ctx,
                                     Element e,
                                     GraphicsNode node) {
  -        if (ctx.isDynamic()) {
  -            initializeDynamicSupport(ctx, e, node);
  -        }
  +        initializeDynamicSupport(ctx, e, node);
  +
           // Handle children elements such as <title>
           //SVGUtilities.bridgeChildren(ctx, e);
           //super.buildGraphicsNode(ctx, e, node);
  
  
  
  1.15      +2 -2      
xml-batik/sources/org/apache/batik/bridge/SVGSwitchElementBridge.java
  
  Index: SVGSwitchElementBridge.java
  ===================================================================
  RCS file: 
/home/cvs/xml-batik/sources/org/apache/batik/bridge/SVGSwitchElementBridge.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- SVGSwitchElementBridge.java       11 Apr 2003 13:54:54 -0000      1.14
  +++ SVGSwitchElementBridge.java       11 Jun 2003 22:07:25 -0000      1.15
  @@ -85,7 +85,7 @@
                                     Element e,
                                     GraphicsNode node) {
           // bind the specified element and its associated graphics node if needed
  -        if (ctx.isDynamic()) {
  +        if (ctx.isInteractive()) {
               ctx.bind(e, node);
           }
       }
  
  
  
  1.81      +7 -4      
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.80
  retrieving revision 1.81
  diff -u -r1.80 -r1.81
  --- SVGTextElementBridge.java 24 May 2003 01:05:25 -0000      1.80
  +++ SVGTextElementBridge.java 11 Jun 2003 22:07:25 -0000      1.81
  @@ -186,9 +186,8 @@
           // 'pointer-events'
           node.setPointerEventType(CSSUtilities.convertPointerEvents(e));
   
  -        if (ctx.isDynamic()) {
  -            initializeDynamicSupport(ctx, e, node);
  -        }
  +        initializeDynamicSupport(ctx, e, node);
  +
           // Handle children elements such as <title>
           SVGUtilities.bridgeChildren(ctx, e);
       }
  @@ -251,6 +250,10 @@
                                               Element e,
                                               GraphicsNode node) {
           super.initializeDynamicSupport(ctx,e,node);
  +
  +        if (!ctx.isDynamic())
  +            return;             // Only add the listeners if we are dynamic
  +
   
           EventTarget evtTarget = (EventTarget)e;
   
  
  
  
  1.32      +14 -14    
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.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- SVGUseElementBridge.java  24 May 2003 01:05:26 -0000      1.31
  +++ SVGUseElementBridge.java  11 Jun 2003 22:07:25 -0000      1.32
  @@ -227,23 +227,22 @@
   
           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);
  -
  +        if (ctx.isInteractive()) {
  +            EventTarget target = (EventTarget)e;
  +            EventListener l = new CursorMouseOverListener(ctx);
  +            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 class CursorMouseOverListener implements EventListener {
  -
  -        protected UserAgent userAgent;
  +    public static class CursorMouseOverListener implements EventListener {
   
  -        public CursorMouseOverListener(UserAgent ua) {
  -            userAgent = ua;
  +        protected BridgeContext ctx;
  +        public CursorMouseOverListener(BridgeContext ctx) {
  +            this.ctx = ctx;
           }
   
           public void handleEvent(Event evt) {
  @@ -254,9 +253,10 @@
               Element currentTarget = (Element)evt.getCurrentTarget();
   
               if (!CSSUtilities.isAutoCursor(currentTarget)) {
  -                Cursor cursor = CSSUtilities.convertCursor(currentTarget, ctx);
  +                Cursor cursor;
  +                cursor = CSSUtilities.convertCursor(currentTarget, ctx);
                   if (cursor != null) {
  -                    userAgent.setSVGCursor(cursor);
  +                    ctx.getUserAgent().setSVGCursor(cursor);
                   }
               }
           }
  
  
  
  1.37      +15 -18    
xml-batik/sources/org/apache/batik/bridge/ScriptingEnvironment.java
  
  Index: ScriptingEnvironment.java
  ===================================================================
  RCS file: 
/home/cvs/xml-batik/sources/org/apache/batik/bridge/ScriptingEnvironment.java,v
  retrieving revision 1.36
  retrieving revision 1.37
  diff -u -r1.36 -r1.37
  --- ScriptingEnvironment.java 11 Apr 2003 13:54:56 -0000      1.36
  +++ ScriptingEnvironment.java 11 Jun 2003 22:07:25 -0000      1.37
  @@ -243,19 +243,15 @@
        * Runs an event handler.
        */
       public void runEventHandler(String script, Event evt, String lang) {
  -        Interpreter interpreter = bridgeContext.getInterpreter(lang);
  -        if (interpreter == null) {
  -            if (userAgent != null) {
  -                userAgent.displayError
  -                    (new Exception("unknow language: " + lang));
  -            }
  -        }
  +        Interpreter interpreter = getInterpreter(lang);
  +        if (interpreter == null)
  +            return;
   
  -        interpreter.bindObject(EVENT_NAME, evt);
  -        interpreter.bindObject(ALTERNATE_EVENT_NAME, evt);
  -            
           try {
               checkCompatibleScriptURL(lang, docPURL);
  +
  +            interpreter.bindObject(EVENT_NAME, evt);
  +            interpreter.bindObject(ALTERNATE_EVENT_NAME, evt);
               interpreter.evaluate(script);
           } catch (InterpreterException ie) {
               handleInterpreterException(ie);
  @@ -891,6 +887,11 @@
            */
           public void handleEvent(Event evt) {
               Element elt = (Element)evt.getCurrentTarget();
  +            // Evaluate the script
  +            String script = elt.getAttributeNS(null, attribute);
  +            if (script.length() == 0)
  +                return;
  +
               // Find the scripting language
               Element e = elt;
               while (e != null &&
  @@ -899,17 +900,13 @@
                       !SVGConstants.SVG_SVG_TAG.equals(e.getLocalName()))) {
                   e = SVGUtilities.getParentElement(e);
               }
  -            if (e == null) {
  +            if (e == null)
                   return;
  -            }
  +
               String lang = e.getAttributeNS
                   (null, SVGConstants.SVG_CONTENT_SCRIPT_TYPE_ATTRIBUTE);
   
  -            // Evaluate the script
  -            String script = elt.getAttributeNS(null, attribute);
  -            if (script.length() > 0) {
  -                runEventHandler(script, evt, lang);
  -            }
  +            runEventHandler(script, evt, lang);
           }
       }
   }
  
  
  
  1.10      +3 -3      xml-batik/sources/org/apache/batik/bridge/ViewBox.java
  
  Index: ViewBox.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/bridge/ViewBox.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- ViewBox.java      11 Apr 2003 13:54:58 -0000      1.9
  +++ ViewBox.java      11 Jun 2003 22:07:25 -0000      1.10
  @@ -71,8 +71,8 @@
               throw new BridgeException(e, ERR_URI_MALFORMED,
                                         new Object[] {ref});
           }
  -        // if the referenced element is not a view, the attribute values to use
  -        // are those defined on the enclosed svg element
  +        // if the referenced element is not a view, the attribute
  +        // values to use are those defined on the enclosed svg element
           if (!(attrDefElement.getNamespaceURI().equals(SVG_NAMESPACE_URI)
                 && attrDefElement.getLocalName().equals(SVG_VIEW_TAG))) {
               attrDefElement = getClosestAncestorSVGElement(e);
  
  
  
  1.7       +10 -1     xml-batik/sources/org/apache/batik/css/engine/CSSContext.java
  
  Index: CSSContext.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/css/engine/CSSContext.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- CSSContext.java   11 Apr 2003 13:55:26 -0000      1.6
  +++ CSSContext.java   11 Jun 2003 22:07:27 -0000      1.7
  @@ -85,4 +85,13 @@
           checkLoadExternalResource(ParsedURL resourceURL,
                                     ParsedURL docURL) throws SecurityException;
   
  +    /**
  +     * Returns true if the document is dynamic, false otherwise.
  +     */
  +    public boolean isDynamic();
  +
  +    /**
  +     * Returns true if the document is interactive, false otherwise.
  +     */
  +    public boolean isInteractive();
   }
  
  
  
  1.21      +3 -2      xml-batik/sources/org/apache/batik/css/engine/CSSEngine.java
  
  Index: CSSEngine.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/css/engine/CSSEngine.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- CSSEngine.java    12 Apr 2003 00:12:16 -0000      1.20
  +++ CSSEngine.java    11 Jun 2003 22:07:27 -0000      1.21
  @@ -400,7 +400,8 @@
               }
           }
   
  -        if (document instanceof EventTarget) {
  +        if (cssContext.isDynamic() &&
  +            (document instanceof EventTarget)) {
               // Attach the mutation events listeners.
               EventTarget et = (EventTarget)document;
               domAttrModifiedListener = new DOMAttrModifiedListener();
  
  
  
  1.11      +13 -8     
xml-batik/sources/org/apache/batik/extension/svg/BatikMultiImageElementBridge.java
  
  Index: BatikMultiImageElementBridge.java
  ===================================================================
  RCS file: 
/home/cvs/xml-batik/sources/org/apache/batik/extension/svg/BatikMultiImageElementBridge.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- BatikMultiImageElementBridge.java 5 Jun 2003 10:03:16 -0000       1.10
  +++ BatikMultiImageElementBridge.java 11 Jun 2003 22:07:27 -0000      1.11
  @@ -202,9 +202,8 @@
       public void buildGraphicsNode(BridgeContext ctx,
                                     Element e,
                                     GraphicsNode node) {
  -        if (ctx.isDynamic()) {
  -            initializeDynamicSupport(ctx, e, node);
  -        }
  +        initializeDynamicSupport(ctx, e, node);
  +
           // Handle children elements such as <title>
           //SVGUtilities.bridgeChildren(ctx, e);
           //super.buildGraphicsNode(ctx, e, node);
  @@ -220,13 +219,19 @@
       protected void initializeDynamicSupport(BridgeContext ctx,
                                               Element e,
                                               GraphicsNode node) {
  -        this.e = e;
  -        this.node = node;
  -        this.ctx = ctx;
  +        if (!ctx.isInteractive())
  +            return;
  +
           // HACK due to the way images are represented in GVT
           ImageNode imgNode = (ImageNode)node;
           ctx.bind(e, imgNode.getImage());
  -        ((SVGOMElement)e).setSVGContext(this);
  +
  +        if (ctx.isDynamic()) {
  +            this.e = e;
  +            this.node = node;
  +            this.ctx = ctx;
  +            ((SVGOMElement)e).setSVGContext(this);
  +        }
       }
   
       /**
  
  
  
  1.11      +17 -15    
xml-batik/sources/org/apache/batik/extension/svg/SVGFlowTextElementBridge.java
  
  Index: SVGFlowTextElementBridge.java
  ===================================================================
  RCS file: 
/home/cvs/xml-batik/sources/org/apache/batik/extension/svg/SVGFlowTextElementBridge.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- SVGFlowTextElementBridge.java     24 May 2003 01:05:26 -0000      1.10
  +++ SVGFlowTextElementBridge.java     11 Jun 2003 22:07:27 -0000      1.11
  @@ -512,22 +512,24 @@
                                                  false, subBidiLevel, 
                                               asb, lnLocs);
                   } else if (ln.equals(SVG_A_TAG)) {
  -                    EventTarget target = (EventTarget)nodeElement;
  -                    UserAgent ua = ctx.getUserAgent();
  -                    target.addEventListener
  -                        (SVG_EVENT_CLICK, 
  -                         new SVGAElementBridge.AnchorListener(ua),
  -                         false);
  +                    if (ctx.isInteractive()) {
  +                        EventTarget target = (EventTarget)nodeElement;
  +                        UserAgent ua = ctx.getUserAgent();
  +                        target.addEventListener
  +                            (SVG_EVENT_CLICK, 
  +                             new SVGAElementBridge.AnchorListener(ua),
  +                             false);
                       
  -                    target.addEventListener
  -                        (SVG_EVENT_MOUSEOVER,
  -                         new SVGAElementBridge.CursorMouseOverListener(ua),
  -                         false);
  +                        target.addEventListener
  +                            (SVG_EVENT_MOUSEOVER,
  +                             new SVGAElementBridge.CursorMouseOverListener(ua),
  +                             false);
                       
  -                    target.addEventListener
  -                        (SVG_EVENT_MOUSEOUT,
  -                         new SVGAElementBridge.CursorMouseOutListener(ua),
  -                         false);
  +                        target.addEventListener
  +                            (SVG_EVENT_MOUSEOUT,
  +                             new SVGAElementBridge.CursorMouseOutListener(ua),
  +                             false);
  +                    }
                       fillAttributedStringBuffer(ctx,
                                                  nodeElement,
                                                  false, subBidiLevel,
  
  
  
  1.38      +60 -56    xml-batik/sources/org/apache/batik/swing/JSVGCanvas.java
  
  Index: JSVGCanvas.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/swing/JSVGCanvas.java,v
  retrieving revision 1.37
  retrieving revision 1.38
  diff -u -r1.37 -r1.38
  --- JSVGCanvas.java   11 Apr 2003 13:59:19 -0000      1.37
  +++ JSVGCanvas.java   11 Jun 2003 22:07:27 -0000      1.38
  @@ -761,63 +761,67 @@
           public void handleElement(Element elt, Object data){
               super.handleElement(elt, data);
   
  -            if (elt.getNamespaceURI().equals(SVGConstants.SVG_NAMESPACE_URI)) {
  -                if (elt.getLocalName().equals(SVGConstants.SVG_TITLE_TAG)) {
  -                    // If there is a <desc> peer, do nothing as the tooltip will
  -                    // be handled when handleElement is invoked for the <desc>
  -                    // peer.
  -                    if (hasPeerWithTag
  -                        (elt,
  -                         SVGConstants.SVG_NAMESPACE_URI,
  -                         SVGConstants.SVG_DESC_TAG)){
  -                        return;
  -                    }
  +            // Don't handle tool tips unless we are interactive.
  +            if (!isInteractive()) return;
  +            
  +            if (!SVGConstants.SVG_NAMESPACE_URI.equals(elt.getNamespaceURI()))
  +                return;
   
  -                    elt.normalize();
  -                    if (elt.getFirstChild() == null) {
  -                        return;
  -                    }
  -                    String toolTip = elt.getFirstChild().getNodeValue();
  -                    if (toolTip == null || toolTip.length() == 0) {
  -                        return;
  -                    }
  -                    toolTip = Messages.formatMessage
  -                        (TOOLTIP_TITLE_ONLY,
  +            if (elt.getLocalName().equals(SVGConstants.SVG_TITLE_TAG)) {
  +                // If there is a <desc> peer, do nothing as the tooltip will
  +                // be handled when handleElement is invoked for the <desc>
  +                // peer.
  +                if (hasPeerWithTag
  +                    (elt,
  +                     SVGConstants.SVG_NAMESPACE_URI,
  +                     SVGConstants.SVG_DESC_TAG)){
  +                    return;
  +                }
  +                
  +                elt.normalize();
  +                if (elt.getFirstChild() == null) {
  +                    return;
  +                }
  +                String toolTip = elt.getFirstChild().getNodeValue();
  +                if (toolTip == null || toolTip.length() == 0) {
  +                    return;
  +                }
  +                toolTip = Messages.formatMessage
  +                    (TOOLTIP_TITLE_ONLY,
  +                     new Object[]{toFormattedHTML(toolTip)});
  +                
  +                setToolTip((Element)(elt.getParentNode()), toolTip);
  +            } else if (elt.getLocalName().equals
  +                       (SVGConstants.SVG_DESC_TAG)) {
  +                //  If there is a <title> peer, prepend its content to the
  +                // content of the <desc> element.
  +                elt.normalize();
  +                if (elt.getFirstChild() == null) {
  +                    return;
  +                }
  +                String toolTip = elt.getFirstChild().getNodeValue();
  +                if (toolTip == null || toolTip.length() == 0) {
  +                    return;
  +                }
  +                
  +                Element titlePeer =
  +                    getPeerWithTag(elt,
  +                                   SVGConstants.SVG_NAMESPACE_URI,
  +                                   SVGConstants.SVG_TITLE_TAG);
  +                if (titlePeer != null) {
  +                    titlePeer.normalize();
  +                    toolTip = Messages.formatMessage(TOOLTIP_TITLE_AND_TEXT,
  +                                                     new Object[] {
  +                                                         
toFormattedHTML(titlePeer.getFirstChild().getNodeValue()),
  +                                                         toFormattedHTML(toolTip)});
  +                } else {
  +                    toolTip =
  +                        Messages.formatMessage
  +                        (TOOLTIP_DESC_ONLY,
                            new Object[]{toFormattedHTML(toolTip)});
  -
  -                    setToolTip((Element)(elt.getParentNode()), toolTip);
  -                } else if (elt.getLocalName().equals
  -                           (SVGConstants.SVG_DESC_TAG)) {
  -                    // If there is a <title> peer, prepend its content to the
  -                    // content of the <desc> element.
  -                    elt.normalize();
  -                    if (elt.getFirstChild() == null) {
  -                        return;
  -                    }
  -                    String toolTip = elt.getFirstChild().getNodeValue();
  -                    if (toolTip == null || toolTip.length() == 0) {
  -                        return;
  -                    }
  -
  -                    Element titlePeer =
  -                        getPeerWithTag(elt,
  -                                       SVGConstants.SVG_NAMESPACE_URI,
  -                                       SVGConstants.SVG_TITLE_TAG);
  -                    if (titlePeer != null) {
  -                        titlePeer.normalize();
  -                        toolTip = Messages.formatMessage(TOOLTIP_TITLE_AND_TEXT,
  -                                                         new Object[] {
  -                            
toFormattedHTML(titlePeer.getFirstChild().getNodeValue()),
  -                                toFormattedHTML(toolTip)});
  -                    } else {
  -                        toolTip =
  -                            Messages.formatMessage
  -                            (TOOLTIP_DESC_ONLY,
  -                             new Object[]{toFormattedHTML(toolTip)});
  -                    }
  -
  -                    setToolTip((Element)(elt.getParentNode()), toolTip);
                   }
  +                
  +                setToolTip((Element)(elt.getParentNode()), toolTip);
               }
           }
   
  
  
  
  1.69      +54 -11    xml-batik/sources/org/apache/batik/swing/svg/JSVGComponent.java
  
  Index: JSVGComponent.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/swing/svg/JSVGComponent.java,v
  retrieving revision 1.68
  retrieving revision 1.69
  diff -u -r1.68 -r1.69
  --- JSVGComponent.java        11 Apr 2003 13:59:22 -0000      1.68
  +++ JSVGComponent.java        11 Jun 2003 22:07:27 -0000      1.69
  @@ -198,6 +198,11 @@
       public final static int ALWAYS_STATIC = 2;
   
       /**
  +     * Means that all document must be considered as interactive.
  +     */
  +    public final static int ALWAYS_INTERACTIVE = 3;
  +
  +    /**
        * The document loader.
        */
       protected SVGDocumentLoader documentLoader;
  @@ -293,6 +298,11 @@
       protected boolean isDynamicDocument;
   
       /**
  +     * Whether the current document has dynamic features.
  +     */
  +    protected boolean isInteractiveDocument;
  +
  +    /**
        * The document state.
        */
       protected int documentState;
  @@ -335,6 +345,14 @@
       }
   
       /**
  +     * Tells whether the component use dynamic features to
  +     * process the current document.
  +     */
  +    public boolean isInteractive() {
  +        return isInteractiveDocument;
  +    }
  +
  +    /**
        * Sets the document state. The given value must be one of
        * AUTODETECT, ALWAYS_DYNAMIC or ALWAYS_STATIC.
        */
  @@ -456,14 +474,26 @@
           switch (documentState) {
           case ALWAYS_STATIC:
               isDynamicDocument = false;
  +            isInteractiveDocument = false;
  +            break;
  +        case ALWAYS_INTERACTIVE:
  +            isDynamicDocument = false;
  +            isInteractiveDocument = true;
               break;
           case ALWAYS_DYNAMIC:
               isDynamicDocument = true;
  +            isInteractiveDocument = true;
               break;
           case AUTODETECT:
  -            isDynamicDocument = UpdateManager.isDynamicDocument(doc);
  +            isDynamicDocument = BridgeContext.isDynamicDocument(doc);
  +            if (isDynamicDocument)
  +                isInteractiveDocument = true;
  +            else
  +                isInteractiveDocument = BridgeContext.isInteractiveDocument(doc);
           }
  -        
  +        // System.err.println("Dynamic:     " + isDynamicDocument);
  +        // System.err.println("Interactive: " + isInteractiveDocument);
  +
           svgDocument = doc;
   
           Element root = doc.getDocumentElement();
  @@ -551,7 +581,12 @@
               loader = new DocumentLoader(userAgent);
           }
           BridgeContext result = new BridgeContext(userAgent, loader);
  -        result.setDynamic(true);
  +        if (isInteractiveDocument) {
  +            if (isDynamicDocument)
  +                result.setDynamicState(BridgeContext.DYNAMIC);
  +            else
  +                result.setDynamicState(BridgeContext.INTERACTIVE);
  +        }
           return result;
       }
   
  @@ -706,7 +741,7 @@
        * Renders the GVT tree.
        */
       protected void renderGVTTree() {
  -        if (!isDynamicDocument ||
  +        if (!isInteractiveDocument ||
               updateManager == null ||
               !updateManager.isRunning()) {
               super.renderGVTTree();
  @@ -872,7 +907,8 @@
           float prevTransY = 0;
   
           public void componentResized(ComponentEvent ce) {
  -            if (updateManager != null && updateManager.isRunning()) {
  +            if (isDynamicDocument &&
  +                (updateManager != null) && updateManager.isRunning()) {
                   updateManager.getUpdateRunnableQueue().invokeLater
                       (new Runnable() {
                           public void run() {
  @@ -894,7 +930,8 @@
               final boolean dispatchZoom    = (currScale != prevScale);
               final boolean dispatchScroll  = ((currTransX != prevTransX) ||
                                                (currTransX != prevTransX));
  -            if (updateManager != null && updateManager.isRunning()) {
  +            if (isDynamicDocument &&
  +                (updateManager != null) && updateManager.isRunning()) {
                   updateManager.getUpdateRunnableQueue().invokeLater
                       (new Runnable() {
                           public void run() {
  @@ -1049,6 +1086,12 @@
               if (isDynamicDocument && JSVGComponent.this.eventsEnabled) {
                   startSVGLoadEventDispatcher(e.getGVTRoot());
               } else {
  +                if (isInteractiveDocument) {
  +                    nextUpdateManager = new UpdateManager(bridgeContext,
  +                                                          e.getGVTRoot(),
  +                                                          svgDocument);
  +                }
  +                    
                   JSVGComponent.this.setGraphicsNode(e.getGVTRoot(), false);
                   scheduleGVTRendering();
               }
  @@ -1543,7 +1586,7 @@
            * Dispatches the event to the GVT tree.
            */
           protected void dispatchMouseClicked(final MouseEvent e) {
  -            if (!isDynamicDocument) {
  +            if (!isInteractiveDocument) {
                   super.dispatchMouseClicked(e);
                   return;
               }
  @@ -1601,7 +1644,7 @@
            * Dispatches the event to the GVT tree.
            */
           protected void dispatchMouseEntered(final MouseEvent e) {
  -            if (!isDynamicDocument) {
  +            if (!isInteractiveDocument) {
                   super.dispatchMouseEntered(e);
                   return;
               }
  @@ -1620,7 +1663,7 @@
            * Dispatches the event to the GVT tree.
            */
           protected void dispatchMouseExited(final MouseEvent e) {
  -            if (!isDynamicDocument) {
  +            if (!isInteractiveDocument) {
                   super.dispatchMouseExited(e);
                   return;
               }
  @@ -1682,7 +1725,7 @@
            * Dispatches the event to the GVT tree.
            */
           protected void dispatchMouseMoved(MouseEvent e) {
  -            if (!isDynamicDocument) {
  +            if (!isInteractiveDocument) {
                   super.dispatchMouseMoved(e);
                   return;
               }
  
  
  
  1.8       +4 -2      
xml-batik/sources/org/apache/batik/transcoder/SVGAbstractTranscoder.java
  
  Index: SVGAbstractTranscoder.java
  ===================================================================
  RCS file: 
/home/cvs/xml-batik/sources/org/apache/batik/transcoder/SVGAbstractTranscoder.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- SVGAbstractTranscoder.java        11 Apr 2003 13:59:23 -0000      1.7
  +++ SVGAbstractTranscoder.java        11 Jun 2003 22:07:28 -0000      1.8
  @@ -166,7 +166,9 @@
               (hints.containsKey(KEY_EXECUTE_ONLOAD) &&
                ((Boolean)hints.get(KEY_EXECUTE_ONLOAD)).booleanValue() &&
                BaseScriptingEnvironment.isDynamicDocument(svgDoc));
  -        ctx.setDynamic(isDynamic);
  +
  +        if (isDynamic)
  +            ctx.setDynamicState(BridgeContext.DYNAMIC);
   
           GraphicsNode gvtRoot;
           try {
  
  
  
  1.1                  xml-batik/test-references/samples/extensions/opera/.cvsignore
  
  Index: .cvsignore
  ===================================================================
  accepted-variation
  candidate-reference
  candidate-variation
  
  
  
  1.1                  
xml-batik/test-references/samples/extensions/opera/opera-subImage.png
  
        <<Binary file>>
  
  
  1.1                  
xml-batik/test-references/samples/extensions/opera/opera-subImageRef.png
  
        <<Binary file>>
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to