Hi!

I'm just playing around with Java Scripting and Event Handling but I think I'm missing a basic understanding of when to register event Listeners.

When I create a whole dom tree document is it possible to register listeners when I create and add elements to the tree so that the listeners can handle events as soon as the DOM is rendered in a canvas?

canvas.setDocumentState(JSVGComponent.ALWAYS_DYNAMIC);
canvas.addSVGLoadEventDispatcherListener(new SVGLoadEventDispatcherAdapter() {
public void svgLoadEventDispatchStarted
(SVGLoadEventDispatcherEvent e) {
doc = jSVGCanvas1.getSVGDocument();
System.out.println("Document Loaded");
window=canvas.getUpdateManager().
getScriptingEnvironment().createWindow();
}
});


jSVGCanvas1.setURI(uri);

...

while (cond) {
Element elem = <getElement Object here>
EventTarget target = (EventTarget)elem;
target.addEventListener("OnMouseOver",new OnMouseOverAction(),false);
target.addEventListener("OnMouseOut",new OnMouseOutAction(),false);
doc.getRootElement().appendChild(gelem);
}

//then set the Canvas to display doc
canvas.setSVGDocument(doc);

I think calling setSVGDocument() after I've created the document "offline" isn't the right way but how can I use the updateManager to replace the whole document in the Canvas with the new one?

Reinhard
--
Reinhard Brandstaedter   [EMAIL PROTECTED]  GPG: 0x033B81DB
-    Student of Computer Science - J.K. University of Linz     -
-        <ICQ: 73059068>    <Mobile: +43 699 12419541>         -
-                  http://adelaide.dnsalias.net                -


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



Reply via email to