mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

jvergara
17.02.2008 6ba68335869125edfab5ebc453994d77ee93516c
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.
7 files modified
123 ■■■■ changed files
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/AbstractIndexPanel.java 17 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/AbstractVLVIndexPanel.java 18 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/BrowseIndexPanel.java 48 ●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/IndexPanel.java 1 ●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/NewIndexPanel.java 25 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/NewVLVIndexPanel.java 12 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/VLVIndexPanel.java 2 ●●● patch | view | raw | blame | history
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/AbstractIndexPanel.java
@@ -75,6 +75,15 @@
   */
  protected JLabel name = Utilities.createDefaultLabel();
  /**
   * Backends label.
   */
  protected JLabel lBackend = Utilities.createPrimaryLabel(
      INFO_CTRL_PANEL_BACKEND_LABEL.get());
  /**
   * Read-only backend name label.
   */
  protected JLabel backendName = Utilities.createDefaultLabel();
  /**
   * Label for attribute.
   */
  protected JLabel lAttribute =
@@ -301,6 +310,14 @@
    gbc.gridy ++;
    gbc.insets.left = 0;
    gbc.gridx = 0;
    c.add(lBackend, gbc);
    gbc.insets.left = 10;
    gbc.gridx = 1;
    c.add(backendName, gbc);
    gbc.gridy ++;
    gbc.insets.left = 0;
    gbc.gridx = 0;
    c.add(lEntryLimit, gbc);
    gbc.insets.left = 10;
    gbc.gridx = 1;
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/AbstractVLVIndexPanel.java
@@ -68,7 +68,6 @@
import org.opends.guitools.controlpanel.datamodel.ServerDescriptor;
import org.opends.guitools.controlpanel.datamodel.VLVIndexDescriptor;
import org.opends.guitools.controlpanel.datamodel.VLVSortOrder;
import org.opends.guitools.controlpanel.event.ConfigurationChangeEvent;
import org.opends.guitools.controlpanel.ui.components.TitlePanel;
import org.opends.guitools.controlpanel.ui.renderer.CustomListCellRenderer;
import org.opends.guitools.controlpanel.ui.renderer.IndexComboBoxCellRenderer;
@@ -321,6 +320,15 @@
  }
  /**
   * Sets the name of the backend where the index is defined or will be defined.
   * @param backendID the ID of the backend.
   */
  public void setBackendName(String backendID)
  {
    backendName.setText(backendID);
  }
  /**
   * Returns the LDIF representing the new index.
   * @param indexName the name of the index.
   * @return the LDIF representing the new index.
@@ -419,15 +427,13 @@
  /**
   * Updates the layout with the new changed configuration event.
   * @param ev the configuration change event.
   * Updates the layout with the provided server descriptor.
   * @param desc the server descriptor.
   * @return <CODE>true</CODE> if an error has been displayed and
   * <CODE>false</CODE> otherwise.
   */
  protected boolean updateLayout(ConfigurationChangeEvent ev)
  protected boolean updateLayout(final ServerDescriptor desc)
  {
    final ServerDescriptor desc = ev.getNewDescriptor();
    Schema schema = desc.getSchema();
    BackendDescriptor backend = getBackend();
    final boolean[] repack = {false};
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/BrowseIndexPanel.java
@@ -115,7 +115,9 @@
  private JMenuItem deleteMenuItem;
  private GenericDialog newIndexDialog;
  private NewIndexPanel newIndexPanel;
  private GenericDialog newVLVIndexDialog;
  private NewVLVIndexPanel newVLVIndexPanel;
  private boolean ignoreSelectionEvents;
@@ -772,16 +774,16 @@
  private void newIndexClicked()
  {
    if (newIndexDialog == null)
    if (newIndexPanel == null)
    {
      NewIndexPanel panel =
      newIndexPanel =
        new NewIndexPanel((String)backends.getSelectedItem(),
          Utilities.getParentDialog(this));
      panel.setInfo(getInfo());
      newIndexDialog = new GenericDialog(null, panel);
      newIndexPanel.setInfo(getInfo());
      newIndexDialog = new GenericDialog(null, newIndexPanel);
      Utilities.centerGoldenMean(newIndexDialog,
          Utilities.getParentDialog(this));
      panel.addConfigurationElementCreatedListener(
      newIndexPanel.addConfigurationElementCreatedListener(
          new ConfigurationElementCreatedListener()
          {
            public void elementCreated(ConfigurationElementCreatedEvent ev)
@@ -794,21 +796,34 @@
            }
          });
    }
    else if (!newIndexDialog.isVisible())
    {
      String backendID = (String)backends.getSelectedItem();
      for (BackendDescriptor backend :
        getInfo().getServerDescriptor().getBackends())
      {
        if (backend.getBackendID().equalsIgnoreCase(backendID))
        {
          newIndexPanel.update(backend);
          break;
        }
      }
    }
    newIndexDialog.setVisible(true);
  }
  private void newVLVIndexClicked()
  {
    if (newVLVIndexDialog == null)
    if (newVLVIndexPanel == null)
    {
      NewVLVIndexPanel panel =
      newVLVIndexPanel =
        new NewVLVIndexPanel((String)backends.getSelectedItem(),
          Utilities.getParentDialog(this));
      panel.setInfo(getInfo());
      newVLVIndexDialog = new GenericDialog(null, panel);
      newVLVIndexPanel.setInfo(getInfo());
      newVLVIndexDialog = new GenericDialog(null, newVLVIndexPanel);
      Utilities.centerGoldenMean(newVLVIndexDialog,
          Utilities.getParentDialog(this));
      panel.addConfigurationElementCreatedListener(
      newVLVIndexPanel.addConfigurationElementCreatedListener(
          new ConfigurationElementCreatedListener()
          {
            /**
@@ -824,6 +839,19 @@
            }
          });
    }
    else if (!newVLVIndexDialog.isVisible())
    {
      String backendID = (String)backends.getSelectedItem();
      for (BackendDescriptor backend :
        getInfo().getServerDescriptor().getBackends())
      {
        if (backend.getBackendID().equalsIgnoreCase(backendID))
        {
          newVLVIndexPanel.update(backend);
          break;
        }
      }
    }
    newVLVIndexDialog.setVisible(true);
  }
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/IndexPanel.java
@@ -432,6 +432,7 @@
    setPrimaryValid(lEntryLimit);
    setPrimaryValid(lType);
    name.setText(index.getName());
    backendName.setText(index.getBackend().getBackendID());
    titlePanel.setDetails(Message.raw(index.getName()));
    entryLimit.setText(String.valueOf(index.getEntryLimit()));
    approximate.setSelected(false);
opendj-sdk/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");
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/NewVLVIndexPanel.java
@@ -110,7 +110,7 @@
   */
  public void configurationChanged(ConfigurationChangeEvent ev)
  {
    if (updateLayout(ev))
    if (updateLayout(ev.getNewDescriptor()))
    {
      updateErrorPaneAndOKButtonIfAuthRequired(ev.getNewDescriptor(),
          INFO_CTRL_PANEL_AUTHENTICATION_REQUIRED_FOR_NEW_VLV.get());
@@ -118,6 +118,16 @@
  }
  /**
   * 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)
  {
    updateBaseDNCombo(backend);
    backendName.setText(backend.getBackendID());
  }
  /**
   * {@inheritDoc}
   */
  public void okClicked()
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/VLVIndexPanel.java
@@ -144,7 +144,7 @@
   */
  public void configurationChanged(final ConfigurationChangeEvent ev)
  {
    if (updateLayout(ev))
    if (updateLayout(ev.getNewDescriptor()))
    {
      updateErrorPaneIfAuthRequired(ev.getNewDescriptor(),
          INFO_CTRL_PANEL_AUTHENTICATION_REQUIRED_FOR_VLV_INDEX_EDITING.get());