View Full Version : [FIXED] TreeDropTarget throws ClassCastException in showFeedback (Tree / TreeGrid cast)

29 Nov 2011, 12:21 PM
When a tree used as source and target widget in drag and drop operation, showFeedback may throw ClassCastException: cannot cast Tree to TreeGrid.
The problem lines are the following:

if (item != null && event.getDropTarget().getWidget() == event.getDragSource().getWidget()) {
TreeGrid<M> source = (TreeGrid<M>) event.getDragSource().getWidget(); // CCE!
List<M> list = source.getSelectionModel().getSelection();

The problem that drag source is not a TreeGrid's implementation but rather Tree's one, though both of them have getSelectionModel method.

Colin Alworth
30 Nov 2011, 3:59 PM
Thanks - there are a few other TreeGrid references in that class that don't make sense either. We'll update the thread when we have a fix available.

6 Dec 2011, 11:30 AM
This is fixed in SVN (rev 1969). We have also added reordering tree and treegrid examples to the explorer demo. Changes will go out in our beta release this week.

12 Dec 2011, 6:54 PM
Fixed in beta 1.