Example usage for com.vaadin.ui AbstractComponent addShortcutListener

List of usage examples for com.vaadin.ui AbstractComponent addShortcutListener

Introduction

In this page you can find the example usage for com.vaadin.ui AbstractComponent addShortcutListener.

Prototype

public Registration addShortcutListener(ShortcutListener shortcut) 

Source Link

Usage

From source file:com.haulmont.cuba.web.sys.MenuBuilder.java

License:Apache License

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());/*from  w  w  w.  j  a  v a 2  s.  c  o m*/

        AbstractComponent windowImpl = webWindow.unwrap(AbstractComponent.class);
        windowImpl.addShortcutListener(shortcut);

        appMenu.setMenuItemShortcutCaption(menuItem, itemShortcut.format());
    }
}

From source file:com.haulmont.cuba.web.sys.SideMenuBuilder.java

License:Apache License

protected void assignShortcut(Window webWindow, SideMenu.MenuItem menuItem, MenuItem item) {
    KeyCombination itemShortcut = item.getShortcut();
    if (itemShortcut != null) {
        ShortcutListener shortcut = new SideMenuShortcutListener(menuItem, item);

        AbstractComponent windowImpl = webWindow.unwrap(AbstractComponent.class);
        windowImpl.addShortcutListener(shortcut);

        if (Strings.isNullOrEmpty(menuItem.getBadgeText())) {
            menuItem.setDescription(itemShortcut.format());
        }//from   w ww .ja v  a 2s. c om
    }
}