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 grillot sebastien <se...@gmail.com> on 2005/06/08 10:46:34 UTC

Help needed for DnD

Hello,
I have a problem with the Drag and drog.
In fact i think that i don't understand all the method...
Can everyone explain completly the method from the begin (the creation
of a graphical interface, with object draw on it and the drag and drop
solution... in fact a small application...) It's very important for me
and i try it from 2 months and i'm block... thanks a milion for your
help...

regards

Seb


-- 
Regist. Linux User #344952

/* Fuck me gently with a chainsaw... */
  -- 2.0.38 /usr/src/linux/arch/sparc/kernel/ptrace.c

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


Re: RunnableQueue InterruptedException

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

    This is a sure sign that you are modifying the
DOM tree outside of the UpdateManager's RunnableQueue.
This can only happen if the GVT tree is modified while
a repaint is happening, as you can see the repaint is
in the RunnableQueue so the DOM modification must be in
some other thread...

Maik Schürer wrote:
> I tried the patch...
> now - after while - at
> RunnableQueue.run()  line 140
>     while (!HaltingThread.hasBeenHalted()) {
> 
> appears
> 
> java.util.ConcurrentModificationException
> at java.util.HashMap$HashIterator.nextEntry(HashMap.java:782)
> at java.util.HashMap$KeyIterator.next(HashMap.java:818)
> at org.apache.batik.gvt.UpdateTracker.getDirtyAreas(UpdateTracker.java:69)
> at 
> org.apache.batik.bridge.UpdateManager.repaint(UpdateManager.java:452)472089
> at 
> org.apache.batik.bridge.UpdateManager$UpdateManagerRunHander.runnableInvoked(UpdateManager.java:590) 
> 
> at 
> org.apache.batik.util.RunnableQueue.runnableInvoked(RunnableQueue.java:489)
> at org.apache.batik.util.RunnableQueue.run(RunnableQueue.java:209)
> at java.lang.Thread.run(Thread.java:534)
> 
> 
> Thomas DeWeese schrieb:
> 
>> Hi Maik,
>>
>>
>>
>> Maik Schürer wrote:
>>
>>> when running my application awhile, sometime in RunnableQueue run() 
>>> method an InterruptedException appears.
>>
>>
>>
>>    I've never seen this myself, but looking at the code I
>> patched a small hole that could cause this.  Please get
>> the CVS version of Batik and see if this solves the problem
>> for you.  Just out of curiosity are you seeing this when
>> using the RunnableQueue from the UpdateManager or are you
>> using it as a general 'job queue'?
>>
>>    Someone would have to be interrupting the thread quite
>> frequently for this bug to appear and currently I don't think
>> Batik uses Thread.interrupt at all due to issues with the class
>> loader in many versions of the JDK.
>>
>>> that means, from there I can't call RunnableQueue.invokeLater()
>>> (because then it throws an IllegalStateException)
>>>
>>> 1) What could be a reason, that the InterruptedException appears ?
>>
>>
>>    Most likely the bug I fixed but something stranger might be
>> happening.
>>
>>> 2) How can I "restart" the RunnableQueue to get the 
>>> runnableQueueThread again ?
>>
>>
>>
>>    This isn't trivial and probably isn't a good idea but you
>> can associate the RunnableQueue instance with a new HaltingThread
>> instance and start the halting thread.  This probably wouldn't work
>> for the RunnableQueue embedded in the UpdateManager because the
>> UpdateManager wouldn't know about the new thread.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
>> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
> 


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


Re: RunnableQueue InterruptedException

