Search in sources :

Example 6 with ShortcutAction

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);
    }
}
Also used : ShortcutAction(com.vaadin.event.ShortcutAction)

Example 7 with ShortcutAction

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);
            }
        }
    });
}
Also used : StandardCloseAction(com.haulmont.cuba.gui.screen.StandardCloseAction) ShortcutAction(com.vaadin.event.ShortcutAction) Action(com.vaadin.event.Action) Action(com.vaadin.event.Action) ShortcutListenerDelegate(com.haulmont.cuba.web.gui.components.util.ShortcutListenerDelegate) ClientConfig(com.haulmont.cuba.client.ClientConfig)

Aggregations

ShortcutAction (com.vaadin.event.ShortcutAction)7 Action (com.vaadin.event.Action)4 Handler (com.vaadin.event.Action.Handler)2 ClientConfig (com.haulmont.cuba.client.ClientConfig)1 KeyCombination (com.haulmont.cuba.gui.components.KeyCombination)1 BaseAction (com.haulmont.cuba.gui.components.actions.BaseAction)1 StandardCloseAction (com.haulmont.cuba.gui.screen.StandardCloseAction)1 ThemeConstants (com.haulmont.cuba.gui.theme.ThemeConstants)1 ShortcutListenerDelegate (com.haulmont.cuba.web.gui.components.util.ShortcutListenerDelegate)1 Button (com.vaadin.ui.Button)1 ClickEvent (com.vaadin.ui.Button.ClickEvent)1 ClickListener (com.vaadin.ui.Button.ClickListener)1 CssLayout (com.vaadin.ui.CssLayout)1 HorizontalLayout (com.vaadin.ui.HorizontalLayout)1 Panel (com.vaadin.ui.Panel)1 TextField (com.vaadin.ui.TextField)1 VerticalLayout (com.vaadin.ui.VerticalLayout)1 Task (org.activiti.engine.task.Task)1 LoggedInUser (org.activiti.explorer.identity.LoggedInUser)1