public static class Window.CloseShortcut extends ShortcutListener
ShortcutListener
specifically made to define a keyboard
shortcut that closes the window.
// within the window using helper
window.setCloseShortcut(KeyCode.ESCAPE, null);
// or globally
getUI().addAction(new Window.CloseShortcut(window, KeyCode.ESCAPE));
ShortcutAction.KeyCode, ShortcutAction.ModifierKey
Action.Container, Action.Handler, Action.Listener, Action.Notifier, Action.ShortcutNotifier
Modifier and Type | Field and Description |
---|---|
protected Window |
window |
SHORTHAND_CHAR_ALT, SHORTHAND_CHAR_CTRL, SHORTHAND_CHAR_SHIFT
Constructor and Description |
---|
CloseShortcut(Window window,
int keyCode)
Creates a keyboard shortcut for closing the given window using the
given
ShortcutAction.KeyCode . |
CloseShortcut(Window window,
int keyCode,
int... modifiers)
Creates a keyboard shortcut for closing the given window using the
given
ShortcutAction.KeyCode and ShortcutAction.ModifierKey s. |
CloseShortcut(Window window,
String shorthandCaption)
Creates a keyboard shortcut for closing the given window using the
shorthand notation defined in
ShortcutAction . |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(int keyCode,
int... modifiers) |
void |
handleAction(Object sender,
Object target) |
getKeyCode, getModifiers
getCaption, getIcon, setCaption, setIcon
protected Window window
public CloseShortcut(Window window, String shorthandCaption)
ShortcutAction
.window
- to be closed when the shortcut is invokedshorthandCaption
- the caption with shortcut keycode and modifiers indicatedpublic CloseShortcut(Window window, int keyCode, int... modifiers)
ShortcutAction.KeyCode
and ShortcutAction.ModifierKey
s.window
- to be closed when the shortcut is invokedkeyCode
- KeyCode to react tomodifiers
- optional modifiers for shortcutpublic CloseShortcut(Window window, int keyCode)
ShortcutAction.KeyCode
.window
- to be closed when the shortcut is invokedkeyCode
- KeyCode to react topublic void handleAction(Object sender, Object target)
handleAction
in interface Action.Listener
handleAction
in class ShortcutListener
public boolean equals(int keyCode, int... modifiers)
Copyright © 2019 Vaadin Ltd. All rights reserved.