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 forKeyboardEvents.- Since:
- 1.0
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description KeyEventListener(ComponentEventListener<E> listener, Key key, KeyModifier... modifiers)Create a listener which will delegate tolisteneronly ifkeyis the target key.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidonComponentEvent(E event)Invoked when a component event has been fired.
-
-
-
Constructor Detail
-
KeyEventListener
public KeyEventListener(ComponentEventListener<E> listener, Key key, KeyModifier... modifiers)
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 Detail
-
onComponentEvent
public void onComponentEvent(E event)
Description copied from interface:ComponentEventListenerInvoked when a component event has been fired.- Specified by:
onComponentEventin interfaceComponentEventListener<E extends KeyboardEvent>- Parameters:
event- component event
-
-