Package com.vaadin.flow.component.dnd
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
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:
-
Field Summary
Fields inherited from class java.util.EventObject
source -
Constructor Summary
ConstructorsConstructorDescriptionDragEndEvent(T source, boolean fromClient, String dropEffect) Creates a drag end event. -
Method Summary
Modifier and TypeMethodDescriptionvoidClears the drag data for this drag operation (and the drag source component).Returns the drag source component where the dragend event occurred.Get drop effect of the dragend event.booleanReturns whether the drop event succesful or was it cancelled or didn't succeed.Methods inherited from class com.vaadin.flow.component.ComponentEvent
getSource, isFromClient, unregisterListenerMethods inherited from class java.util.EventObject
toString
-
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-trueif the event originated from the client side,falseotherwisedropEffect- Drop effect fromDataTransfer.dropEffectobject.
-
-
Method Details
-
getDropEffect
Get drop effect of the dragend event. The value will be in priority order: the desired action set by the drop target,effectAllowedparameter 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.dropEffectparameter 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 fordropEffect != NONE. NOTE: For Edge, Safari and IE11 this method will always reportfalsedue to bugs in the browsers!- Returns:
trueif the drop event succeeded,falseotherwise.- Since:
- 2.1
-
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)withnullparameter.
-