PDA

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



pete_by
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()) {
@SuppressWarnings("unchecked")
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.

darrellmeyer
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.

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