public final class Shortcuts extends Object
| Modifier and Type | Method and Description |
|---|---|
static ShortcutRegistration |
addShortcutListener(Component lifecycleOwner,
Command command,
Key key,
KeyModifier... keyModifiers)
Invoke a
Command when the shortcut is invoked. |
ShortcutRegistration |
addShortcutListener(Component lifecycleOwner,
ShortcutEventListener listener,
Key key,
KeyModifier... keyModifiers)
Invoke a
ShortcutEventListener when the shortcut is invoked. |
public static ShortcutRegistration addShortcutListener(Component lifecycleOwner, Command command, Key key, KeyModifier... keyModifiers)
Command when the shortcut is invoked.
Registering a shortcut using this method will tie it to
lifecycleOwner and the shortcut is available in the global scope.
By default, the shortcut's listener is bound to UI. The listening
component can be changed by calling
ShortcutRegistration.listenOn(Component).
lifecycleOwner - the component that controls, when the shortcut is active. If
the component is either invisible or detached, the shortcut
won't work. Cannot be nullcommand - code to execute when the shortcut is invoked. Cannot be nullkey - primary Key used to trigger the shortcut. Cannot
be nullkeyModifiers - KeyModifiers which also need to be
pressed for the shortcut to triggerShortcutRegistration for configuring and removing the
shortcutpublic ShortcutRegistration addShortcutListener(Component lifecycleOwner, ShortcutEventListener listener, Key key, KeyModifier... keyModifiers)
ShortcutEventListener when the shortcut is invoked.
Registering a shortcut using this method will tie it to
lifecycleOwner and the shortcut is available in the global scope.
By default, the shortcut's listener is bound to UI. The listening
component can be changed by calling
ShortcutRegistration.listenOn(Component).
lifecycleOwner - the component that controls, when the shortcut is active. If
the component is either invisible or detached, the shortcut
won't work. Cannot be nulllistener - listener to execute when the shortcut is invoked. Receives a
ShortcutEvent. Cannot be nullkey - primary Key used to trigger the shortcut. Cannot
be nullkeyModifiers - KeyModifiers which also need to be
pressed for the shortcut to triggerShortcutRegistration for configuring and removing the
shortcutCopyright © 2000–2019 Vaadin Ltd. All rights reserved.