Package com.vaadin.flow.component.dnd
Class AbstractDnDEvent<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>
- Type Parameters:
T- Type of the component associated with the event.
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
DragEndEvent,DragStartEvent,DropEvent
public abstract class AbstractDnDEvent<T extends com.vaadin.flow.component.Component>
extends com.vaadin.flow.component.ComponentEvent<T>
Abstract base class for HTML5 drag and drop events.
In the browser, drag events inherit from MouseEvent, so this class
provides access to common mouse event properties like cursor coordinates.
- Since:
- 25.1
- Author:
- Vaadin Ltd
- See Also:
-
Field Summary
Fields inherited from class java.util.EventObject
source -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractDnDEvent(T source, boolean fromClient, int clientX, int clientY) Creates a new drag and drop event. -
Method Summary
Modifier and TypeMethodDescriptionintGets the x coordinate of the mouse pointer relative to the viewport, excluding any scroll offset.intGets the y coordinate of the mouse pointer relative to the viewport, excluding any scroll offset.Returns the component associated with this event.Methods inherited from class com.vaadin.flow.component.ComponentEvent
getSource, isFromClient, unregisterListenerMethods inherited from class java.util.EventObject
toString
-
Constructor Details
-
AbstractDnDEvent
Creates a new drag and drop event.- Parameters:
source- the component that is the source of the eventfromClient-trueif the event originated from the client side,falseotherwiseclientX- the x coordinate of the mouse pointer relative to the viewport, excluding any scroll offsetclientY- the y coordinate of the mouse pointer relative to the viewport, excluding any scroll offset
-
-
Method Details
-
getClientX
public int getClientX()Gets the x coordinate of the mouse pointer relative to the viewport, excluding any scroll offset.This is useful for positioning elements based on where the drag/drop operation occurred.
- Returns:
- the x coordinate relative to the viewport
-
getClientY
public int getClientY()Gets the y coordinate of the mouse pointer relative to the viewport, excluding any scroll offset.This is useful for positioning elements based on where the drag/drop operation occurred.
- Returns:
- the y coordinate relative to the viewport
-
getComponent
Returns the component associated with this event.- Returns:
- the component associated with this event
-