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

jvergara
16.47.2009 a7b94fda4da94ae07e6d21a34ce883dbb46bf687
Fix for issue 4292 (control panel browse entries should not use the ManageDSAIT control systematically)

Add two menu items in the 'View' menu of the browse entries panel where the user can specify to sort the user data and to follow referrals automatically. The request control are updated depending on what the user chooses and these request controls that are used are not critical.
3 files modified
90 ■■■■ changed files
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/browser/BrowserController.java 37 ●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/BrowseEntriesPanel.java 51 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/messages/messages/admin_tool.properties 2 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/browser/BrowserController.java
@@ -159,7 +159,7 @@
    tree.setCellRenderer(new BrowserCellRenderer());
    displayFlags = DISPLAY_ACI_COUNT;
    displayAttribute = RDN_ATTRIBUTE;
    followReferrals = true;
    followReferrals = false;
    sorted = false;
    showContainerOnly = true;
    containerClasses = new String[0];
@@ -457,10 +457,18 @@
   * Enable/display the following of referrals.
   * This routine starts a refresh on each referral node.
   * @param followReferrals whether to follow referrals or not.
   * @throws NamingException if there is an error updating the request controls
   * of the internal connections.
   */
  public void setFollowReferrals(boolean followReferrals) {
  public void setFollowReferrals(boolean followReferrals) throws NamingException
  {
    this.followReferrals = followReferrals;
    startRefreshReferralNodes(rootNode);
    stopRefresh();
    removeAllChildNodes(rootNode, true /* Keep suffixes */);
    ctxConfiguration.setRequestControls(getConfigurationRequestControls());
    ctxUserData.setRequestControls(getRequestControls());
    connectionPool.setRequestControls(getRequestControls());
    startRefresh(null);
  }
@@ -1324,16 +1332,24 @@
   */
  Control[] getRequestControls()
  {
    Control ctls[] = new Control[sorted ? 2 : 1];
    ctls[0] = new ManageReferralControl(true);
    if (sorted) {
    Control ctls[];
    if (followReferrals)
    {
      ctls = new Control[sorted ? 2 : 1];
    }
    else
    {
      ctls = new Control[sorted ? 1 : 0];
    }
    if (sorted)
    {
      SortKey[] keys = new SortKey[SORT_ATTRIBUTES.length];
      for (int i=0; i<keys.length; i++) {
        keys[i] = new SortKey(SORT_ATTRIBUTES[i]);
      }
      try
      {
        ctls[1] = new SortControl(keys, true);
        ctls[0] = new SortControl(keys, false);
      }
      catch (IOException ioe)
      {
@@ -1342,6 +1358,10 @@
            ioe);
      }
    }
    if (followReferrals)
    {
      ctls[ctls.length - 1] = new ManageReferralControl(false);
    }
    return ctls;
  }
@@ -1351,8 +1371,7 @@
   */
  Control[] getConfigurationRequestControls()
  {
    Control ctls[] = new Control[0];
    return ctls;
    return getRequestControls();
  }
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/BrowseEntriesPanel.java
@@ -53,8 +53,10 @@
import java.util.LinkedHashSet;
import javax.naming.InterruptedNamingException;
import javax.naming.NamingException;
import javax.naming.ldap.InitialLdapContext;
import javax.swing.ButtonGroup;
import javax.swing.JCheckBoxMenuItem;
import javax.swing.JComponent;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
@@ -1123,7 +1125,7 @@
        menu.add(menus[i]);
        group.add(menus[i]);
      }
      ActionListener listener = new ActionListener()
      ActionListener radioListener = new ActionListener()
      {
        private boolean ignoreEvents;
        private JRadioButtonMenuItem lastSelected = menus[0];
@@ -1166,9 +1168,54 @@
      };
      for (int i=0; i<labels.length; i++)
      {
        menus[i].addActionListener(listener);
        menus[i].addActionListener(radioListener);
      }
      menus[0].setSelected(true);
      // Add the view menus
      menu.add(new JSeparator());
      final JCheckBoxMenuItem sortUserData =
        new JCheckBoxMenuItem(INFO_CTRL_PANEL_SORT_USER_DATA.get().toString());
      final JCheckBoxMenuItem followReferrals = new JCheckBoxMenuItem(
        INFO_CTRL_PANEL_FOLLOW_REFERRALS.get().toString());
      menu.add(sortUserData);
      menu.add(followReferrals);
      sortUserData.setSelected(entryPane.getController().isSorted());
      followReferrals.setSelected(
          entryPane.getController().getFollowReferrals());
      sortUserData.addActionListener(new ActionListener()
      {
        public void actionPerformed(ActionEvent ev)
        {
          try
          {
            entryPane.getController().setSorted(sortUserData.isSelected());
          }
          catch (NamingException ne)
          {
            // Bug
            System.err.println("Unexpected error updating sorting.");
            ne.printStackTrace();
          }
        }
      });
      followReferrals.addActionListener(new ActionListener()
      {
        public void actionPerformed(ActionEvent ev)
        {
          try
          {
            entryPane.getController().setFollowReferrals(
                followReferrals.isSelected());
          }
          catch (NamingException ne)
          {
            // Bug
            System.err.println("Unexpected error updating referral state.");
            ne.printStackTrace();
          }
        }
      });
      return menu;
    }
opendj-sdk/opends/src/messages/messages/admin_tool.properties
@@ -1527,6 +1527,8 @@
INFO_CTRL_PANEL_SIMPLIFIED_VIEW_MENU=Simplified View
INFO_CTRL_PANEL_ATTRIBUTE_VIEW_MENU=Attribute View
INFO_CTRL_PANEL_LDIF_VIEW_MENU=LDIF View
INFO_CTRL_PANEL_SORT_USER_DATA=Sort User Data
INFO_CTRL_PANEL_FOLLOW_REFERRALS=Follow Referrals
INFO_CTRL_PANEL_DELETE_ENTRY_MENU=Delete Entry...
INFO_CTRL_PANEL_DELETE_ENTRY_BUTTON=Delete Entry...
INFO_CTRL_PANEL_DELETE_BASE_DN_MENU=Delete Base DN...