com.vaadin.flow.component.
Class ShortcutEvent
- java.lang.Object
-
- java.util.EventObject
-
- com.vaadin.flow.component.ShortcutEvent
-
All Implemented Interfaces:
public class ShortcutEvent extends EventObject implements 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
Constructors Constructor Description ShortcutEvent(Component source, Component lifecycleOwner, Key key, Set<KeyModifier> keyModifiers)
Creates a new
ShortcutEvent
.
-
Method Summary
All Methods Modifier and Type Method Description Key
getKey()
Primary
Key
that triggered the shortcut.Set<KeyModifier>
getKeyModifiers()
Set of
KeyModifiers
that, in combination with the primary key, triggered the shortcut.Component
getLifecycleOwner()
Component which owns the shortcut.
Component
getSource()
Component which listened for the shortcut.
boolean
matches(Key key, KeyModifier... keyModifiers)
Checks if the event matches the given
Key
and (optional)KeyModifiers
.-
Methods inherited from class java.util.EventObject
toString
-
-
-
-
Constructor Detail
-
ShortcutEvent
public ShortcutEvent(Component source, Component lifecycleOwner, Key key, Set<KeyModifier> keyModifiers)
Creates a new
ShortcutEvent
.Parameters:
source
- shortcut'slistenOn
Component
lifecycleOwner
- shortcut'slifecycleOwner
Component
key
- primaryKey
of the shortcutkeyModifiers
- set ofKeyModifiers
of the shortcut
-
-
Method Detail
-
getSource
public Component getSource()
Component which listened for the shortcut.
Overrides:
getSource
in classEventObject
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 aKeyModifier
.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
. Ifkey
is null or a wrong number ofkeyModifiers
is given, returnsfalse
.Parameters:
key
-key
to comparekeyModifiers
-keyModifiers
to compareReturns:
Did the given parameters match those in the event?
-
-