Posted by Maik Schürer <Ma...@proveo.de>.
I tried the patch...
now - after while - at
RunnableQueue.run()  line 140
	while (!HaltingThread.hasBeenHalted()) {

appears

java.util.ConcurrentModificationException
at java.util.HashMap$HashIterator.nextEntry(HashMap.java:782)
at java.util.HashMap$KeyIterator.next(HashMap.java:818)
at org.apache.batik.gvt.UpdateTracker.getDirtyAreas(UpdateTracker.java:69)
at 
org.apache.batik.bridge.UpdateManager.repaint(UpdateManager.java:452)472089
at 
org.apache.batik.bridge.UpdateManager$UpdateManagerRunHander.runnableInvoked(UpdateManager.java:590)
at 
org.apache.batik.util.RunnableQueue.runnableInvoked(RunnableQueue.java:489)
at org.apache.batik.util.RunnableQueue.run(RunnableQueue.java:209)
at java.lang.Thread.run(Thread.java:534)


Thomas DeWeese schrieb:
> Hi Maik,
> 
> 
> 
> Maik Schürer wrote:
> 
>> when running my application awhile, sometime in RunnableQueue run() 
>> method an InterruptedException appears.
> 
> 
>    I've never seen this myself, but looking at the code I
> patched a small hole that could cause this.  Please get
> the CVS version of Batik and see if this solves the problem
> for you.  Just out of curiosity are you seeing this when
> using the RunnableQueue from the UpdateManager or are you
> using it as a general 'job queue'?
> 
>    Someone would have to be interrupting the thread quite
> frequently for this bug to appear and currently I don't think
> Batik uses Thread.interrupt at all due to issues with the class
> loader in many versions of the JDK.
> 
>> that means, from there I can't call RunnableQueue.invokeLater()
>> (because then it throws an IllegalStateException)
>>
>> 1) What could be a reason, that the InterruptedException appears ?
> 
>    Most likely the bug I fixed but something stranger might be
> happening.
> 
>> 2) How can I "restart" the RunnableQueue to get the 
>> runnableQueueThread again ?
> 
> 
>    This isn't trivial and probably isn't a good idea but you
> can associate the RunnableQueue instance with a new HaltingThread
> instance and start the halting thread.  This probably wouldn't work
> for the RunnableQueue embedded in the UpdateManager because the
> UpdateManager wouldn't know about the new thread.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
> 


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


Re: RunnableQueue InterruptedException

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



Maik Schürer wrote:
> when running my application awhile, sometime in RunnableQueue run() 
> method an InterruptedException appears.

    I've never seen this myself, but looking at the code I
patched a small hole that could cause this.  Please get
the CVS version of Batik and see if this solves the problem
for you.  Just out of curiosity are you seeing this when
using the RunnableQueue from the UpdateManager or are you
using it as a general 'job queue'?

    Someone would have to be interrupting the thread quite
frequently for this bug to appear and currently I don't think
Batik uses Thread.interrupt at all due to issues with the class
loader in many versions of the JDK.

> that means, from there I can't call RunnableQueue.invokeLater()
> (because then it throws an IllegalStateException)
> 
> 1) What could be a reason, that the InterruptedException appears ?
    Most likely the bug I fixed but something stranger might be
happening.

> 2) How can I "restart" the RunnableQueue to get the runnableQueueThread 
> again ?

    This isn't trivial and probably isn't a good idea but you
can associate the RunnableQueue instance with a new HaltingThread
instance and start the halting thread.  This probably wouldn't work
for the RunnableQueue embedded in the UpdateManager because the
UpdateManager wouldn't know about the new thread.

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


RunnableQueue InterruptedException

Posted by Maik Schürer <Ma...@proveo.de>.
Hi all,
when running my application awhile, sometime in RunnableQueue run() 
method an InterruptedException appears.
Then there the runnableQueueThread is set to null:
...
   } catch (InterruptedException e) {
   } finally {
      synchronized (this) {
         runnableQueueThread = null;
      }
   }
...
that means, from there I can't call RunnableQueue.invokeLater()
(because then it throws an IllegalStateException)

1) What could be a reason, that the InterruptedException appears ?
2) How can I "restart" the RunnableQueue to get the runnableQueueThread 
again ?

Thanks in advance
Maik


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


Re: Help needed for DnD

Posted by grillot sebastien <se...@gmail.com>.
On 08/06/05, Andres Toussaint <an...@onemileup.com> wrote:
> Seb,
Hello Andres (french guy ?),
> 
> I wrote a small tutorial of DnD in a JSVGCanvas, it is posted at the
> batik wiki: http://wiki.apache.org/xmlgraphics-batik/DragTutorial
> 
> If you are more specific as to how do you want to use DnD, i can help
> you with it. There are two different DnD scenarios:
> a.) DnD inside a JSVGCanvas, is to move a SVG Element (or Group) from
> one part of the canvas to another.
> b.) DnD between JComponents, is to select an item, for instance from a
> JTree, and add it to your JSVGCanvas SVG document.
> 

I know and i based my works on it. But... i don't know i have some
diffuclty that i don't understand... it's for these reason that i ask
for an example bigger... i'm a beginner in java AND batik ... lol

regards

