com.vaadin.flow.component.

Class ShortcutEvent

java.lang.Object
java.util.EventObject
com.vaadin.flow.component.ShortcutEvent

All Implemented Interfaces:

Serializable

public class ShortcutEvent extends EventObject implements Serializable

Event when shortcut is detected.

Since:

1.3

Author:

Vaadin Ltd.

See Also:

  • Constructor Details

    • ShortcutEvent

      public ShortcutEvent(Component source, Component lifecycleOwner, Key key, Set<KeyModifier> keyModifiers)

      Creates a new ShortcutEvent.

      Parameters:

      source - shortcut's listenOn Component

      lifecycleOwner - shortcut's lifecycleOwner Component

      key - primary Key of the shortcut

      keyModifiers - set of KeyModifiers of the shortcut

  • Method Details

    • getSource

      public Component getSource()

      Component which listened for the shortcut.

      Overrides:

      getSource in class EventObject

      Returns:

      listening Component

    • getLifecycleOwner

      public Component getLifecycleOwner()

      Component which owns the shortcut.

      Returns:

      owning Component

    • getKey

      public Key getKey()

      Primary Key that triggered the shortcut. Primary key can be anything that is not a KeyModifier.

      Returns:

      primary key

    • getKeyModifiers

      public Set<KeyModifier> getKeyModifiers()

      Set of KeyModifiers that, in combination with the primary key, triggered the shortcut.

      Returns:

      set of key modifiers

    • matches

      public boolean matches(Key key, KeyModifier... keyModifiers)

      Checks if the event matches the given Key and (optional) KeyModifiers. If key is null or a wrong number of keyModifiers is given, returns false.

      Parameters:

      key - key to compare

      keyModifiers - keyModifiers to compare

      Returns:

      Did the given parameters match those in the event?