From 965ebec1f766a3b0c2ae7a62cbf924537a6b2ea8 Mon Sep 17 00:00:00 2001
From: Gaetan Boismal <gaetan.boismal@forgerock.com>
Date: Tue, 09 Jun 2015 10:17:07 +0000
Subject: [PATCH] OPENDJ-2111 Fix issue

---
 opendj-sdk/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/NewAttributePanel.java |   39 ++++++++-------------------------------
 1 files changed, 8 insertions(+), 31 deletions(-)

diff --git a/opendj-sdk/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/NewAttributePanel.java b/opendj-sdk/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/NewAttributePanel.java
index b291d23..3acaf22 100644
--- a/opendj-sdk/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/NewAttributePanel.java
+++ b/opendj-sdk/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/NewAttributePanel.java
@@ -224,11 +224,8 @@
       newParents.add(0, NO_PARENT);
       updateComboBoxModel(newParents, (DefaultComboBoxModel) parent.getModel());
 
-      List<MatchingRule> approximateElements = new ArrayList<>();
-      List<MatchingRule> equalityElements = new ArrayList<>();
-      List<MatchingRule> orderingElements = new ArrayList<>();
-      List<MatchingRule> substringElements = new ArrayList<>();
-      Map<String, MatchingRule> matchingRuleNameMap = new HashMap<>();
+      final List<MatchingRule> availableMatchingRules = new ArrayList<>();
+      final Map<String, MatchingRule> matchingRuleNameMap = new HashMap<>();
       for (String key : schema.getMatchingRules().keySet())
       {
         MatchingRule rule = schema.getMatchingRule(key);
@@ -237,36 +234,16 @@
 
       orderedKeys.clear();
       orderedKeys.addAll(matchingRuleNameMap.keySet());
-      for (String key : orderedKeys)
+      for (final String key : orderedKeys)
       {
-        MatchingRule matchingRule = matchingRuleNameMap.get(key);
-        if (Utilities.isApproximateMatchingRule(matchingRule))
-        {
-          approximateElements.add(matchingRule);
-        }
-        else if (Utilities.isEqualityMatchingRule(matchingRule))
-        {
-          equalityElements.add(matchingRule);
-        }
-        else if (Utilities.isOrderingMatchingRule(matchingRule))
-        {
-          orderingElements.add(matchingRule);
-        }
-        else if (Utilities.isSubstringMatchingRule(matchingRule))
-        {
-          substringElements.add(matchingRule);
-        }
+        availableMatchingRules.add(matchingRuleNameMap.get(key));
       }
-      JComboBox[] combos = { approximate, equality, ordering, substring };
-      List<List<MatchingRule>> ruleNames = new ArrayList<>();
-      ruleNames.add(approximateElements);
-      ruleNames.add(equalityElements);
-      ruleNames.add(orderingElements);
-      ruleNames.add(substringElements);
+
+      final JComboBox[] combos = { approximate, equality, ordering, substring };
       for (int i = 0; i < combos.length; i++)
       {
-        DefaultComboBoxModel model = (DefaultComboBoxModel) combos[i].getModel();
-        List<Object> el = new ArrayList<Object>(ruleNames.get(i));
+        final DefaultComboBoxModel model = (DefaultComboBoxModel) combos[i].getModel();
+        final List<Object> el = new ArrayList<Object>(availableMatchingRules);
         el.add(0, model.getSize() == 0 ? NO_MATCHING_RULE : model.getElementAt(0));
         updateComboBoxModel(el, model);
       }

--
Gitblit v1.10.0