Package com.vaadin.flow.component.dnd
Class DragStartEvent<T extends com.vaadin.flow.component.Component>
java.lang.Object
java.util.EventObject
com.vaadin.flow.component.ComponentEvent<T>
com.vaadin.flow.component.dnd.AbstractDnDEvent<T>
com.vaadin.flow.component.dnd.DragStartEvent<T>
- Type Parameters:
T- Type of the component that is dragged.
- All Implemented Interfaces:
Serializable
@DomEvent("dragstart")
public class DragStartEvent<T extends com.vaadin.flow.component.Component>
extends AbstractDnDEvent<T>
HTML5 drag start event, fired when the user starts dragging a drag source.
- Since:
- 2.0
- Author:
- Vaadin Ltd
- See Also:
-
Field Summary
Fields inherited from class java.util.EventObject
source -
Constructor Summary
ConstructorsConstructorDescriptionDragStartEvent(T source, boolean fromClient, int clientX, int clientY, int offsetX, int offsetY) Creates a drag start event. -
Method Summary
Modifier and TypeMethodDescriptionintGets the x coordinate of the mouse pointer relative to the drag source element when the drag started.intGets the y coordinate of the mouse pointer relative to the drag source element when the drag started.voidsetDragData(Object data) Set server side drag data for this started drag operation.Methods inherited from class com.vaadin.flow.component.dnd.AbstractDnDEvent
getClientX, getClientY, getComponentMethods inherited from class com.vaadin.flow.component.ComponentEvent
getSource, isFromClient, unregisterListenerMethods inherited from class java.util.EventObject
toString
-
Constructor Details
-
DragStartEvent
public DragStartEvent(T source, boolean fromClient, @EventData("event.clientX") int clientX, @EventData("event.clientY") int clientY, @EventData("event.offsetX") int offsetX, @EventData("event.offsetY") int offsetY) Creates a drag start event.- Parameters:
source- Component that is dragged.fromClient-trueif the event originated from the client side,falseotherwiseclientX- the x coordinate of the mouse pointer relative to the viewportclientY- the y coordinate of the mouse pointer relative to the viewportoffsetX- the x coordinate of the mouse pointer relative to the drag source elementoffsetY- the y coordinate of the mouse pointer relative to the drag source element
-
-
Method Details
-
getOffsetX
public int getOffsetX()Gets the x coordinate of the mouse pointer relative to the drag source element when the drag started.This is useful for maintaining the relative grab position when positioning dropped items.
- Returns:
- the x coordinate relative to the drag source element
- Since:
- 25.1
-
getOffsetY
public int getOffsetY()Gets the y coordinate of the mouse pointer relative to the drag source element when the drag started.This is useful for maintaining the relative grab position when positioning dropped items.
- Returns:
- the y coordinate relative to the drag source element
- Since:
- 25.1
-
setDragData
Set server side drag data for this started drag operation. This data is available in the drop event and can be used to transfer data between drag source andDropTargetif they are in the same UI.This method is a shorthand for
DragSource.setDragData(Object)and overrides any previously set drag data.- Parameters:
data- Data to transfer to drop event.- See Also:
-