com.vaadin.flow.component.
Interface KeyNotifier
All Superinterfaces:
All Known Implementing Classes:
AbstractNumberField
, BigDecimalField
, EmailField
, IntegerField
, NumberField
, PasswordField
, RichTextEditor
, TextArea
, TextField
, TextFieldBase
Mixin interface for components that support adding key event listeners to the their root elements.
Since:
1.0
Author:
Vaadin Ltd
-
Method Summary
Modifier and TypeMethodDescriptiondefault Registration
addKeyDownListener
(ComponentEventListener<KeyDownEvent> listener) Adds a
keydown
listener to this component.default Registration
addKeyDownListener
(Key key, ComponentEventListener<KeyDownEvent> listener, KeyModifier... modifiers) Adds a
keydown
listener to this component, which will trigger only if the keys involved in the event match thekey
andmodifiers
parameters.default Registration
Adds a
keypress
listener to this component.default Registration
addKeyPressListener
(Key key, ComponentEventListener<KeyPressEvent> listener, KeyModifier... modifiers) Adds a
keypress
listener to this component, which will trigger only if the keys involved in the event match thekey
andmodifiers
parameters.default Registration
addKeyUpListener
(ComponentEventListener<KeyUpEvent> listener) Adds a
keyup
listener to this component.default Registration
addKeyUpListener
(Key key, ComponentEventListener<KeyUpEvent> listener, KeyModifier... modifiers) Adds a
keyup
listener to this component, which will trigger only if the keys involved in the event match thekey
andmodifiers
parameters.
-
Method Details
-
addKeyDownListener
Adds a
keydown
listener to this component.Parameters:
listener
- the listener to add, notnull
Returns:
a handle that can be used for removing the listener
-
addKeyPressListener
Adds a
keypress
listener to this component.Parameters:
listener
- the listener to add, notnull
Returns:
a handle that can be used for removing the listener
-
addKeyUpListener
Adds a
keyup
listener to this component.Parameters:
listener
- the listener to add, notnull
Returns:
a handle that can be used for removing the listener
-
addKeyDownListener
default Registration addKeyDownListener(Key key, ComponentEventListener<KeyDownEvent> listener, KeyModifier... modifiers) Adds a
keydown
listener to this component, which will trigger only if the keys involved in the event match thekey
andmodifiers
parameters.See
Key
for common static instances or useKey.of(String, String...)
to get an instance from an arbitrary value.Parameters:
key
- the key to matchlistener
- the listener to add, notnull
modifiers
- the optional modifiers to matchReturns:
a handle that can be used for removing the listener
-
addKeyPressListener
default Registration addKeyPressListener(Key key, ComponentEventListener<KeyPressEvent> listener, KeyModifier... modifiers) Adds a
keypress
listener to this component, which will trigger only if the keys involved in the event match thekey
andmodifiers
parameters.See
Key
for common static instances or useKey.of(String, String...)
to get an instance from an arbitrary value.Parameters:
key
- the key to matchlistener
- the listener to add, notnull
modifiers
- the optional modifiers to matchReturns:
a handle that can be used for removing the listener
-
addKeyUpListener
default Registration addKeyUpListener(Key key, ComponentEventListener<KeyUpEvent> listener, KeyModifier... modifiers) Adds a
keyup
listener to this component, which will trigger only if the keys involved in the event match thekey
andmodifiers
parameters.See
Key
for common static instances or useKey.of(String, String...)
to get an instance from an arbitrary value.Parameters:
key
- the key to matchlistener
- the listener to add, notnull
modifiers
- the optional modifiers to matchReturns:
a handle that can be used for removing the listener
-