[portal-commits] JBoss Portal SVN: r11992 - branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/ui/common.

portal-commits at lists.jboss.org portal-commits at lists.jboss.org
Fri Sep 26 09:04:02 EDT 2008


Author: bdaw
Date: 2008-09-26 09:04:02 -0400 (Fri, 26 Sep 2008)
New Revision: 11992

Modified:
   branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/ui/common/IdentityUserBean.java
Log:
- make search users show sorted results

Modified: branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/ui/common/IdentityUserBean.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/ui/common/IdentityUserBean.java	2008-09-26 12:26:45 UTC (rev 11991)
+++ branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/ui/common/IdentityUserBean.java	2008-09-26 13:04:02 UTC (rev 11992)
@@ -30,6 +30,8 @@
 import java.util.Map;
 import java.util.ResourceBundle;
 import java.util.Set;
+import java.util.Collections;
+import java.util.Comparator;
 
 import javax.faces.context.FacesContext;
 
@@ -160,6 +162,7 @@
          User u = (User) i.next();
          list.add(new IdentityUIUser(u.getUserName()));
       }
+      Collections.sort(list, new IdentityUIUserComparator());
       return list;
    }
 
@@ -283,4 +286,25 @@
       return null;
 
    }
+
+   protected class IdentityUIUserComparator implements Comparator
+   {
+
+
+      public int compare(Object o1, Object o2)
+      {
+         try
+         {
+            IdentityUIUser u1 = (IdentityUIUser)o1;
+            IdentityUIUser u2 = (IdentityUIUser)o2;
+
+            return u1.getUsername().compareToIgnoreCase(u2.getUsername());
+         }
+         catch(Throwable e)
+         {
+            //none
+         }
+         return 0;
+      }
+   }
 }




More information about the portal-commits mailing list