Search in sources :

Example 1 with UiMenuContext

use of io.jmix.ui.accesscontext.UiMenuContext in project jmix by jmix-framework.

the class SideMenuBuilder method build.

protected void build(SideMenu menu, List<MenuItem> rootItems) {
    Window window = ComponentsHelper.getWindowImplementation(menu);
    if (window == null) {
        throw new IllegalStateException("SideMenu is not belong to Window");
    }
    for (MenuItem menuItem : rootItems) {
        // AppMenu does not support separators
        UiMenuContext menuItemContext = new UiMenuContext(menuItem);
        accessManager.applyRegisteredConstraints(menuItemContext);
        if (menuItemContext.isPermitted() && !menuItem.isSeparator()) {
            createMenuBarItem(window, menu, menuItem);
        }
    }
    removeExtraSeparators(menu);
}
Also used : Window(io.jmix.ui.component.Window) UiMenuContext(io.jmix.ui.accesscontext.UiMenuContext)

Example 2 with UiMenuContext

use of io.jmix.ui.accesscontext.UiMenuContext in project jmix by jmix-framework.

the class MenuBuilder method isPermitted.

protected boolean isPermitted(MenuItem item) {
    if (Strings.isNullOrEmpty(item.getId()) || item.isSeparator()) {
        return true;
    }
    UiMenuContext menuItemContext = new UiMenuContext(item);
    accessManager.applyRegisteredConstraints(menuItemContext);
    return menuItemContext.isPermitted();
}
Also used : UiMenuContext(io.jmix.ui.accesscontext.UiMenuContext)

Example 3 with UiMenuContext

use of io.jmix.ui.accesscontext.UiMenuContext in project jmix by jmix-framework.

the class SideMenuBuilder method isPermitted.

protected boolean isPermitted(MenuItem item) {
    if (Strings.isNullOrEmpty(item.getId()) || item.isSeparator()) {
        return true;
    }
    UiMenuContext menuItemContext = new UiMenuContext(item);
    accessManager.applyRegisteredConstraints(menuItemContext);
    return menuItemContext.isPermitted();
}
Also used : UiMenuContext(io.jmix.ui.accesscontext.UiMenuContext)

Aggregations

UiMenuContext (io.jmix.ui.accesscontext.UiMenuContext)3 Window (io.jmix.ui.component.Window)1