PortletRequestContext context = (PortletRequestContext) WebuiRequestContext.getCurrentInstance();
PortletRequest prequest = context.getRequest();
PortletPreferences prefers = prequest.getPreferences();
String template = prefers.getValue("template", "app:/groovy/portal/webui/component/UIPortalNavigation.gtmpl");
UIPortalNavigation portalNavigation = addChild(UIPortalNavigation.class, "UIHorizontalNavigation", null);
portalNavigation.setUseAjax(isUseAjax());
portalNavigation.setShowUserNavigation(Boolean.valueOf(prefers.getValue("showUserNavigation", "true")));
portalNavigation.setTemplate(template);
portalNavigation.setCssClassName(prefers.getValue("CSSClassName", ""));
int level = DEFAULT_LEVEL;
try {
level = Integer.valueOf(prefers.getValue("level", String.valueOf(DEFAULT_LEVEL)));
} catch (Exception ex) {
log.warn("Preference for navigation level can only be integer");
}
if (level <= 0) {
portalNavigation.setScope(Scope.ALL);
} else {
portalNavigation.setScope(GenericScope.treeShape(level));
}
}