Search in sources :

Example 1 with SideMenu

use of com.haulmont.cuba.gui.components.mainwindow.SideMenu in project cuba by cuba-platform.

the class SideMenuBuilder method createSubMenu.

protected void createSubMenu(Window webWindow, SideMenu menu, SideMenu.MenuItem vItem, MenuItem parentItem, UserSession session) {
    if (parentItem.isPermitted(session)) {
        for (MenuItem child : parentItem.getChildren()) {
            if (child.isSeparator()) {
                continue;
            }
            if (child.isPermitted(session)) {
                SideMenu.MenuItem menuItem = menu.createMenuItem(child.getId(), menuConfig.getItemCaption(child.getId()));
                assignDescription(menuItem, child);
                assignIcon(menuItem, child);
                assignStyleName(menuItem, child);
                if (child.getChildren().isEmpty()) {
                    menuItem.setCommand(createMenuBarCommand(child));
                    assignShortcut(webWindow, menuItem, child);
                    vItem.addChildItem(menuItem);
                } else {
                    createSubMenu(webWindow, menu, menuItem, child, session);
                    assignExpanded(menuItem, child);
                    if (!isMenuItemEmpty(menuItem)) {
                        vItem.addChildItem(menuItem);
                    }
                }
            }
        }
    }
}
Also used : MenuItem(com.haulmont.cuba.gui.config.MenuItem) SideMenu(com.haulmont.cuba.gui.components.mainwindow.SideMenu)

Aggregations

SideMenu (com.haulmont.cuba.gui.components.mainwindow.SideMenu)1 MenuItem (com.haulmont.cuba.gui.config.MenuItem)1