xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Reinhard Brandst├Ądter <r.brandstaed...@gmx.at>
Subject When to register EventListeners?
Date Fri, 10 Oct 2003 19:13:51 GMT
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   r.brandstaedter@gmx.at  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: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org


Mime
View raw message