xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Romain CATTEAU <romain.catt...@gmail.com>
Subject Events management and display property
Date Tue, 24 Mar 2009 16:16:12 GMT

Hi,

I work on a Java application based upon Batik. It contains a canvas that
displays the content of a SVG document. Let me explain you in a few words
the structure of that SVG doc:

<svg>
<defs>
<g id="1"...>...</g>
<g id="2"...>...</g>
...
<g id="n"...>...</g>
</defs>
<use ...  xlink:href="#n"...>
<use ...  xlink:href="#1"...>
<use ...  xlink:href="#2"...>
...
</svg>

All graphical primitives are wrapped into groups located in a defs
container. Each group from the defs container is located through a use
element.
The SVG document is highly dynamic, to the extent that the application might
add/remove/modify many elements. All elements that can be modified are
located inside the last group, the id of which is n.
For example, we let the user chose what he really wants to see on the canvas
by modifying the value of the display property of some elements inside the
group n. And, well, such modifications have a strange impact on events
management. Almost all elements listen to click and mouseover events.
Here is the method to register events :

public void registerListeners() {
		
		// Gets an element from the loaded document.
		Element elt = svgDoc.getDocumentElement();
		EventTarget t = (EventTarget) elt;

		t.addEventListener("mouseover", new MouseOverAction(), false);	
		t.addEventListener("click", new MouseClickAction(), false);
		t.addEventListener("keyup", new KeyUpAction(), false);
		t.addEventListener("keydown", new KeyDownAction(), false);
		
	}

Of course, that method is called in svgLoadEventDispatchStarted method of
the SVGLoadEventDispatcherListener.

At the beginning, when the SVG document is loaded, everything works fine :
we receive events correctly. When we modify the display property of some
elements inside the group n, we do not receive events from any element from
the group n, whatever the display property value of the element might be. On
the contrary, elements from all the other groups (tits group the id of which
is different from n) receive events.
When we cancel the modifications so that the display properties are set as
they were at the beginning, events management is correct, which means that
elements from group n receive events. I hope someone could help me.

Thanks for your help.

Best regards.

Romain.



-- 
View this message in context: http://www.nabble.com/Events-management-and-display-property-tp22683979p22683979.html
Sent from the Batik - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


Mime
View raw message