List of usage examples for com.liferay.portal.kernel.theme NavItem fromLayouts
public static List<NavItem> fromLayouts(HttpServletRequest httpServletRequest, ThemeDisplay themeDisplay, Map<String, Object> contextObjects) throws PortalException
From source file:com.liferay.site.navigation.taglib.servlet.taglib.NavigationTag.java
License:Open Source License
protected List<NavItem> getNavItems(List<NavItem> branchNavItems) throws Exception { ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY); List<NavItem> navItems = new ArrayList<>(); NavItem rootNavItem = null;/*from w ww.ja va 2 s . c o m*/ if (_rootLayoutType.equals("relative")) { if ((_rootLayoutLevel >= 0) && (_rootLayoutLevel < branchNavItems.size())) { rootNavItem = branchNavItems.get(_rootLayoutLevel); } } else if (_rootLayoutType.equals("absolute")) { if (_rootLayoutLevel == 0) { navItems = NavItem.fromLayouts(request, themeDisplay, null); } else if (branchNavItems.size() >= _rootLayoutLevel) { rootNavItem = branchNavItems.get(_rootLayoutLevel - 1); } } else if (_rootLayoutType.equals("select")) { Layout layout = themeDisplay.getLayout(); if (Validator.isNotNull(_rootLayoutUuid)) { Layout rootLayout = LayoutLocalServiceUtil.getLayoutByUuidAndGroupId(_rootLayoutUuid, layout.getGroupId(), layout.isPrivateLayout()); rootNavItem = new NavItem(request, themeDisplay, rootLayout, null); } else { navItems = NavItem.fromLayouts(request, themeDisplay, null); } } if (rootNavItem != null) { navItems = rootNavItem.getChildren(); } return navItems; }