ConcurrentModificationException when updating a DragAndDropCellList

16 views
Skip to first unread message

Romain Kolb

unread,
Feb 20, 2012, 10:23:03 AM2/20/12
to gwtq...@googlegroups.com
Hello,

I'm using the DND bundle (v1.0.5) to manage drag'n'dropping between different CellLists. The CellLists represent a hierarchy of folders with root folders, sub folders and files :

Root folder 1
|-->Sub folder 1
|     |--> File 1
|     |--> File 2
|--> Sub folder 2
Root folder 2
|--> Sub folder 3
|...

I've got 2 PopupWidgets (each containing a DragAndDropCellList), one for the subfolders list and one for the files list. When I hover over a root folder, the subfolder PopupWidget's CellList is updated with the subfolders of the root folder, and the PopupWidget is shown next to the root folder.

My goal is to be able to move files and subfolders by drag'n'dropping them around. I started from the CellList example and it's working rather well, but I'm encountering an issue when moving subfolders :
- Hover Root folder 1 => subfolder PopupWidget updates its CellList with the subfolders of root folder 1, opens next to root folder 1
- Drag a sub folder to the root folders CellList
- Still dragging, hover root folder 2

What I expect to happen :
- subfolder PopupWidget closes, updates its CellList with the subfolders of root folder 2, then opens next to root folder 2
- I can continue dragging the subfolder to the subfolder PopupWidget

Instead I get the following exception, and the dragged subfolder gets stucked :

java.util.ConcurrentModificationException: null
    at java.util.AbstractList$Itr.checkForComodification(AbstractList.java:372)
    at java.util.AbstractList$Itr.next(AbstractList.java:343)
    at gwtquery.plugins.droppable.client.DragAndDropManagerImpl.drag(DragAndDropManagerImpl.java:85)
    at gwtquery.plugins.draggable.client.Draggable.mouseDragImpl(Draggable.java:464)
    at gwtquery.plugins.draggable.client.Draggable.mouseDrag(Draggable.java:287)
    at com.google.gwt.query.client.plugins.MousePlugin.mouseMove(MousePlugin.java:164)
    at com.google.gwt.query.client.plugins.MousePlugin$3.f(MousePlugin.java:217)
    at com.google.gwt.query.client.Function.f(Function.java:178)

My guess is that the CellList is updating while gquery does its magic, any idea how I could correct or work around the issue ?

Thanks in advance,

Romain

Julien Dramaix

unread,
Feb 22, 2012, 5:24:46 AM2/22/12
to gwtq...@googlegroups.com
I guess your subfolders in the CellList are also drop targets ?

The problem is that you are modifying the list of drop targets during
a drag operation.
Try to call :
DragAndDropManager.getInstance().update(ctx);
just after you modify the list of subfolder (when the mouse hovers
another root folder)

Let's me know if it works,

Julien

> --
> You received this message because you are subscribed to the Google Groups
> "gwtquery" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/gwtquery/-/6kwG_JlzJHQJ.
> To post to this group, send email to gwtq...@googlegroups.com.
> To unsubscribe from this group, send email to
> gwtquery+u...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/gwtquery?hl=en.

Romain Kolb

unread,
Feb 23, 2012, 5:02:28 AM2/23/12
to gwtq...@googlegroups.com
Hello,

In dnd-bundle 1.0.5, DragAndDropManager doesn't have an update(DragContext ctx) method, only update() (which doesn't seem to fix my problem).
I found it in the trunk of the Droppable Plugin however. Should I build and use the head version of the bundle ? Is it stable enough to be used in production ?
Another question : how should I get a reference to the DragContext when calling update(ctx) ?

Thanks a lot for this project and quick support, I really appreciate it.

Julien Dramaix

unread,
Apr 2, 2012, 9:25:21 AM4/2/12
to gwtq...@googlegroups.com
> Should I build and
> use the head version of the bundle ? Is it stable enough to be used in
> production ?
Nope, the trunk is in development and I can't promise that the code is stable...

> Another question : how should I get a reference to the DragContext
> when calling update(ctx) ?

the DragContext is passed as parameters in all event handlers.


I apologize for the delay of my reply

Julien

> --
> You received this message because you are subscribed to the Google Groups
> "gwtquery" group.
> To view this discussion on the web visit

> https://groups.google.com/d/msg/gwtquery/-/xcXmRO-lTm4J.

Reply all
Reply to author
Forward
0 new messages