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
KeyboardEvents.- Since:
- 1.0
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionKeyEventListener(ComponentEventListener<E> listener, Key key, KeyModifier... modifiers) Create a listener which will delegate tolisteneronly ifkeyis the target key. -
Method Summary
Modifier and TypeMethodDescriptionvoidonComponentEvent(E event) Invoked when a component event has been fired.
-
Constructor Details
-
KeyEventListener
Create a listener which will delegate tolisteneronly ifkeyis the target key. If anymodifiersis 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:ComponentEventListenerInvoked when a component event has been fired.- Specified by:
onComponentEventin interfaceComponentEventListener<E extends KeyboardEvent>- Parameters:
event- component event
-