>>>>> "JA" == J Aaron Farr <[EMAIL PROTECTED]> writes:

JA> --- Thomas E Deweese <[EMAIL PROTECTED]> wrote:

>> If you want to handle the event in Java, you can add a Java
>> listener to the SVG Elements in the DOM directly.

JA>   Is there an example somewhere of how to do this in java?  That
JA> is, how to add the listener to the SVG Element in the DOM?  This
JA> is something I've been looking at doing too.

Take this with a grain of salt, it's abstracted loosely from the
SVGTextElementBridge class.  This is all DOM level 2 event stuff
nothing the slightest bit Batik specific here.

---

import org.w3c.dom.events.Event;
import org.w3c.dom.events.EventListener;
import org.w3c.dom.events.EventTarget;
import org.w3c.dom.events.MutationEvent;

    Element e = ....;
    EventTarget evtTarget = (EventTarget)e;

    /**
     * The DOM EventListener to receive 'DOMNodeRemoved' event.
     */
    EventListener childNodeRemovedEventListener = 
        new EventListener() {
            /**
             * Handles 'DOMNodeRemoved' event type.
             */
            public void handleEvent(Event evt) {
                MutationEvent me = (MutationEvent)evt;
            }
        };  

    //to be notified when a child is removed from the element.
    evtTarget.addEventListener
        ("DOMNodeRemoved", childNodeRemovedEventListener, true);


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

Reply via email to