[gatein-commits] gatein SVN: r2034 - in portal/trunk: webui/portal/src/main/java/org/exoplatform/portal/webui/application and 1 other directory.

do-not-reply at jboss.org do-not-reply at jboss.org
Mon Mar 8 07:00:27 EST 2010


Author: liem_nguyen
Date: 2010-03-08 07:00:26 -0500 (Mon, 08 Mar 2010)
New Revision: 2034

Modified:
   portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIApplicationOrganizer.java
   portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIApplicationList.java
Log:
GTNPORTAL-827 Categories are not alphabetically sorted in Page Editor

Modified: portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIApplicationOrganizer.java
===================================================================
--- portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIApplicationOrganizer.java	2010-03-08 10:23:59 UTC (rev 2033)
+++ portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIApplicationOrganizer.java	2010-03-08 12:00:26 UTC (rev 2034)
@@ -40,6 +40,7 @@
 import org.exoplatform.webui.event.EventListener;
 import org.exoplatform.webui.event.MonitorEvent;
 
+import java.util.Collections;
 import java.util.List;
 
 import javax.portlet.PortletPreferences;
@@ -55,7 +56,7 @@
    @EventConfig(listeners = UIApplicationOrganizer.AddApplicationActionListener.class),
    @EventConfig(listeners = UIApplicationOrganizer.RemoveApplicationActionListener.class, confirm = "UIOrganizer.msg.deleteApplication")})
 @Serialized
-public class   UIApplicationOrganizer extends UIContainer
+public class UIApplicationOrganizer extends UIContainer
 {
 
    private ApplicationCategory selectedCategory;
@@ -132,13 +133,15 @@
    public void setSelectedCategory(ApplicationCategory category) throws Exception
    {
       selectedCategory = category;
-      if (category == null) return;
+      if (category == null)
+         return;
       applications = category.getApplications();
       if (applications == null || applications.isEmpty())
       {
          setSelectedApplication(null);
          return;
       }
+      Collections.sort(applications, new Util.ApplicationComparator());
 
       //Correct IconUrl of gadget
       GadgetRegistryService gadgetService = getApplicationComponent(GadgetRegistryService.class);

Modified: portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIApplicationList.java
===================================================================
--- portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIApplicationList.java	2010-03-08 10:23:59 UTC (rev 2033)
+++ portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIApplicationList.java	2010-03-08 12:00:26 UTC (rev 2034)
@@ -64,31 +64,34 @@
       UserACL userACL = Util.getUIPortalApplication().getApplicationComponent(UserACL.class);
       IdentityRegistry identityRegistry = Util.getUIPortalApplication().getApplicationComponent(IdentityRegistry.class);
       Identity identity = identityRegistry.getIdentity(remoteUser);
-      if (identity == null) return;
-      
+      if (identity == null)
+         return;
+
       PortletComparator portletComparator = new PortletComparator();
       categories = service.getApplicationCategories(remoteUser);
-      Collections.sort(categories, new PortletCategoryComparator());
-      Iterator<ApplicationCategory> cateItr = categories.iterator();      
+
+      Iterator<ApplicationCategory> cateItr = categories.iterator();
       while (cateItr.hasNext())
       {
-         ApplicationCategory cate = cateItr.next();         
+         ApplicationCategory cate = cateItr.next();
          List<Application> applications = cate.getApplications();
-         
          boolean hasPermission = false;
          List<String> accessPermission = cate.getAccessPermissions();
-         if (accessPermission == null) {
-            accessPermission = new ArrayList<String>();            
+         if (accessPermission == null)
+         {
+            accessPermission = new ArrayList<String>();
          }
-         if (accessPermission.size() == 0) {
+         if (accessPermission.size() == 0)
+         {
             accessPermission.add(null);
          }
          for (String permssion : accessPermission)
          {
             hasPermission = userACL.hasPermission(identity, permssion);
-            if (hasPermission) break;
+            if (hasPermission)
+               break;
          }
-         
+
          if (!hasPermission || applications.size() < 1)
             cateItr.remove();
          else
@@ -96,6 +99,8 @@
       }
       if (categories.size() > 0)
          setSelectedCategory(categories.get(0).getName());
+
+      Collections.sort(categories, new PortletCategoryComparator());
    }
 
    public Application getApplication(String id) throws Exception
@@ -164,7 +169,7 @@
    {
       public int compare(ApplicationCategory cat1, ApplicationCategory cat2)
       {
-         return cat1.getDisplayName().compareTo(cat2.getDisplayName());
+         return cat1.getDisplayName().compareToIgnoreCase(cat2.getDisplayName());
       }
    }
 
@@ -172,7 +177,7 @@
    {
       public int compare(Application p1, Application p2)
       {
-         return p1.getDisplayName().compareTo(p2.getDisplayName());
+         return p1.getDisplayName().compareToIgnoreCase(p2.getDisplayName());
       }
    }
 



More information about the gatein-commits mailing list