Search in sources :

Example 1 with MenuShortcutAction

use of com.haulmont.cuba.web.toolkit.MenuShortcutAction in project cuba by cuba-platform.

the class MenuBuilder method assignShortcut.

protected void assignShortcut(Window webWindow, AppMenu.MenuItem menuItem, MenuItem item) {
    KeyCombination itemShortcut = item.getShortcut();
    if (itemShortcut != null) {
        ShortcutListener shortcut = new MenuShortcutAction(menuItem, "shortcut_" + item.getId(), item.getShortcut());
        AbstractComponent windowImpl = webWindow.unwrap(AbstractComponent.class);
        windowImpl.addShortcutListener(shortcut);
        appMenu.setMenuItemShortcutCaption(menuItem, itemShortcut.format());
    }
}
Also used : ShortcutListener(com.vaadin.event.ShortcutListener) MenuShortcutAction(com.haulmont.cuba.web.toolkit.MenuShortcutAction) AbstractComponent(com.vaadin.ui.AbstractComponent) KeyCombination(com.haulmont.cuba.gui.components.KeyCombination)

Aggregations

KeyCombination (com.haulmont.cuba.gui.components.KeyCombination)1 MenuShortcutAction (com.haulmont.cuba.web.toolkit.MenuShortcutAction)1 ShortcutListener (com.vaadin.event.ShortcutListener)1 AbstractComponent (com.vaadin.ui.AbstractComponent)1