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 Pramod Kalapa <p_...@yahoo.com> on 2005/02/07 18:31:00 UTC

Question: How do I capture the mouse click event prior to loading a link associated SVG File

Hopefully I am explaining my requirement right (I am
new to Batik)...

I have an SVG document loaded into the JSVGCanvas. I
want
to capture the generated event on clicking with the
mouse 
before the JSVGCanvas loads the SVG file associated
with the link: i.e., I need to do some processing to
decide prior to the automatic loading behavior of the
JSVGCanvas whether I should load the document or not
or reject the mouse click.

Thanks 


		
__________________________________ 
Do you Yahoo!? 
Yahoo! Mail - Find what you need with new enhanced search.
http://info.mail.yahoo.com/mail_250

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


Re: Question: How do I capture the mouse click event prior to loading a link associated SVG File

Posted by Thomas DeWeese <Th...@Kodak.com>.
Hi Pramod,

    You need to register an onclick mouse listener
during the "capture" phase of DOM event dispatch.
Then if you decide you don't want the document
opened you can call 'preventDefault' on the event
passed into your handler to prevent it from
activating the link (this part might only work in
CVS Batik).

    So from Java:

	EventListener clickListener = new ClickListener();
	EventTarget et = (EventTarget)document.getElementById("foo");
	e.addEventListener("click", clickListener, true);

     class ClickListener implements EventListener {
         public void handleEvent(Event evt) {
		if (blah) evt.preventDefault();
	}


Pramod Kalapa wrote:

> Hopefully I am explaining my requirement right (I am
> new to Batik)...
> 
> I have an SVG document loaded into the JSVGCanvas. I
> want
> to capture the generated event on clicking with the
> mouse before the JSVGCanvas loads the SVG file associated
> with the link: i.e., I need to do some processing to
> decide prior to the automatic loading behavior of the
> JSVGCanvas whether I should load the document or not
> or reject the mouse click.


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