use of com.github.appreciated.app.layout.builder.elements.SubmenuNavigationElement in project vaadin-app-layout by appreciated.
the class AppLayoutConfiguration method prepareNavigationElement.
private void prepareNavigationElement(AbstractNavigationElement element) {
if (element instanceof HasCaptionInterceptor) {
((HasCaptionInterceptor) element).setCaptionInterceptor(captionInterceptor);
}
if (element instanceof NavigatorNavigationElement) {
NavigatorNavigationElement nElement = (NavigatorNavigationElement) element;
nElement.setCDI(isCDI);
nElement.setNavigationElementInfoProvider(navigationElementInfoProvider);
if ((isCDI == false && nElement.getViewClassName() == defaultNavigationElement.getViewClassName()) || (isCDI == true && nElement.getViewName().equals(""))) {
AppLayoutSessionHelper.updateActiveElementSessionData(nElement);
}
nElement.setViewNameInterceptor(viewNameInterceptor);
if (isNavigatorEnabled) {
nElement.addViewToNavigator(navigator);
} else {
nElement.addViewToComponentNavigator(componentNavigator);
}
navigatorElements.add(nElement);
} else if (element instanceof SubmenuNavigationElement) {
SubmenuNavigationElement sElement = (SubmenuNavigationElement) element;
sElement.getSubmenuElements().forEach(element1 -> prepareNavigationElement(element1));
}
}
use of com.github.appreciated.app.layout.builder.elements.SubmenuNavigationElement 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.SubmenuNavigationElement 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