T
- Type of the component that was dragged.@DomEvent(value="dragend") public class DragEndEvent<T extends Component> extends ComponentEvent<T>
DragSource.addDragEndListener(com.vaadin.flow.component.ComponentEventListener)
,
Serialized Formsource
Constructor and Description |
---|
DragEndEvent(T source,
boolean fromClient,
String dropEffect)
Creates a drag end event.
|
Modifier and Type | Method and Description |
---|---|
void |
clearDragData()
Clears the drag data for this drag operation (and the drag source
component).
|
T |
getComponent()
Returns the drag source component where the dragend event occurred.
|
DropEffect |
getDropEffect()
Get drop effect of the dragend event.
|
boolean |
isSuccessful()
Returns whether the drop event succesful or was it cancelled or didn't
succeed.
|
getSource, isFromClient, unregisterListener
toString
public DragEndEvent(T source, boolean fromClient, @EventData(value="event.dataTransfer.dropEffect") String dropEffect)
source
- Component that was dragged.fromClient
- true
if the event originated from the client
side, false
otherwisedropEffect
- Drop effect from DataTransfer.dropEffect
object.public DropEffect getDropEffect()
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.
DataTransfer.dropEffect
parameter of the client side
dragend event.DragSource.setEffectAllowed(EffectAllowed)
,
DropTarget.setDropEffect(DropEffect)
public boolean isSuccessful()
dropEffect != NONE
.
NOTE: For Edge, Safari and IE11 this method will always
report false
due to bugs in the browsers!true
if the drop event succeeded, false
otherwise.public T getComponent()
public void clearDragData()
This method is a shorthand for calling
DragSource.setDragData(Object)
with null
parameter.
Copyright © 2022. All rights reserved.