Class DragEndEvent<T extends Component>

java.lang.Object
java.util.EventObject
com.vaadin.flow.component.ComponentEvent<T>
com.vaadin.flow.component.dnd.DragEndEvent<T>
Type Parameters:
T - Type of the component that was dragged.
All Implemented Interfaces:
Serializable

@DomEvent("dragend") public class DragEndEvent<T extends Component> extends ComponentEvent<T>
HTML5 drag end event, fired when the user stops dragging a drag source either by dropping on top of a valid drop target or by canceling to drop.
Since:
2.0
Author:
Vaadin Ltd
See Also:
  • Constructor Details

    • DragEndEvent

      public DragEndEvent(T source, boolean fromClient, @EventData("event.dataTransfer.dropEffect") String dropEffect)
      Creates a drag end event.
      Parameters:
      source - Component that was dragged.
      fromClient - true if the event originated from the client side, false otherwise
      dropEffect - Drop effect from DataTransfer.dropEffect object.
  • Method Details

    • getDropEffect

      public DropEffect getDropEffect()
      Get drop effect of the dragend event. The value will be in priority order: the desired action set by the drop target, effectAllowed parameter of the drag source and modifier keys the user presses. NOTE: there are some browser specific differences to this - Chrome does not change the drop effect based on modifier keys but only what the drop target sets.

      If the drop is not successful, the value will be NONE.

      In case the desired drop effect is MOVE, the data being dragged should be removed from the source.

      Returns:
      The DataTransfer.dropEffect parameter of the client side dragend event.
      See Also:
    • isSuccessful

      public boolean isSuccessful()
      Returns whether the drop event succesful or was it cancelled or didn't succeed. This is a shorthand for dropEffect != NONE. NOTE: For Edge, Safari and IE11 this method will always report false due to bugs in the browsers!
      Returns:
      true if the drop event succeeded, false otherwise.
      Since:
      2.1
    • getComponent

      public T getComponent()
      Returns the drag source component where the dragend event occurred.
      Returns:
      Component which was dragged.
    • clearDragData

      public void clearDragData()
      Clears the drag data for this drag operation (and the drag source component).

      This method is a shorthand for calling DragSource.setDragData(Object) with null parameter.

      See Also: