Class MouseEventTrigger
java.lang.Object
com.vaadin.flow.component.trigger.internal.Trigger
com.vaadin.flow.component.trigger.internal.DomEventTrigger
com.vaadin.flow.component.trigger.internal.MouseEventTrigger
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
ClickTrigger,DoubleClickTrigger
Common super class for triggers that fire on a DOM
MouseEvent —
ClickTrigger, DoubleClickTrigger, and any future mouse-event
trigger. Exposes the MouseEvent properties shared by all of them as
static Action.Input fields on MouseEventTrigger.EventData.
The EventData fields are bound to MouseEventTrigger.class, so
the same field instance can be used as the source for any
MouseEventTrigger subclass — both snippets below mirror the click's
screen X coordinate into xField.value, one on single click, one on
double click:
ClickTrigger click = new ClickTrigger(button);
click.triggers(new SetPropertyAction<>(xField, "value",
ClickTrigger.EventData.screenX));
DoubleClickTrigger dbl = new DoubleClickTrigger(button);
dbl.triggers(new SetPropertyAction<>(xField, "value",
DoubleClickTrigger.EventData.screenX));
For internal use only. May be renamed or removed in a future release.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classTheMouseEventproperties exposed as staticAction.Inputsources. -
Constructor Summary
ConstructorsConstructorDescriptionMouseEventTrigger(Component host, String eventName) Creates a mouse-event trigger that fires when the host receives a DOM event with the given name. -
Method Summary
Methods inherited from class com.vaadin.flow.component.trigger.internal.DomEventTrigger
install
-
Constructor Details
-
MouseEventTrigger
Creates a mouse-event trigger that fires when the host receives a DOM event with the given name. Subclasses such asClickTriggerbind a specific event name; instantiate this class directly only when none of the dedicated subclasses fits (e.g. for"mouseover").- Parameters:
host- the component whose root element listens for the event, notnulleventName- the DOM mouse-event name (e.g."click","mousedown"), notnull
-