Hello,
I am
trying to add event attributes (onclick, onmouseover, ...) to an SVG. The
code I use for it is this :
Element el = this.svgDoc.getElementById(id);
if(el != null)
{
el.setAttributeNS(null,attr,val);
if(el != null)
{
el.setAttributeNS(null,attr,val);
}
I get
different results depending on the moment I call the code : when called between
loading and building, everything
works
fine. The attribute is added and the event is attached (I can change the value
of the attribute later and the event
responds correctly). However, if I call this code after the rendering
completed (which unfortunately is the normal place
where
my program gets to know the values of the attribute), the attribute is added (I
can get the value) but it does not
react
to the mouse event...
Besides the point of time where the setAttribute is called, I also see
that it is called in another thread. The first time I
call
it in the [AWT-EventQueue-0] thread (who sends the update messages concerning
the loading and such). The second
time,
I'm in my programs thread.
Can
anybody give me a hint on what is going wrong. If it is the thread, is there a
way of executing the setAttribute in
that
thread (like it is with the update managers thread, by the way, executing the
add in the [RunnableQueue-0] thread
does
not solve the problem).
Thank
you for your support.
Jef