From 8d848cac8317cba123d93f611834315534accdd2 Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Wed, 19 Nov 2008 01:04:22 +0000
Subject: [PATCH] Fix for issue 3622 (Control Panel: Objectclass sort is case sensitive) Use a case non-sensitive comparator to set the schema element names.

---
 opends/src/guitools/org/opends/guitools/controlpanel/ui/BrowseSchemaPanel.java |   32 ++++++++++++++++++++++++--------
 1 files changed, 24 insertions(+), 8 deletions(-)

diff --git a/opends/src/guitools/org/opends/guitools/controlpanel/ui/BrowseSchemaPanel.java b/opends/src/guitools/org/opends/guitools/controlpanel/ui/BrowseSchemaPanel.java
index fc4f7a9..bf41891 100644
--- a/opends/src/guitools/org/opends/guitools/controlpanel/ui/BrowseSchemaPanel.java
+++ b/opends/src/guitools/org/opends/guitools/controlpanel/ui/BrowseSchemaPanel.java
@@ -40,6 +40,7 @@
 import java.awt.event.KeyEvent;
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.Comparator;
 import java.util.HashMap;
 import java.util.Set;
 import java.util.TreeSet;
@@ -692,13 +693,25 @@
     }
     TreePath newSelectionPath = null;
 
-    TreeSet<String> standardOcNames = new TreeSet<String>();
+    /**
+     * {@inheritDoc}
+     */
+    Comparator<String> lowerCaseComparator = new Comparator<String>()
+    {
+      public int compare(String s1, String s2)
+      {
+        return s1.toLowerCase().compareTo(s2.toLowerCase());
+      }
+    };
+
+    TreeSet<String> standardOcNames = new TreeSet<String>(lowerCaseComparator);
     HashMap<String, StandardObjectClassTreeNode> hmStandardOcs =
       new HashMap<String, StandardObjectClassTreeNode>();
-    TreeSet<String> configurationOcNames = new TreeSet<String>();
+    TreeSet<String> configurationOcNames =
+      new TreeSet<String>(lowerCaseComparator);
     HashMap<String, ConfigurationObjectClassTreeNode> hmConfigurationOcs =
       new HashMap<String, ConfigurationObjectClassTreeNode>();
-    TreeSet<String> customOcNames = new TreeSet<String>();
+    TreeSet<String> customOcNames = new TreeSet<String>(lowerCaseComparator);
     HashMap<String, CustomObjectClassTreeNode> hmCustomOcs =
       new HashMap<String, CustomObjectClassTreeNode>();
     for (ObjectClass oc : lastSchema.getObjectClasses().values())
@@ -726,13 +739,15 @@
     }
 
 
-    TreeSet<String> standardAttrNames = new TreeSet<String>();
+    TreeSet<String> standardAttrNames =
+      new TreeSet<String>(lowerCaseComparator);
     HashMap<String, StandardAttributeTreeNode> hmStandardAttrs =
       new HashMap<String, StandardAttributeTreeNode>();
-    TreeSet<String> configurationAttrNames = new TreeSet<String>();
+    TreeSet<String> configurationAttrNames =
+      new TreeSet<String>(lowerCaseComparator);
     HashMap<String, ConfigurationAttributeTreeNode> hmConfigurationAttrs =
       new HashMap<String, ConfigurationAttributeTreeNode>();
-    TreeSet<String> customAttrNames = new TreeSet<String>();
+    TreeSet<String> customAttrNames = new TreeSet<String>(lowerCaseComparator);
     HashMap<String, CustomAttributeTreeNode> hmCustomAttrs =
       new HashMap<String, CustomAttributeTreeNode>();
     for (AttributeType attr : lastSchema.getAttributeTypes().values())
@@ -759,7 +774,8 @@
       }
     }
 
-    TreeSet<String> matchingRuleNames = new TreeSet<String>();
+    TreeSet<String> matchingRuleNames =
+      new TreeSet<String>(lowerCaseComparator);
     HashMap<String, MatchingRuleTreeNode> hmMatchingRules =
       new HashMap<String, MatchingRuleTreeNode>();
     for (MatchingRule matchingRule : lastSchema.getMatchingRules().values())
@@ -772,7 +788,7 @@
       }
     }
 
-    TreeSet<String> syntaxNames = new TreeSet<String>();
+    TreeSet<String> syntaxNames = new TreeSet<String>(lowerCaseComparator);
     HashMap<String, AttributeSyntaxTreeNode> hmSyntaxes =
       new HashMap<String, AttributeSyntaxTreeNode>();
     for (AttributeSyntax syntax : lastSchema.getSyntaxes().values())

--
Gitblit v1.10.0