Search in sources :

Example 1 with ClickableNavigationElement

use of com.github.appreciated.app.layout.builder.elements.ClickableNavigationElement in project vaadin-app-layout by appreciated.

the class DefaultTopSubmenuNavigationElementFactory method addToMenuBar.

private void addToMenuBar(MenuBar menuBar, AbstractNavigationElement element) {
    if (element instanceof SubmenuNavigationElement) {
        SubmenuNavigationElement submenu = (SubmenuNavigationElement) element;
        MenuBar.MenuItem submenuItem = menuBar.addItem(submenu.getTitle(), submenu.getIcon(), null);
        submenu.getSubmenuElements().forEach(element1 -> {
            addToMenuBar(submenuItem, element1);
        });
    }
    if (element instanceof NavigatorNavigationElement) {
        NavigatorNavigationElement submenu = (NavigatorNavigationElement) element;
        menuBar.addItem(submenu.getCaption(), submenu.getIcon(), menuItem -> UI.getCurrent().getNavigator().navigateTo(submenu.getViewName()));
    }
    if (element instanceof ClickableNavigationElement) {
        ClickableNavigationElement submenu = (ClickableNavigationElement) element;
        menuBar.addItem(submenu.getName(), submenu.getIcon(), menuItem -> submenu.getListener().buttonClick(null));
    }
}
Also used : NavigatorNavigationElement(com.github.appreciated.app.layout.builder.elements.NavigatorNavigationElement) ClickableNavigationElement(com.github.appreciated.app.layout.builder.elements.ClickableNavigationElement) SubmenuNavigationElement(com.github.appreciated.app.layout.builder.elements.SubmenuNavigationElement) MenuBar(com.vaadin.ui.MenuBar)

Example 2 with ClickableNavigationElement

use of com.github.appreciated.app.layout.builder.elements.ClickableNavigationElement in project vaadin-app-layout by appreciated.

the class DefaultTopSubmenuNavigationElementFactory method addToMenuBar.

private void addToMenuBar(MenuBar.MenuItem menuBar, AbstractNavigationElement element) {
    if (element instanceof SubmenuNavigationElement) {
        SubmenuNavigationElement submenu = (SubmenuNavigationElement) element;
        MenuBar.MenuItem submenuItem = menuBar.addItem(submenu.getTitle(), submenu.getIcon(), null);
        submenu.getSubmenuElements().forEach(element1 -> {
            addToMenuBar(submenuItem, element1);
        });
    }
    if (element instanceof NavigatorNavigationElement) {
        NavigatorNavigationElement submenu = (NavigatorNavigationElement) element;
        menuBar.addItem(submenu.getCaption(), submenu.getIcon(), menuItem -> UI.getCurrent().getNavigator().navigateTo(submenu.getViewName()));
    }
    if (element instanceof ClickableNavigationElement) {
        ClickableNavigationElement submenu = (ClickableNavigationElement) element;
        menuBar.addItem(submenu.getName(), submenu.getIcon(), menuItem -> submenu.getListener().buttonClick(null));
    }
}
Also used : NavigatorNavigationElement(com.github.appreciated.app.layout.builder.elements.NavigatorNavigationElement) ClickableNavigationElement(com.github.appreciated.app.layout.builder.elements.ClickableNavigationElement) SubmenuNavigationElement(com.github.appreciated.app.layout.builder.elements.SubmenuNavigationElement) MenuBar(com.vaadin.ui.MenuBar)

Aggregations

ClickableNavigationElement (com.github.appreciated.app.layout.builder.elements.ClickableNavigationElement)2 NavigatorNavigationElement (com.github.appreciated.app.layout.builder.elements.NavigatorNavigationElement)2 SubmenuNavigationElement (com.github.appreciated.app.layout.builder.elements.SubmenuNavigationElement)2 MenuBar (com.vaadin.ui.MenuBar)2