Drag & Drop start event

Hi,

Is there a way to know when a drag event is started?
I only found the

DropHandler.drop(DragAndDropEvent event)

but I need something like:

DropHandler.drag(DragAndDropEvent event)

Thanks for this great framework!
Mihai Cazacu

You could try and checkout this interface:
http://vaadin.com/api/com/vaadin/terminal/gwt/client/ui/dd/VDropHandler.html

I think this is what you were looking for.

The drag can come from somewhere outside the component with a drop handler, even from outside the browser, so it does not really make sense for drop handlers to be notified when someone starts a drag operation somewhere, nor would it always be possible.

The drag source component (if of a suitable type) could provide such an interface, but I guess it does not at the moment.

You’ve right, but this is not my case. I’am working on a chess application and, when a player drag the piece from own square, I need that piece to be removed from the current location while the drop is not finished.

The current behavior is this:

  1. player drag the piece
    1.1 Vaadin creates a copy of that (@see DragAndDropWrapper#setDragStartMode) - but it doesn’t remove the component from the original location
  2. player drop the piece
    2.1 Vaadin call DropHandler#drop method of the destionation component (in this method I can remove the piece from the initial location and put it in the destination)

Please see
Demo 10
.

Yes, indeed but I think that is a must feature to have (of course, only for Vaadin components).

Thanks!

Hi,

DragAndDropWrapper should indeed have a mode that hides the component on dragstart (and makes it visible again if drop was not handled). Have you searched for an enhancement ticket in dev.vaadin.com ? If there ain’t one, feel free to create it.

If you end up implementing the feature by yourself, I’m happy to review and commit your patch.

cheers,
matti

Perhaps you could use ServerSideCriterion and on first accept() call make the component invisible, or something like that.