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 Filipe Marinho <fi...@SE.EFACEC.PT> on 2005/06/23 17:18:57 UTC

Big mess. Select node, replace it, get error on the event listene r.

Hi!

First of all, i would like to thank all the participants of this mail list
that helped me and all the people with problems.

Talking about a problems i have other one:

Some where along the time of my application i replace nodes of my svg. That
nodes had listeners (ex: mouseclick listener).
So i have to add a new istener to the element that was inserted. 

/*.....*/

jsvgCanvas.getUpdateManager().getUpdateRunnableQueue().invokeLater(new
Runnable(){

/*......*/

		    //add listener
		    Node target = doc.getElementById(uid);
	    	EventTarget et = (EventTarget)target;
	    	et.addEventListener("click", new mouseClickListener(),
false);
/*.....*/ }...


This is what i do to add the listener to the new element.

So far so good...

The element i replace is a text element. If i select the text of the element
i am going to replace and then replace it for other text element the new
text keeps selected. My problem is that when i click on that text (with some
text selected) i have the error:

java.lang.NullPointerException
	at
org.apache.batik.gvt.text.ConcreteTextSelector.checkSelectGesture(Unknown
Source)
	at
org.apache.batik.gvt.text.ConcreteTextSelector.mousePressed(Unknown Source)
	at
org.apache.batik.swing.gvt.TextSelectionManager$MouseListener.mousePressed(U
nknown Source)
	at
org.apache.batik.gvt.event.AWTEventDispatcher.processMouseEvent(Unknown
Source)
	at
org.apache.batik.gvt.event.AWTEventDispatcher.dispatchMouseEvent(Unknown
Source)
	at
org.apache.batik.gvt.event.AWTEventDispatcher.dispatchEvent(Unknown Source)
	at
org.apache.batik.gvt.event.AWTEventDispatcher.mousePressed(Unknown Source)
	at org.apache.batik.swing.svg.JSVGComponent$18.run(Unknown Source)
	at org.apache.batik.util.RunnableQueue.run(Unknown Source)
	at java.lang.Thread.run(Thread.java:534)

instead of the action of the listener. This error only happens when i click
on the replaced element witch is selected because the old text element was
too. otherwise no error is shown.

If you could help me with this....

thanks....
---------------------------------------------------------------
Filipe Marinho
filipe.marinho@se.efacec.pt
> EFACEC Sistemas de Electrónica, S.A
> Rua Engº Frederico Ulrich
> Apart. 3078 - 4471-907 Moreira Maia
> PORTUGAL
Telf 229402000
---------------------------------------------------------------



Re: Big mess. Select node, replace it, get error on the event listene r.

Posted by Cameron McCormack <ca...@aka.mcc.id.au>.
Cameron McCormack:
> Yep that looks like a bug in the text selection code.  I've made a patch
> that fixes the problem, but Batik's CVS has just been migrated to
> Subversion, so I'll put it into SVN when I figure out how Subversion
> works. :-)

Fix is now in SVN.

-- 
  e-mail : cam (at) mcc.id.au    	icq : 26955922
     web : http://mcc.id.au/	        msn : cam-msn (at) aka.mcc.id.au
  office : +61399055779		     jabber : heycam (at) jabber.org

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


Re: Big mess. Select node, replace it, get error on the event listene r.

Posted by Cameron McCormack <ca...@aka.mcc.id.au>.
Hi Filipe.

Filipe Marinho:
> The element i replace is a text element. If i select the text of the element
> i am going to replace and then replace it for other text element the new
> text keeps selected. My problem is that when i click on that text (with some
> text selected) i have the error:

Yep that looks like a bug in the text selection code.  I've made a patch
that fixes the problem, but Batik's CVS has just been migrated to
Subversion, so I'll put it into SVN when I figure out how Subversion
works. :-)

Cameron

-- 
  e-mail : cam (at) mcc.id.au    	icq : 26955922
     web : http://mcc.id.au/	        msn : cam-msn (at) aka.mcc.id.au
  office : +61399055779		     jabber : heycam (at) jabber.org

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