Interface KeyNotifier

All Superinterfaces:
Serializable
All Known Implementing Classes:
AbstractNumberField, BigDecimalField, EmailField, IntegerField, NumberField, PasswordField, RichTextEditor, TextArea, TextField, TextFieldBase

public interface KeyNotifier extends Serializable
Mixin interface for components that support adding key event listeners to the their root elements.
Since:
1.0
Author:
Vaadin Ltd
  • Method Details

    • addKeyDownListener

      default Registration addKeyDownListener(ComponentEventListener<KeyDownEvent> listener)
      Adds a keydown listener to this component.
      Parameters:
      listener - the listener to add, not null
      Returns:
      a handle that can be used for removing the listener
    • addKeyPressListener

      default Registration addKeyPressListener(ComponentEventListener<KeyPressEvent> listener)
      Adds a keypress listener to this component.
      Parameters:
      listener - the listener to add, not null
      Returns:
      a handle that can be used for removing the listener
    • addKeyUpListener

      default Registration addKeyUpListener(ComponentEventListener<KeyUpEvent> listener)
      Adds a keyup listener to this component.
      Parameters:
      listener - the listener to add, not null
      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 the key and modifiers parameters.

      See Key for common static instances or use Key.of(String, String...) to get an instance from an arbitrary value.

      Parameters:
      key - the key to match
      listener - the listener to add, not null
      modifiers - the optional modifiers to match
      Returns:
      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 the key and modifiers parameters.

      See Key for common static instances or use Key.of(String, String...) to get an instance from an arbitrary value.

      Parameters:
      key - the key to match
      listener - the listener to add, not null
      modifiers - the optional modifiers to match
      Returns:
      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 the key and modifiers parameters.

      See Key for common static instances or use Key.of(String, String...) to get an instance from an arbitrary value.

      Parameters:
      key - the key to match
      listener - the listener to add, not null
      modifiers - the optional modifiers to match
      Returns:
      a handle that can be used for removing the listener