xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas DeWeese <Thomas.DeWe...@Kodak.com>
Subject Re: Question: How do I capture the mouse click event prior to loading a link associated SVG File
Date Tue, 08 Feb 2005 02:19:27 GMT
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

View raw message