You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by Romain CATTEAU <ro...@gmail.com> on 2009/03/24 17:16:12 UTC

Events management and display property

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


Re: Events management and display property

Posted by Romain CATTEAU <ro...@gmail.com>.
Hi Helder.

Thanks for the link. I will have a look at it to check if it is the same
problem.

Best Regards.

Romain Catteau.


Helder Magalhães wrote:
> 
> Hi Romain,
> 
>> 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.
> 
> May this be the same issue Juha is experiencing [1]? If so, please add
> any relevant information there. If not, I'd suggest creating a
> self-contained test case and attach it to a reply: being able to
> reproduce issue surely helps a lot. ;-)
> 
> Hope this helps,
>  Helder Magalhães
> 
> [1]
> http://www.nabble.com/text-tspan-mouse-events-change-when-zoomed-in-tc22799472.html
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Events-management-and-display-property-tp22683979p22984750.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


Re: Events management and display property

Posted by Helder Magalhães <he...@gmail.com>.
Hi Romain,

> 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.

May this be the same issue Juha is experiencing [1]? If so, please add
any relevant information there. If not, I'd suggest creating a
self-contained test case and attach it to a reply: being able to
reproduce issue surely helps a lot. ;-)

Hope this helps,
 Helder Magalhães

[1] http://www.nabble.com/text-tspan-mouse-events-change-when-zoomed-in-tc22799472.html

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