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 Andres Toussaint <an...@onemileup.com> on 2003/08/22 02:40:38 UTC

rect element mouseclick triggers ClassCastExeption

Hello all,

Previously I had a trouble with the mouseaction events on a JSVGCanvas, 
that Thomas DeWeese was so kind to solve for us (covered in the thread 
"mousedrag and mousedown not detected").

My actual problem is i add a RECT element to my JSVGCanvas, doing this:
document = e.getSVGDocument();
documentElement = (SVGOMSVGElement)document.getDocumentElement();
Element imgGroup = documentElement.getElementById("imgGroup");
....
Element rect = document.createElementNS(svgNS, "rect");
....
imgGroup.appendChild(rect);

Then register the action listeners, and when i do a mousemove, it gets 
registered ok, but a CLICK, DOWN or UP, throws the following error:
java.lang.ClassCastException
        at 
com.onemileup.client.draw.BaseDrawing$OnDownAction.handleEvent(Unknown 
Source)
        at 
org.apache.batik.dom.events.EventSupport.fireEventListeners(Unknown Source)
        at 
org.apache.batik.dom.events.EventSupport.dispatchEvent(Unknown Source)
        at org.apache.batik.dom.AbstractNode.dispatchEvent(Unknown Source)
        at 
org.apache.batik.bridge.BridgeEventSupport$Listener.dispatchMouseEvent(Unknown 
Source)
        at 
org.apache.batik.bridge.BridgeEventSupport$Listener.dispatchMouseEvent(Unknown 
Source)
        at 
