Author: hoang_to
Date: 2010-06-01 04:55:38 -0400 (Tue, 01 Jun 2010)
New Revision: 3221
Modified:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UIPortalNavigation.java
Log:
GTNPORTAL-1148: Dashboard page node is wrongly positioned in Sitemap portlet
Modified:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UIPortalNavigation.java
===================================================================
---
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UIPortalNavigation.java 2010-06-01
08:11:07 UTC (rev 3220)
+++
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UIPortalNavigation.java 2010-06-01
08:55:38 UTC (rev 3221)
@@ -53,6 +53,12 @@
private String cssClassName = "";
private String template;
+
+ private final static String PORTAL_NAV = "portal";
+
+ private final static String GROUP_NAV = "group";
+
+ private final static String USER_NAV = "user";
@Override
public String getTemplate()
@@ -125,7 +131,9 @@
{
WebuiRequestContext context = WebuiRequestContext.getCurrentInstance();
treeNode_ = new TreeNode(new PageNode(), new PageNavigation(), true);
- for (PageNavigation nav : Util.getUIPortalApplication().getNavigations())
+ List<PageNavigation> listNavigations =
Util.getUIPortalApplication().getNavigations();
+
+ for (PageNavigation nav : rearrangeNavigations(listNavigations))
{
if (!showUserNavigation && nav.getOwnerType().equals("user"))
{
@@ -135,7 +143,44 @@
treeNode_.setChildren(filterNav.getNodes(), filterNav);
}
}
+
+ /**
+ *
+ * @param listNavigation
+ * @return
+ */
+ private List<PageNavigation> rearrangeNavigations(List<PageNavigation>
listNavigation)
+ {
+ List<PageNavigation> returnNavs = new ArrayList<PageNavigation>();
+ List<PageNavigation> portalNavs = new ArrayList<PageNavigation>();
+ List<PageNavigation> groupNavs = new ArrayList<PageNavigation>();
+ List<PageNavigation> userNavs = new ArrayList<PageNavigation>();
+
+ for (PageNavigation nav : listNavigation)
+ {
+ String ownerType = nav.getOwnerType();
+ if (PORTAL_NAV.equals(ownerType))
+ {
+ portalNavs.add(nav);
+ }
+ else if (GROUP_NAV.equals(ownerType))
+ {
+ groupNavs.add(nav);
+ }
+ else if (USER_NAV.equals(ownerType))
+ {
+ userNavs.add(nav);
+ }
+ }
+
+ returnNavs.addAll(portalNavs);
+ returnNavs.addAll(groupNavs);
+ returnNavs.addAll(userNavs);
+
+ return returnNavs;
+ }
+
public TreeNode getTreeNodes()
{
return treeNode_;