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));
}
}
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));
}
}
Aggregations