
Originally Posted by
Colin Alworth
The DndDropEvent is not designed to be canceled, as it is notification that a drop is happening. Instead, you should monitor the progress of the drag and update the status to indicate that a potential drop at this time could be successful or could fail. This provides your user with constant feedback, instead of only discovering that a drop fails when they actually release the mouse.
Two main ways you can achieve this - either subclass the DropTarget type you are using, or handle events from that drop target, and update the StatusProxy's via the setStatus method to mark that it may be dropped or not.
what do you mean by handle events from that drop target? What event do I need to handle? I tried the following and it does not work.
Code:
target.addDragEnterHandler(new DndDragEnterHandler(){
@Override
public void onDragEnter(DndDragEnterEvent event) {
event.setCancelled(true);
event.getStatusProxy().setStatus(false);
System.out.println("drag enter! false");
}
});