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
ConstructorsConstructorDescriptionShortcutEvent(Component source, Component lifecycleOwner, Key key, Set<KeyModifier> keyModifiers) Creates a newShortcutEvent. -
Method Summary
Modifier and TypeMethodDescriptiongetKey()PrimaryKeythat triggered the shortcut.Set ofKeyModifiersthat, in combination with the primary key, triggered the shortcut.Component which owns the shortcut.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 Details
-
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 Details
-
getSource
Component which listened for the shortcut.- Overrides:
getSourcein classEventObject- Returns:
- listening
Component
-
getLifecycleOwner
Component which owns the shortcut.- Returns:
- owning
Component
-
getKey
PrimaryKeythat triggered the shortcut. Primary key can be anything that is not aKeyModifier.- Returns:
- primary key
-
getKeyModifiers
Set ofKeyModifiersthat, in combination with the primary key, triggered the shortcut.- Returns:
- set of key modifiers
-
matches
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?
-