You are right again, that was the parent tree i wrongly assumed that it was
the same as the event dispatch.
I get it from this:
private void printEvent(Event evt){
Object target = evt.getTarget();
if(target instanceof Element){
Node node = (Node) target;
System.out.print("<");
for(;node!=null;node=node.getParentNode()){
System.out.print(node.getLocalName());
if (node instanceof Element){
System.out.print("{"+((Element)node).getAttribute("id")+"}/");
}
}
System.out.print(">[");
NamedNodeMap attrs = ((Node) target).getAttributes();
for(int i =0;i<attrs.getLength();i++){
Node att = attrs.item(i);
System.out.print(att.getNodeName()+"("+att.getNodeValue()+") ");
}
System.out.println();
}else{
System.out.println(evt.getTarget().getClass());
}
}
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?
Thanks a lot for you time.
On Tuesday 09 November 2004 17:29, Thomas DeWeese wrote:
> Alessandro Di Bella wrote:
> > I think I found what the problem is but I'm not sure if it is a bug,
> > feature or my mistake.
>
> It's a little of all of the above. First I think you are confusing
>
> the 'parent' tree with the event dispatch:
> > When I click on the rectangle with id "EVENT_GENERATOR", the event gets
> > propagated to rect[id="EVENT_GENERATOR"]/g/symbol[id="ASYMBOL"]/defs/svg
>
> This is probably the parent tree, although even that doesn't seem
> quite right (I would have expected some 'odd' elements in the tree,
> and perhaps a null parent at some point). How are you generating this
> list?
>
> > rather than
> > rect[id="EVENT_GENERATOR"]/g/symbol[id="ASYMBOL"]/g[id="id="LISTENING_NOD
> >E"]/svg so the listener never gets notified.
>
> The only way to know what the dispatch tree is to set an
> event listener on every element and see who get's called.
>
> > Is this the way is supposed to be of is it a bug?
>
> So Batik 'cheats' for use. We should create a 'proxy tree'
> of elements of type 'ElementInstace'. We don't do this we
> actually clone the used element and attached the cloned content
> under the use element.
>
> > The SVG looks like:
> >
> > <svg xmlns="http://www.w3.org/2000/svg" xmlns:myns="........">
> > <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" .....>
> > <use xlink:href="#ASYMBOL" x="195" y="702" width="622" height="394"/>
> > </g>
> > .................
> > </svg>
>
> ---------------------------------------------------------------------
> 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]