From 013494192c189ce5bd101f198c4d33230374d4b8 Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Thu, 17 Dec 2009 21:11:04 +0000
Subject: [PATCH] Fix for issue 3601 (Control Panel: unable to modify schema objects or attributes)

---
 opends/src/guitools/org/opends/guitools/controlpanel/task/Task.java |   56 ++++++++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 46 insertions(+), 10 deletions(-)

diff --git a/opends/src/guitools/org/opends/guitools/controlpanel/task/Task.java b/opends/src/guitools/org/opends/guitools/controlpanel/task/Task.java
index e913a3d..ebf75e6 100644
--- a/opends/src/guitools/org/opends/guitools/controlpanel/task/Task.java
+++ b/opends/src/guitools/org/opends/guitools/controlpanel/task/Task.java
@@ -45,6 +45,9 @@
 import org.opends.admin.ads.util.ConnectionUtils;
 import org.opends.guitools.controlpanel.datamodel.ControlPanelInfo;
 import org.opends.guitools.controlpanel.datamodel.ServerDescriptor;
+import org.opends.guitools.controlpanel.event.ConfigurationElementCreatedEvent;
+import org.opends.guitools.controlpanel.event.
+ ConfigurationElementCreatedListener;
 import org.opends.guitools.controlpanel.event.PrintStreamListener;
 import org.opends.guitools.controlpanel.ui.ColorAndFontConstants;
 import org.opends.guitools.controlpanel.ui.ProgressDialog;
@@ -150,21 +153,17 @@
      */
     JAVA_SETTINGS_UPDATE,
     /**
-     * Creating a new attribute in the schema.
+     * Creating a new element in the schema.
      */
-    NEW_ATTRIBUTE,
+    NEW_SCHEMA_ELEMENT,
     /**
-     * Creating a new objectclass in the schema.
+     * Deleting an schema element.
      */
-    NEW_OBJECTCLASS,
+    DELETE_SCHEMA_ELEMENT,
     /**
-     * Deleting an attribute in the schema.
+     * Modify an schema element.
      */
-    DELETE_ATTRIBUTE,
-    /**
-     * Deleting an objectclass in the schema.
-     */
-    DELETE_OBJECTCLASS,
+    MODIFY_SCHEMA_ELEMENT,
     /**
      * Modifying an entry.
      */
@@ -269,6 +268,9 @@
 
   private ProgressDialog progressDialog;
 
+  private ArrayList<ConfigurationElementCreatedListener> confListeners =
+    new ArrayList<ConfigurationElementCreatedListener>();
+
   private static int MAX_BINARY_LENGTH_TO_DISPLAY = 1024;
 
   /**
@@ -424,6 +426,40 @@
   public abstract Message getTaskDescription();
 
   /**
+   * Adds a configuration element created listener.
+   * @param listener the listener.
+   */
+  public void addConfigurationElementCreatedListener(
+      ConfigurationElementCreatedListener listener)
+  {
+    confListeners.add(listener);
+  }
+
+  /**
+   * Removes a configuration element created listener.
+   * @param listener the listener.
+   */
+  public void removeConfigurationElementCreatedListener(
+      ConfigurationElementCreatedListener listener)
+  {
+    confListeners.remove(listener);
+  }
+
+  /**
+   * Notifies the configuration element created listener that a new object has
+   * been created.
+   * @param configObject the created object.
+   */
+  protected void notifyConfigurationElementCreated(Object configObject)
+  {
+    for (ConfigurationElementCreatedListener listener : confListeners)
+    {
+      listener.elementCreated(
+          new ConfigurationElementCreatedEvent(this, configObject));
+    }
+  }
+
+  /**
    * Returns a String representation of a value.  In general this is called
    * to display the command-line equivalent when we do a modification in an
    * entry.  But since some attributes must be obfuscated (like the user

--
Gitblit v1.10.0