Alessandro Di Bella wrote:

I manged to get it working (kind of) just now!
I followed your advice and I added a listener to every node to see what the event dispatch queue was and i realized that events does not get propagated within symbols.

Ok I understand your problem. AFAIK Batik is doing the right thing. The event is supposed to propagate up the 'ElementInstance' tree not the referenced element tree. Thus event listeners on referenced content will not be called. You might consider doing an explicit clone rather than using 'use'.

I'll explay better, given this:
1. <svg xmlns="http://www.w3.org/2000/svg"; xmlns:myns="........">
2 <defs>
3 <symbol id="INNERSYMBOL">
4   <g>
5    <rect width="100" height="62.5" ry="5" x="+3" y="+3" />
6    <rect id="EVENT_GENERATOR" width="100" height="62.5" ry="5"/>
7   </g>
8  </symbol>
9 </defs>
10 <defs>
11 <symbol id="OUTERSYMBOL">
12  ................
13  <use id="LISTENING_NODE" myns:type="mytype" xlink:href="#INNERSYMBOL"/>
14  ................
15 </symbol>
16 </defs>
17<use xlink:href="#OUTERSYMBOL" x="195" y="702" width="622" height="394"/>
18</svg>

When I click on <rect id="EVENT_GENERATOR">, the dispatch queue is:

<use xlink:href="#OUTERSYMBOL".../>
<svg xmlns="http://www.w3.org/2000/svg"../>

Eliminating lines 10, 11, 15, 16, 17 and doing so eliminating a nesting level the the dispatch queue is:
<use id="LISTENING_NODE"/>
<svg xmlns="http://www.w3.org/2000/svg"../>


and that is enough for me at the moment even though it's not a fully fledged solution.

Thanks a lot for you help and I'll let you know if i find something more definitive.

I would appreciate if you could do the same.

Ciao

Alessandro

On Tuesday 09 November 2004 18:56, Thomas DeWeese wrote:

Alessandro Di Bella wrote:

You are right again, that was the parent tree i wrongly assumed that it
was the same as the event dispatch.

So how sure are you that the event handler isn't called? Did you put a print statement or something in it?

   What happens if you load the following and run it?

<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd";>

<svg xmlns="http://www.w3.org/2000/svg";
  xmlns:xlink="http://www.w3.org/1999/xlink"; xmlns:myns="........"
  onclick="printTree('Baz',evt.target)">

 <script type="text/ecmascript">
   <![CDATA[
      function printTree(title, e) {
         while (e) {
           System.err.println(""+title+": " + e);
           e = e.parentNode;
         }
      }
  ]]></script>

<defs>
 <symbol id="ASYMBOL">
  <g>
   <rect width="100" height="62.5" ry="5" x="+3" y="+3" />
   <rect id="EVENT_GENERATOR" width="100" height="62.5" ry="5"/>
  </g>
 </symbol>
</defs>

 <g id="LISTENING_NODE" myns:type="mytype"
    onclick="printTree('Bar',evt.target)">
   <use onclick="printTree('Foo',evt.target)"
        xlink:href="#ASYMBOL" x="5" y="2" width="622" height="394"/>
</g>
</svg>

From what i understand then, I'm on a dead end and I still need to solve
my problem. I think that I will persue the other route with the GVT tree.
Even if it is not trivial It should work. Can you give me some hints
please?

This is _really_ the wrong way to go, and I don't have the time to help you figure out how to do it. I'm willing to help debug this problem on the off chance that you have found a bug.



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


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



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



Reply via email to