xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew Armstrong" <andrew_armstr...@bigpond.com>
Subject Re: How to redisplay a SVG text item on a JSVGCanvas?
Date Sun, 14 Apr 2002 12:09:26 GMT
> I believe you need to update the 'data' property
> of the child node, not the child node itself.

Thanks for the tip Brian, but the problem is still there:

4a. Instead of _node.setNodeValue(newValue), I cast (casted?) the Node to a
GenericText and called setData:

    GenericText gt = (GenericText) _node;
    gt.setData(_value);

4b. Still no go, so I traced the code through, and found that Batik
(specifically AbstractNode.fireDOMCharacterDataModifiedEvent) won't fire a
DOM node-changed event unless an EventListener is registered on at least
*one* element in the DOM tree, afterwhich
AbstractDocument.getEventsEnabled() returns true - so I registered an
EventListener for the "SVGLoad" event on the "svg" element (even though my
app is not really interested in events) by adding the following code
(reworked from Batik's Java Scripting doco) to my MyJSVGCanvas constructor :

  addSVGLoadEventDispatcherListener(new SVGLoadEventDispatcherAdapter()
  {
   public void svgLoadEventDispatchStarted(SVGLoadEventDispatcherEvent e)
   {
    System.out.println("svgLoadEventDispatchStarted " + e);
    Element elt = getSVGDocument().getElementById("svg");
    EventTarget t = (EventTarget) elt;

    t.addEventListener("SVGLoad", new EventListener()
    {
     public void handleEvent(org.w3c.dom.events.Event evt)
     {
      System.out.println("handleEvent " + evt);
     }

    },
           false);
   }
  });

...but *still* no joy!



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


Mime
View raw message