From 21a1ecaaec5b78ec8c20053e05f3d46ce10966db Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Tue, 11 Nov 2008 01:25:58 +0000
Subject: [PATCH] Refactor some code.

---
 opends/src/guitools/org/opends/guitools/controlpanel/ui/SchemaBrowserRightPanel.java |   39 +++++++++++++++------------------------
 1 files changed, 15 insertions(+), 24 deletions(-)

diff --git a/opends/src/guitools/org/opends/guitools/controlpanel/ui/SchemaBrowserRightPanel.java b/opends/src/guitools/org/opends/guitools/controlpanel/ui/SchemaBrowserRightPanel.java
index 1087296..09528ab 100644
--- a/opends/src/guitools/org/opends/guitools/controlpanel/ui/SchemaBrowserRightPanel.java
+++ b/opends/src/guitools/org/opends/guitools/controlpanel/ui/SchemaBrowserRightPanel.java
@@ -72,6 +72,13 @@
 
   private NoItemSelectedPanel noEntryPanel = new NoItemSelectedPanel();
 
+  private final SchemaElementPanel[] panels =
+  {   standardObjectClassPanel, configurationObjectClassPanel,
+      customObjectClassPanel, standardAttributePanel,
+      configurationAttributePanel, customAttributePanel, matchingRulePanel,
+      attributeSyntaxPanel
+  };
+
   private final String NOTHING_SELECTED = "Nothing Selected";
 
 
@@ -105,12 +112,6 @@
   public void setInfo(ControlPanelInfo info)
   {
     super.setInfo(info);
-    StatusGenericPanel[] panels = {standardObjectClassPanel,
-        configurationObjectClassPanel, customObjectClassPanel,
-        standardAttributePanel, configurationAttributePanel,
-        customAttributePanel, matchingRulePanel,
-        attributeSyntaxPanel
-    };
     for (StatusGenericPanel panel : panels)
     {
       panel.setInfo(info);
@@ -124,14 +125,10 @@
   public void addSchemaElementSelectionListener(
       SchemaElementSelectionListener listener)
   {
-    standardObjectClassPanel.addSchemaElementSelectionListener(listener);
-    configurationObjectClassPanel.addSchemaElementSelectionListener(listener);
-    customObjectClassPanel.addSchemaElementSelectionListener(listener);
-    standardAttributePanel.addSchemaElementSelectionListener(listener);
-    configurationAttributePanel.addSchemaElementSelectionListener(listener);
-    customAttributePanel.addSchemaElementSelectionListener(listener);
-    matchingRulePanel.addSchemaElementSelectionListener(listener);
-    attributeSyntaxPanel.addSchemaElementSelectionListener(listener);
+    for (SchemaElementPanel panel : panels)
+    {
+      panel.addSchemaElementSelectionListener(listener);
+    }
   }
 
   /**
@@ -141,15 +138,10 @@
   public void removeSchemaElementSelectionListener(
       SchemaElementSelectionListener listener)
   {
-    standardObjectClassPanel.removeSchemaElementSelectionListener(listener);
-    configurationObjectClassPanel.removeSchemaElementSelectionListener(
-        listener);
-    customObjectClassPanel.removeSchemaElementSelectionListener(listener);
-    standardAttributePanel.removeSchemaElementSelectionListener(listener);
-    configurationAttributePanel.removeSchemaElementSelectionListener(listener);
-    customAttributePanel.removeSchemaElementSelectionListener(listener);
-    matchingRulePanel.removeSchemaElementSelectionListener(listener);
-    attributeSyntaxPanel.removeSchemaElementSelectionListener(listener);
+    for (SchemaElementPanel panel : panels)
+    {
+      panel.removeSchemaElementSelectionListener(listener);
+    }
   }
 
   /**
@@ -331,7 +323,6 @@
    */
   public Component getPreferredFocusComponent()
   {
-    // TODO
     return null;
   }
 

--
Gitblit v1.10.0