> Regards,
> 
> Andres.
> 
> On Jun 8, 2005, at 4:46 AM, grillot sebastien wrote:
> 
> > Hello,
> > I have a problem with the Drag and drog.
> > In fact i think that i don't understand all the method...
> > Can everyone explain completly the method from the begin (the creation
> > of a graphical interface, with object draw on it and the drag and drop
> > solution... in fact a small application...) It's very important for me
> > and i try it from 2 months and i'm block... thanks a milion for your
> > help...
> >
> > regards
> >
> > Seb
> >
> >
> > --
> > Regist. Linux User #344952
> >
> > /* Fuck me gently with a chainsaw... */
> >   -- 2.0.38 /usr/src/linux/arch/sparc/kernel/ptrace.c
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> > For additional commands, e-mail:
> > batik-users-help@xmlgraphics.apache.org
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
> 
> 


-- 
Regist. Linux User #344952

/* Fuck me gently with a chainsaw... */
  -- 2.0.38 /usr/src/linux/arch/sparc/kernel/ptrace.c

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


Re: Help needed for DnD

Posted by Andres Toussaint <an...@onemileup.com>.
Seb,

I wrote a small tutorial of DnD in a JSVGCanvas, it is posted at the 
batik wiki: http://wiki.apache.org/xmlgraphics-batik/DragTutorial

If you are more specific as to how do you want to use DnD, i can help 
you with it. There are two different DnD scenarios:
a.) DnD inside a JSVGCanvas, is to move a SVG Element (or Group) from 
one part of the canvas to another.
b.) DnD between JComponents, is to select an item, for instance from a 
JTree, and add it to your JSVGCanvas SVG document.

Regards,

Andres.

On Jun 8, 2005, at 4:46 AM, grillot sebastien wrote:

> Hello,
> I have a problem with the Drag and drog.
> In fact i think that i don't understand all the method...
> Can everyone explain completly the method from the begin (the creation
> of a graphical interface, with object draw on it and the drag and drop
> solution... in fact a small application...) It's very important for me
> and i try it from 2 months and i'm block... thanks a milion for your
> help...
>
> regards
>
> Seb
>
>
> -- 
> Regist. Linux User #344952
>
> /* Fuck me gently with a chainsaw... */
>   -- 2.0.38 /usr/src/linux/arch/sparc/kernel/ptrace.c
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: 
> batik-users-help@xmlgraphics.apache.org
>
>


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


Re: Help needed for DnD

Posted by grillot sebastien <se...@gmail.com>.
So !

i have differents problems :
Here :

// Set the initial drag point
                DOMMouseEvent elEvt = (DOMMouseEvent)evt;
I said that i can't cast evt to an DOMMouseEvent

SVGMatrix mat = thisNode.getScreenCTM();  

Euuh... what is "thisNode" ?

I'm know.. i'm a boulay MDRRRRRRRRRRRR

... sorry...

Regards


Seb

-- 
Regist. Linux User #344952

/* Fuck me gently with a chainsaw... */
  -- 2.0.38 /usr/src/linux/arch/sparc/kernel/ptrace.c

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


Re: Help needed for DnD

Posted by grillot sebastien <se...@gmail.com>.
Thanks ted,
i read these !

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


Re: Help needed for DnD

Posted by Te...@apcc.com.
Sebastien,

A few weeks ago I asked the same question.
Andres Toussaint pointed me to these references.
They helped me understand how DnD works.

      http://javaalmanac.com/egs/java.awt.dnd/pkg.html
      http://www.rockhoppertech.com/java-drag-and-drop-faq.html
      http://www.javaworld.com/javaworld/jw-03-1999/jw-03-dragndrop.html
      http://java.sun.com/docs/books/tutorial/dnd/

Also, I found this reference which makes a "generic" DnD mechanism.
      http://java.sys-con.com/read/36686.htm
  the example code is here:
      http://photos.sys-con.com/story/res/36686/source.html

Good Luck,
Ted


                                                                           
             grillot sebastien                                             
             <sebastiengrillot                                             
             @gmail.com>                                                To 
                                       batik-users@xmlgraphics.apache.org  
             06/08/2005 04:46                                           cc 
             AM                                                            
                                                                   Subject 
                                       Help needed for DnD                 
             Please respond to                                             
             batik-users@xmlgr                                             
             aphics.apache.org                                             
                                                                           
                                                                           
                                                                           




Hello,
I have a problem with the Drag and drog.
In fact i think that i don't understand all the method...
Can everyone explain completly the method from the begin (the creation
of a graphical interface, with object draw on it and the drag and drop
solution... in fact a small application...) It's very important for me
and i try it from 2 months and i'm block... thanks a milion for your
help...

regards

Seb


--
Regist. Linux User #344952

/* Fuck me gently with a chainsaw... */
  -- 2.0.38 /usr/src/linux/arch/sparc/kernel/ptrace.c

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




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