use of com.vaadin.event.ShortcutAction in project cuba by cuba-platform.
the class WebPickerFieldActionHandler method updateOrderedShortcuts.
protected void updateOrderedShortcuts() {
shortcuts.removeAll(orderedShortcuts);
for (ShortcutAction orderedShortcut : orderedShortcuts) {
actionsMap.remove(orderedShortcut);
}
for (int i = 0; i < actionList.size(); i++) {
int keyCode = ShortcutAction.KeyCode.NUM1 + i;
com.haulmont.cuba.gui.components.Action orderedAction = actionList.get(i);
ShortcutAction orderedShortcut = new ShortcutAction(orderedAction.getCaption(), keyCode, modifiers);
shortcuts.add(orderedShortcut);
orderedShortcuts.add(orderedShortcut);
actionsMap.put(orderedShortcut, orderedAction);
}
}
use of com.vaadin.event.ShortcutAction in project cuba by cuba-platform.
the class WebDialogWindow method setupDialogShortcuts.
protected void setupDialogShortcuts() {
ClientConfig clientConfig = getClientConfig();
String closeShortcut = clientConfig.getCloseShortcut();
KeyCombination closeCombination = KeyCombination.create(closeShortcut);
ShortcutListenerDelegate exitAction = new ShortcutListenerDelegate("closeShortcutAction", closeCombination.getKey().getCode(), KeyCombination.Modifier.codes(closeCombination.getModifiers()));
exitAction.withHandler(this::onCloseShortcutTriggered);
dialogWindow.addActionHandler(new com.vaadin.event.Action.Handler() {
@Override
public com.vaadin.event.Action[] getActions(Object target, Object sender) {
return new ShortcutAction[] { exitAction };
}
@Override
public void handleAction(com.vaadin.event.Action action, Object sender, Object target) {
if (action == exitAction) {
exitAction.handleAction(sender, target);
}
}
});
}
Aggregations