According to the HTML5 drag & drop spec, element having dragOver listener and calling preventDefault on it's parameter event tells the browser that this element is a valid drop target.
So, like this:
function onDragOver(event) {
event.preventDefault();
}
If the element does not want to accept the drop, preventDefault is not called.
Now I tried to do the same with GWT's DragOverHandler.
DragOverHandler dragOverHandler = new DragOverHandler() {
@Override
public void onDragOver(DragOverEvent event) {
event.preventDefault();
}
};
flowPanel.addBitlessDomHandler(dragOverHandler, DragOverEvent.getType());
Now the problem is that that panel always indicates itself as a drop target, regardless whether I call preventDefault or not. Only by not adding the handler does the panel refuse drop operations. So for some reason just by simply adding a DragOverHandler to a GWT widget makes it accept drag operations. Thus making it impossible for me indicate for user what can be dragged and what not.
-- So, like this:
function onDragOver(event) {
event.preventDefault();
}
If the element does not want to accept the drop, preventDefault is not called.
Now I tried to do the same with GWT's DragOverHandler.
DragOverHandler dragOverHandler = new DragOverHandler() {
@Override
public void onDragOver(DragOverEvent event) {
event.preventDefault();
}
};
flowPanel.addBitlessDomHandler(dragOverHandler, DragOverEvent.getType());
Now the problem is that that panel always indicates itself as a drop target, regardless whether I call preventDefault or not. Only by not adding the handler does the panel refuse drop operations. So for some reason just by simply adding a DragOverHandler to a GWT widget makes it accept drag operations. Thus making it impossible for me indicate for user what can be dragged and what not.
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment