directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r522979 - in /directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/attributeType: ATEUsedByMandatoryTableContentProvider.java ATEUsedByOptionalTableContentProvider.java
Date Tue, 27 Mar 2007 16:09:02 GMT
Author: pamarcelot
Date: Tue Mar 27 09:09:01 2007
New Revision: 522979

URL: http://svn.apache.org/viewvc?view=rev&rev=522979
Log:
Added a sort on the results.

Modified:
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/attributeType/ATEUsedByMandatoryTableContentProvider.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/attributeType/ATEUsedByOptionalTableContentProvider.java

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/attributeType/ATEUsedByMandatoryTableContentProvider.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/attributeType/ATEUsedByMandatoryTableContentProvider.java?view=diff&rev=522979&r1=522978&r2=522979
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/attributeType/ATEUsedByMandatoryTableContentProvider.java
(original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/attributeType/ATEUsedByMandatoryTableContentProvider.java
Tue Mar 27 09:09:01 2007
@@ -21,6 +21,8 @@
 
 
 import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
 import java.util.List;
 
 import org.apache.directory.ldapstudio.schemas.model.AttributeType;
@@ -45,7 +47,7 @@
     {
         if ( inputElement instanceof AttributeType )
         {
-            List<Object> results = new ArrayList<Object>();
+            List<ObjectClass> results = new ArrayList<ObjectClass>();
             AttributeType inputAT = ( AttributeType ) inputElement;
             SchemaPool schemaPool = SchemaPool.getInstance();
 
@@ -67,6 +69,20 @@
                     }
                 }
             }
+            
+            // Sorting Results
+            Collections.sort( results, new Comparator<ObjectClass>()
+            {
+                public int compare( ObjectClass oc1, ObjectClass oc2 )
+                {
+                    if ( oc1 instanceof ObjectClass && oc1 instanceof ObjectClass
)
+                    {
+                        return ( ( ObjectClass ) oc1 ).getNames()[0].compareToIgnoreCase(
( ( ObjectClass ) oc2 ).getNames()[0] );
+                    }
+
+                    return 0;
+                }
+            } );
 
             return results.toArray();
         }

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/attributeType/ATEUsedByOptionalTableContentProvider.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/attributeType/ATEUsedByOptionalTableContentProvider.java?view=diff&rev=522979&r1=522978&r2=522979
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/attributeType/ATEUsedByOptionalTableContentProvider.java
(original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/attributeType/ATEUsedByOptionalTableContentProvider.java
Tue Mar 27 09:09:01 2007
@@ -21,6 +21,8 @@
 
 
 import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
 import java.util.List;
 
 import org.apache.directory.ldapstudio.schemas.model.AttributeType;
@@ -45,7 +47,7 @@
     {
         if ( inputElement instanceof AttributeType )
         {
-            List<Object> results = new ArrayList<Object>();
+            List<ObjectClass> results = new ArrayList<ObjectClass>();
             AttributeType inputAT = ( AttributeType ) inputElement;
             SchemaPool schemaPool = SchemaPool.getInstance();
 
@@ -67,6 +69,21 @@
                     }
                 }
             }
+
+            // Sorting Results
+            Collections.sort( results, new Comparator<ObjectClass>()
+            {
+                public int compare( ObjectClass oc1, ObjectClass oc2 )
+                {
+                    if ( oc1 instanceof ObjectClass && oc1 instanceof ObjectClass
)
+                    {
+                        return ( ( ObjectClass ) oc1 ).getNames()[0].compareToIgnoreCase(
( ( ObjectClass ) oc2 )
+                            .getNames()[0] );
+                    }
+
+                    return 0;
+                }
+            } );
 
             return results.toArray();
         }



Mime
View raw message