org.apache.batik.bridge.BridgeEventSupport$Listener.mousePressed(Unknown 
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$23.run(Unknown Source)
        at org.apache.batik.util.RunnableQueue.run(Unknown Source)
        at java.lang.Thread.run(Thread.java:536)

I complied Batik 1.5 with only the patch files mentioned in
http://koala.ilog.fr/batik/mlists/batik-dev/archives/msg03536.html

    * Subject: cvs commit:
      xml-batik/sources/org/apache/batik/script/rhino
      EventTargetWrapper.java
    * From: vhardy@apache.org <ma...@apache.org>
    * Date: 13 Jul 2003 22:30:57 -0000
    * To: xml-batik-cvs@apache.org <ma...@apache.org>

I have not added any patches or other modifications to the Batik code.

Thanks in advance,

Andres Toussaint

Re: rect element mouseclick triggers ClassCastExeption

Posted by Andres Toussaint <an...@onemileup.com>.
Hi Thomas, thanks for your support, i will try to track down the error.

Best regards, Andres,

Thomas DeWeese wrote:

> Hi Andres,
>
>    I think the problem is your code:
>
> > java.lang.ClassCastException
> >        at
> > com.onemileup.client.draw.BaseDrawing$OnDownAction.handleEvent(Unknown
> > Source)
>
>     The class cast exception is happening in com.onemileup code which
> is yours judging by your mail address.
>
> Andres Toussaint wrote:
>
>> Hello all,
>>
>> Previously I had a trouble with the mouseaction events on a 
>> JSVGCanvas, that Thomas DeWeese was so kind to solve for us (covered 
>> in the thread "mousedrag and mousedown not detected").
>>
>> My actual problem is i add a RECT element to my JSVGCanvas, doing this:
>> document = e.getSVGDocument();
>> documentElement = (SVGOMSVGElement)document.getDocumentElement();
>> Element imgGroup = documentElement.getElementById("imgGroup");
>> ....
>> Element rect = document.createElementNS(svgNS, "rect");
>> ....
>> imgGroup.appendChild(rect);
>>
>> Then register the action listeners, and when i do a mousemove, it 
>> gets registered ok, but a CLICK, DOWN or UP, throws the following error:
>> java.lang.ClassCastException
>>        at 
>> com.onemileup.client.draw.BaseDrawing$OnDownAction.handleEvent(Unknown 
>> Source)
>>        at 
>> org.apache.batik.dom.events.EventSupport.fireEventListeners(Unknown 
>> Source)
>>        at 
>> org.apache.batik.dom.events.EventSupport.dispatchEvent(Unknown Source)
>>        at org.apache.batik.dom.AbstractNode.dispatchEvent(Unknown 
>> Source)
>>        at 
>> org.apache.batik.bridge.BridgeEventSupport$Listener.dispatchMouseEvent(Unknown 
>> Source)
>>        at 
>> org.apache.batik.bridge.BridgeEventSupport$Listener.dispatchMouseEvent(Unknown 
>> Source)
>>        at 
>> org.apache.batik.bridge.BridgeEventSupport$Listener.mousePressed(Unknown 
>> 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$23.run(Unknown 
>> Source)
>>        at org.apache.batik.util.RunnableQueue.run(Unknown Source)
>>        at java.lang.Thread.run(Thread.java:536)
>>
>> I complied Batik 1.5 with only the patch files mentioned in
>> http://koala.ilog.fr/batik/mlists/batik-dev/archives/msg03536.html
>>
>>    * Subject: cvs commit:
>>      xml-batik/sources/org/apache/batik/script/rhino
>>      EventTargetWrapper.java
>>    * From: vhardy@apache.org <ma...@apache.org>
>>    * Date: 13 Jul 2003 22:30:57 -0000
>>    * To: xml-batik-cvs@apache.org <ma...@apache.org>
>>
>> I have not added any patches or other modifications to the Batik code.
>>
>> Thanks in advance,
>>
>> Andres Toussaint
>>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-users-help@xml.apache.org
>
>
>





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


Re: rect element mouseclick triggers ClassCastExeption

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

    I think the problem is your code:

 > java.lang.ClassCastException
 >        at
 > com.onemileup.client.draw.BaseDrawing$OnDownAction.handleEvent(Unknown
 > Source)

     The class cast exception is happening in com.onemileup code which
is yours judging by your mail address.

Andres Toussaint wrote:
> Hello all,
> 
> Previously I had a trouble with the mouseaction events on a JSVGCanvas, 
> that Thomas DeWeese was so kind to solve for us (covered in the thread 
> "mousedrag and mousedown not detected").
> 
> My actual problem is i add a RECT element to my JSVGCanvas, doing this:
> document = e.getSVGDocument();
> documentElement = (SVGOMSVGElement)document.getDocumentElement();
> Element imgGroup = documentElement.getElementById("imgGroup");
> ....
> Element rect = document.createElementNS(svgNS, "rect");
> ....
> imgGroup.appendChild(rect);
> 
> Then register the action listeners, and when i do a mousemove, it gets 
> registered ok, but a CLICK, DOWN or UP, throws the following error:
> java.lang.ClassCastException
>        at 
> com.onemileup.client.draw.BaseDrawing$OnDownAction.handleEvent(Unknown 
> Source)
>        at 
> org.apache.batik.dom.events.EventSupport.fireEventListeners(Unknown Source)
>        at org.apache.batik.dom.events.EventSupport.dispatchEvent(Unknown 
> Source)
>        at org.apache.batik.dom.AbstractNode.dispatchEvent(Unknown Source)
>        at 
> org.apache.batik.bridge.BridgeEventSupport$Listener.dispatchMouseEvent(Unknown 
> Source)
>        at 
> org.apache.batik.bridge.BridgeEventSupport$Listener.dispatchMouseEvent(Unknown 
> Source)
>        at 
> org.apache.batik.bridge.BridgeEventSupport$Listener.mousePressed(Unknown 
> 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$23.run(Unknown Source)
>        at org.apache.batik.util.RunnableQueue.run(Unknown Source)
>        at java.lang.Thread.run(Thread.java:536)
> 
> I complied Batik 1.5 with only the patch files mentioned in
> http://koala.ilog.fr/batik/mlists/batik-dev/archives/msg03536.html
> 
>    * Subject: cvs commit:
>      xml-batik/sources/org/apache/batik/script/rhino
>      EventTargetWrapper.java
>    * From: vhardy@apache.org <ma...@apache.org>
>    * Date: 13 Jul 2003 22:30:57 -0000
>    * To: xml-batik-cvs@apache.org <ma...@apache.org>
> 
> I have not added any patches or other modifications to the Batik code.
> 
> Thanks in advance,
> 
> Andres Toussaint
> 




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