From 0ba9cfdaa9e34f3979a21b639656946f254a8e52 Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Mon, 17 Nov 2008 02:02:49 +0000
Subject: [PATCH] Fix for issue 3588 (Control Panel : not all Base DN available for VLV index creation) Set the name of the backend that is being displayed in the 'Manage Index' window when the user clicks on 'New Index...' or 'New VLV Index...' buttons.

---
 opends/src/guitools/org/opends/guitools/controlpanel/ui/NewIndexPanel.java |   25 ++++++++++++++++---------
 1 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/opends/src/guitools/org/opends/guitools/controlpanel/ui/NewIndexPanel.java b/opends/src/guitools/org/opends/guitools/controlpanel/ui/NewIndexPanel.java
index 091d09f..a3c82f7 100644
--- a/opends/src/guitools/org/opends/guitools/controlpanel/ui/NewIndexPanel.java
+++ b/opends/src/guitools/org/opends/guitools/controlpanel/ui/NewIndexPanel.java
@@ -87,8 +87,6 @@
 {
   private static final long serialVersionUID = -3516011638125862137L;
 
-  private String backendName;
-
   private Component relativeComponent;
 
   private Schema schema;
@@ -104,7 +102,7 @@
   public NewIndexPanel(String backendName, Component relativeComponent)
   {
     super();
-    this.backendName = backendName;
+    this.backendName.setText(backendName);
     this.relativeComponent = relativeComponent;
     createLayout();
   }
@@ -126,6 +124,15 @@
   }
 
   /**
+   * Updates the contents of the panel with the provided backend.
+   * @param backend the backend where the index will be created.
+   */
+  public void update(BackendDescriptor backend)
+  {
+    backendName.setText(backend.getBackendID());
+  }
+
+  /**
    * {@inheritDoc}
    */
   public void configurationChanged(ConfigurationChangeEvent ev)
@@ -146,7 +153,7 @@
       BackendDescriptor backend = null;
       for (BackendDescriptor b : getInfo().getServerDescriptor().getBackends())
       {
-        if (b.getBackendID().equalsIgnoreCase(backendName))
+        if (b.getBackendID().equalsIgnoreCase(backendName.getText()))
         {
           backend = b;
           break;
@@ -403,7 +410,7 @@
     {
       super(info, dlg);
       backendSet = new HashSet<String>();
-      backendSet.add(backendName);
+      backendSet.add(backendName.getText());
       attributeName = getAttributeName();
       entryLimitValue = Integer.parseInt(entryLimit.getText());
       indexTypes = getTypes();
@@ -431,7 +438,7 @@
     public Message getTaskDescription()
     {
       return INFO_CTRL_PANEL_NEW_INDEX_TASK_DESCRIPTION.get(
-          attributeName, backendName);
+          attributeName, backendName.getText());
     }
 
     /**
@@ -557,7 +564,7 @@
     private String getIndexLDIF()
     {
       String dn = Utilities.getRDNString(
-          "ds-cfg-backend-id", backendName)+",cn=Backends,cn=config";
+          "ds-cfg-backend-id", backendName.getText())+",cn=Backends,cn=config";
       ArrayList<String> lines = new ArrayList<String>();
       lines.add("dn: "+Utilities.getRDNString("ds-cfg-attribute",
           attributeName)+
@@ -712,7 +719,7 @@
         for (BackendDescriptor backend :
           getInfo().getServerDescriptor().getBackends())
         {
-          if (backend.getBackendID().equalsIgnoreCase(backendName))
+          if (backend.getBackendID().equalsIgnoreCase(backendName.getText()))
           {
             newIndex = new IndexDescriptor(attributeName,
                 schema.getAttributeType(attributeName.toLowerCase()), backend,
@@ -748,7 +755,7 @@
       ArrayList<String> args = new ArrayList<String>();
       args.add("create-local-db-index");
       args.add("--backend-name");
-      args.add(backendName);
+      args.add(backendName.getText());
       args.add("--type");
       args.add("generic");
 

--
Gitblit v1.10.0