Closed GoogleCodeExporter closed 9 years ago
Thanks for reporting this.
This is by design though. The application should do it's own bookkeeping.
Masking a
double call to makeNotDraggable() could potentially mask bigger bugs in other
apps.
"Fail early"
Original comment by fredsa@google.com
on 1 Dec 2009 at 7:00
[deleted comment]
I'll disagree. There is nothing fail fast about this.
try {
canvas.makeNotDraggable(widget);
}
catch(Exception e) {
// do what?, nothing, who cares
}
In any AbstractCollection an object is removed if found. The only case to throw
an
exception is if the remove method is not supported by the collection. The only
difference is draggable is stored as a Map which returns null if the key
doesn't
exist (the implementation should be hidden by the API anyways).
I could produce the same exception by calling makeNotDraggable on the same
widget
twice. The object would be removed the first call then throw an exception the
second.
Why do I have to maintain my own list to make sure I don't incidentally call
the
wrong method?
Original comment by bbla...@gmail.com
on 2 Dec 2009 at 3:53
The fail fast is that when you code calls makeNotDraggable on a widget which is
not in
fact draggable, an exception is thrown immediately.
The alternative is that your application runs into the inaccurate book keeping
at some
later point in your application.
I realize neither case is perfect for everyone. In this case the trade off in
gwt-dnd is
made as currently implemented.
Original comment by fredsa@google.com
on 2 Dec 2009 at 5:12
Original issue reported on code.google.com by
bbla...@gmail.com
on 30 Nov 2009 at 4:18