Package com.vaadin.flow.component
Class KeyEventListener<E extends KeyboardEvent>
java.lang.Object
com.vaadin.flow.component.KeyEventListener<E>
- Type Parameters:
E
- the type of theKeyboardEvent
- All Implemented Interfaces:
ComponentEventListener<E>
,Serializable
,EventListener
public class KeyEventListener<E extends KeyboardEvent>
extends Object
implements ComponentEventListener<E>
A conditional event listener for
KeyboardEvent
s.- Since:
- 1.0
- See Also:
-
Constructor Summary
ConstructorDescriptionKeyEventListener
(ComponentEventListener<E> listener, Key key, KeyModifier... modifiers) Create a listener which will delegate tolistener
only ifkey
is the target key. -
Method Summary
Modifier and TypeMethodDescriptionvoid
onComponentEvent
(E event) Invoked when a component event has been fired.
-
Constructor Details
-
KeyEventListener
Create a listener which will delegate tolistener
only ifkey
is the target key. If anymodifiers
is required, the delegation occurs only if all the modifiers keys where pressed.- Parameters:
listener
- the listener to delegatekey
- the key to checkmodifiers
- the optional modifier keys
-
-
Method Details
-
onComponentEvent
Description copied from interface:ComponentEventListener
Invoked when a component event has been fired.- Specified by:
onComponentEvent
in interfaceComponentEventListener<E extends KeyboardEvent>
- Parameters:
event
- component event
-