Package com.vaadin.flow.component
Class ShortcutEvent
java.lang.Object
java.util.EventObject
com.vaadin.flow.component.ShortcutEvent
- All Implemented Interfaces:
Serializable
Event when shortcut is detected.
- Since:
- 1.3
- Author:
- Vaadin Ltd.
- See Also:
-
Field Summary
Fields inherited from class java.util.EventObject
source
-
Constructor Summary
ConstructorDescriptionShortcutEvent
(Component source, Component lifecycleOwner, Key key, Set<KeyModifier> keyModifiers) Creates a newShortcutEvent
. -
Method Summary
Modifier and TypeMethodDescriptiongetKey()
PrimaryKey
that triggered the shortcut.Set ofKeyModifiers
that, in combination with the primary key, triggered the shortcut.Component which owns the shortcut.Component which listened for the shortcut.boolean
matches
(Key key, KeyModifier... keyModifiers) Checks if the event matches the givenKey
and (optional)KeyModifiers
.Methods inherited from class java.util.EventObject
toString
-
Constructor Details
-
ShortcutEvent
public ShortcutEvent(Component source, Component lifecycleOwner, Key key, Set<KeyModifier> keyModifiers) Creates a newShortcutEvent
.- Parameters:
source
- shortcut'slistenOn
Component
lifecycleOwner
- shortcut'slifecycleOwner
Component
key
- primaryKey
of the shortcutkeyModifiers
- set ofKeyModifiers
of the shortcut
-
-
Method Details
-
getSource
Component which listened for the shortcut.- Overrides:
getSource
in classEventObject
- Returns:
- listening
Component
-
getLifecycleOwner
Component which owns the shortcut.- Returns:
- owning
Component
-
getKey
PrimaryKey
that triggered the shortcut. Primary key can be anything that is not aKeyModifier
.- Returns:
- primary key
-
getKeyModifiers
Set ofKeyModifiers
that, in combination with the primary key, triggered the shortcut.- Returns:
- set of key modifiers
-
matches
Checks if the event matches the givenKey
and (optional)KeyModifiers
. Ifkey
is null or a wrong number ofkeyModifiers
is given, returnsfalse
.- Parameters:
key
-key
to comparekeyModifiers
-keyModifiers
to compare- Returns:
- Did the given parameters match those in the event?
-