Package 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:
- Serialized Form
-
-
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 newShortcutEvent.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description KeygetKey()PrimaryKeythat triggered the shortcut.Set<KeyModifier>getKeyModifiers()Set ofKeyModifiersthat, in combination with the primary key, triggered the shortcut.ComponentgetLifecycleOwner()Component which owns the shortcut.ComponentgetSource()Component which listened for the shortcut.booleanmatches(Key key, KeyModifier... keyModifiers)Checks if the event matches the givenKeyand (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 newShortcutEvent.- Parameters:
source- shortcut'slistenOnComponentlifecycleOwner- shortcut'slifecycleOwnerComponentkey- primaryKeyof the shortcutkeyModifiers- set ofKeyModifiersof the shortcut
-
-
Method Detail
-
getSource
public Component getSource()
Component which listened for the shortcut.- Overrides:
getSourcein classEventObject- Returns:
- listening
Component
-
getLifecycleOwner
public Component getLifecycleOwner()
Component which owns the shortcut.- Returns:
- owning
Component
-
getKey
public Key getKey()
PrimaryKeythat triggered the shortcut. Primary key can be anything that is not aKeyModifier.- Returns:
- primary key
-
getKeyModifiers
public Set<KeyModifier> getKeyModifiers()
Set ofKeyModifiersthat, 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 givenKeyand (optional)KeyModifiers. Ifkeyis null or a wrong number ofkeyModifiersis given, returnsfalse.- Parameters:
key-keyto comparekeyModifiers-keyModifiersto compare- Returns:
- Did the given parameters match those in the event?
-
-