com.vaadin.flow.component.dnd.
Class DropEvent<T extends Component>
- java.lang.Object
-
- java.util.EventObject
-
- com.vaadin.flow.component.ComponentEvent<T>
-
- com.vaadin.flow.component.dnd.DropEvent<T>
-
Type Parameters:
T
- Type of the drop target component.All Implemented Interfaces:
@DomEvent(value="drop") public class DropEvent<T extends Component> extends ComponentEvent<T>
Server side drop event. Fired when an HTML5 drop happens on a valid drop target.
Since:
2.0
Author:
Vaadin Ltd, Vaadin Ltd
See Also:
DropTarget.addDropListener(com.vaadin.flow.component.ComponentEventListener)
, Serialized Form
-
-
Field Summary
-
Fields inherited from class java.util.EventObject
source
-
-
Constructor Summary
Constructors Constructor and Description DropEvent(T source, boolean fromClient, String effectAllowed)
Creates a server side drop event.
-
Method Summary
All Methods Modifier and Type Method and Description T
getComponent()
Returns the drop target component where the drop event occurred.
Optional<Object>
getDragData()
Gets the server side drag data.
Optional<Component>
getDragSourceComponent()
Returns the drag source component if the drag originated from a component in the same UI as the drop target component, or an empty optional.
DropEffect
getDropEffect()
Get the desired
dropEffect
for the drop event.EffectAllowed
getEffectAllowed()
Get the
effectAllowed
set by the drag source.-
Methods inherited from class com.vaadin.flow.component.ComponentEvent
getSource, isFromClient, unregisterListener
-
Methods inherited from class java.util.EventObject
toString
-
-
-
-
Constructor Detail
-
DropEvent
public DropEvent(T source, boolean fromClient, @EventData(value="event.dataTransfer.effectAllowed") String effectAllowed)
Creates a server side drop event.
Parameters:
source
- Component that received the drop.fromClient
-true
if the event originated from the client side,false
otherwiseeffectAllowed
- the effect allowed by the drag source
-
-
Method Detail
-
getDragData
public Optional<Object> getDragData()
Gets the server side drag data. This data can be set during the drag start event on the server side and can be used to transfer data between drag source and drop target when they are in the same UI.
Returns:
Optional server side drag data if set and the drag source and the drop target are in the same UI, otherwise empty
Optional
.
-
getDropEffect
public DropEffect getDropEffect()
Get the desired
dropEffect
for the drop event.Returns:
the drop effect set to the drop target, or null if nothing set
See Also:
-
getEffectAllowed
public EffectAllowed getEffectAllowed()
Get the
effectAllowed
set by the drag source.Returns:
the effect allowed by the drag source
See Also:
-
getDragSourceComponent
public Optional<Component> getDragSourceComponent()
Returns the drag source component if the drag originated from a component in the same UI as the drop target component, or an empty optional.
Returns:
Drag source component from the same UI or an empty optional.
-
getComponent
public T getComponent()
Returns the drop target component where the drop event occurred.
Returns:
Component on which a drag source was dropped.
-
-