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

jvergara
06.39.2010 cd0daf51edd2805cdaef032ab5e96553fb672165
Fix for issue 4417 (control panel manage tasks not showing tasks log message)
Display the log messages of the selected task.
Improve how the panel handle the modification in the contents of the task and when the user modifies the displayed attributes in the table. Before this changes the selection of the table was always lost, with this changes the previously selected task(s) are still selected.
Improve some labeling in the 'View' menu.
14 files modified
382 ■■■■■ changed files
opends/src/guitools/org/opends/guitools/controlpanel/datamodel/CustomSearchResult.java 22 ●●●● patch | view | raw | blame | history
opends/src/guitools/org/opends/guitools/controlpanel/datamodel/SortableTableModel.java 4 ●●● patch | view | raw | blame | history
opends/src/guitools/org/opends/guitools/controlpanel/task/ModifyEntryTask.java 31 ●●●● patch | view | raw | blame | history
opends/src/guitools/org/opends/guitools/controlpanel/ui/DuplicateEntryPanel.java 6 ●●●● patch | view | raw | blame | history
opends/src/guitools/org/opends/guitools/controlpanel/ui/LDAPEntryPanel.java 6 ●●●● patch | view | raw | blame | history
opends/src/guitools/org/opends/guitools/controlpanel/ui/LDIFViewEntryPanel.java 12 ●●●● patch | view | raw | blame | history
opends/src/guitools/org/opends/guitools/controlpanel/ui/ManageTasksPanel.java 159 ●●●● patch | view | raw | blame | history
opends/src/guitools/org/opends/guitools/controlpanel/ui/SimplifiedViewEntryPanel.java 68 ●●●● patch | view | raw | blame | history
opends/src/guitools/org/opends/guitools/controlpanel/ui/TableViewEntryPanel.java 22 ●●●● patch | view | raw | blame | history
opends/src/guitools/org/opends/guitools/controlpanel/ui/ViewEntryPanel.java 20 ●●●● patch | view | raw | blame | history
opends/src/guitools/org/opends/guitools/controlpanel/util/ConfigFromDirContext.java 16 ●●●●● patch | view | raw | blame | history
opends/src/guitools/org/opends/guitools/controlpanel/util/RemoteSchemaLoader.java 7 ●●●●● patch | view | raw | blame | history
opends/src/guitools/org/opends/guitools/controlpanel/util/Utilities.java 4 ●●●● patch | view | raw | blame | history
opends/src/messages/messages/admin_tool.properties 5 ●●●●● patch | view | raw | blame | history
opends/src/guitools/org/opends/guitools/controlpanel/datamodel/CustomSearchResult.java
@@ -22,7 +22,7 @@
 * CDDL HEADER END
 *
 *
 *      Copyright 2008-2009 Sun Microsystems, Inc.
 *      Copyright 2008-2010 Sun Microsystems, Inc.
 */
package org.opends.guitools.controlpanel.datamodel;
@@ -32,10 +32,8 @@
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.SortedSet;
import java.util.TreeSet;
@@ -70,7 +68,7 @@
public class CustomSearchResult implements Comparable<CustomSearchResult> {
  private Name name;
  private String dn;
  private Map<String, Set<Object>> attributes;
  private Map<String, List<Object>> attributes;
  private SortedSet<String> attrNames;
  private String toString;
  private int hashCode;
@@ -84,7 +82,7 @@
  public CustomSearchResult(String dn)
  {
    this.dn = dn;
    attributes = new HashMap<String, Set<Object>>();
    attributes = new HashMap<String, List<Object>>();
    attrNames = new TreeSet<String>();
    toString = calculateToString();
    hashCode = calculateHashCode();
@@ -131,17 +129,17 @@
    }
    dn = buf.toString();
    attributes = new HashMap<String, Set<Object>>();
    attributes = new HashMap<String, List<Object>>();
    attrNames = new TreeSet<String>();
    Attributes attrs = sr.getAttributes();
    if (attrs != null)
    {
      NamingEnumeration en = attrs.getAll();
      NamingEnumeration<?> en = attrs.getAll();
      while (en.hasMore()) {
        Attribute attr = (Attribute)en.next();
        String name = attr.getID();
        attrNames.add(name);
        Set<Object> values = new HashSet<Object>();
        List<Object> values = new ArrayList<Object>();
        for (int i=0; i<attr.size(); i++)
        {
          Object v = attr.get(i);
@@ -172,11 +170,11 @@
   * @return the values for a given attribute.  It returns an empty Set if
   * the attribute is not defined.
   */
  public Set<Object> getAttributeValues(String name) {
    Set<Object> values = attributes.get(name.toLowerCase());
  public List<Object> getAttributeValues(String name) {
    List<Object> values = attributes.get(name.toLowerCase());
    if (values == null)
    {
      values = Collections.emptySet();
      values = Collections.emptyList();
    }
    return values;
  }
@@ -258,7 +256,7 @@
   * @param attrName the name of the attribute.
   * @param values the values for the attribute.
   */
  public void set(String attrName, Set<Object> values)
  public void set(String attrName, List<Object> values)
  {
    attrNames.add(attrName);
    attrName = attrName.toLowerCase();
opends/src/guitools/org/opends/guitools/controlpanel/datamodel/SortableTableModel.java
@@ -22,7 +22,7 @@
 * CDDL HEADER END
 *
 *
 *      Copyright 2008 Sun Microsystems, Inc.
 *      Copyright 2008-2010 Sun Microsystems, Inc.
 */
package org.opends.guitools.controlpanel.datamodel;
@@ -40,6 +40,8 @@
 */
public abstract class SortableTableModel extends AbstractTableModel
{
  private static final long serialVersionUID = 123129879083L;
  /**
   * Returns whether the sort is ascending or descending.
   * @return <CODE>true</CODE> if the sort is ascending and <CODE>false</CODE>
opends/src/guitools/org/opends/guitools/controlpanel/task/ModifyEntryTask.java
@@ -22,7 +22,7 @@
 * CDDL HEADER END
 *
 *
 *      Copyright 2008-2009 Sun Microsystems, Inc.
 *      Copyright 2008-2010 Sun Microsystems, Inc.
 */
package org.opends.guitools.controlpanel.task;
@@ -33,7 +33,6 @@
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;
@@ -403,7 +402,7 @@
        boolean entryContainsRdnTypes = true;
        for (int i=0; (i<newRDN.getNumValues()) && entryContainsRdnTypes; i++)
        {
          Set<Object> values = originalEntry.getAttributeValues(
          List<Object> values = originalEntry.getAttributeValues(
          newRDN.getAttributeName(i));
          entryContainsRdnTypes = !values.isEmpty();
        }
@@ -513,13 +512,13 @@
        attrType = DirectoryServer.getDefaultAttributeType(
            attr.getName().toLowerCase());
      }
      Set<AttributeValue> newValues = new LinkedHashSet<AttributeValue>();
      List<AttributeValue> newValues = new ArrayList<AttributeValue>();
      Iterator<AttributeValue> it = attr.iterator();
      while (it.hasNext())
      {
        newValues.add(it.next());
      }
      Set<Object> oldValues = oldEntry.getAttributeValues(attrName);
      List<Object> oldValues = oldEntry.getAttributeValues(attrName);
      boolean isAttributeInNewRdn = false;
      AttributeValue rdnValue = null;
@@ -596,13 +595,13 @@
              createAttribute(attrName, newValues)));
        }
      } else {
        Set<AttributeValue> toDelete = getValuesToDelete(oldValues, newValues,
        List<AttributeValue> toDelete = getValuesToDelete(oldValues, newValues,
            attrType);
        if (oldRdnValueDeleted != null)
        {
          toDelete.remove(oldRdnValueDeleted);
        }
        Set<AttributeValue> toAdd = getValuesToAdd(oldValues, newValues,
        List<AttributeValue> toAdd = getValuesToAdd(oldValues, newValues,
            attrType);
        if (oldRdnValueToAdd != null)
        {
@@ -625,7 +624,7 @@
          }
          if (toAdd.size() > 0)
          {
            Set<AttributeValue> vs = new HashSet<AttributeValue>();
            List<AttributeValue> vs = new ArrayList<AttributeValue>();
            vs.addAll(toAdd);
            if (rdnValue != null)
            {
@@ -649,7 +648,7 @@
      {
        continue;
      }
      Set<Object> oldValues = oldEntry.getAttributeValues(attrName);
      List<Object> oldValues = oldEntry.getAttributeValues(attrName);
      String attrNoOptions =
        Utilities.getAttributeNameWithoutOptions(attrName).toLowerCase();
@@ -684,7 +683,7 @@
   * @return a JNDI attribute using an attribute name and a set of values.
   */
  private static Attribute createAttribute(String attrName,
      Set<AttributeValue> values) {
      List<AttributeValue> values) {
    Attribute attribute = new BasicAttribute(attrName);
    for (AttributeValue value : values)
    {
@@ -726,10 +725,10 @@
   * @param attrType the attribute type.
   * @return the set of AttributeValue that must be deleted.
   */
  private static Set<AttributeValue> getValuesToDelete(Set<Object> oldValues,
      Set<AttributeValue> newValues, AttributeType attrType)
  private static List<AttributeValue> getValuesToDelete(List<Object> oldValues,
      List<AttributeValue> newValues, AttributeType attrType)
  {
    Set<AttributeValue> valuesToDelete = new HashSet<AttributeValue>();
    List<AttributeValue> valuesToDelete = new ArrayList<AttributeValue>();
    for (Object o : oldValues)
    {
      AttributeValue oldValue = createAttributeValue(attrType, o);
@@ -748,10 +747,10 @@
   * @param attrType the attribute type.
   * @return the set of AttributeValue that must be added.
   */
  private static Set<AttributeValue> getValuesToAdd(Set<Object> oldValues,
    Set<AttributeValue> newValues, AttributeType attrType)
  private static List<AttributeValue> getValuesToAdd(List<Object> oldValues,
    List<AttributeValue> newValues, AttributeType attrType)
  {
    Set<AttributeValue> valuesToAdd = new HashSet<AttributeValue>();
    List<AttributeValue> valuesToAdd = new ArrayList<AttributeValue>();
    for (AttributeValue newValue : newValues)
    {
      boolean found = false;
opends/src/guitools/org/opends/guitools/controlpanel/ui/DuplicateEntryPanel.java
@@ -22,7 +22,7 @@
 * CDDL HEADER END
 *
 *
 *      Copyright 2009 Sun Microsystems, Inc.
 *      Copyright 2009-2010 Sun Microsystems, Inc.
 */
package org.opends.guitools.controlpanel.ui;
@@ -35,7 +35,7 @@
import java.awt.event.ActionListener;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Set;
import java.util.List;
import javax.naming.ldap.InitialLdapContext;
import javax.swing.JButton;
@@ -351,7 +351,7 @@
    sb.append("dn: "+dn);
    for (String attrName : entryToDuplicate.getAttributeNames())
    {
      Set<Object> values = entryToDuplicate.getAttributeValues(attrName);
      List<Object> values = entryToDuplicate.getAttributeValues(attrName);
      if (attrName.equalsIgnoreCase(ServerConstants.ATTR_USER_PASSWORD))
      {
        sb.append("\n");
opends/src/guitools/org/opends/guitools/controlpanel/ui/LDAPEntryPanel.java
@@ -22,7 +22,7 @@
 * CDDL HEADER END
 *
 *
 *      Copyright 2008-2009 Sun Microsystems, Inc.
 *      Copyright 2008-2010 Sun Microsystems, Inc.
 */
package org.opends.guitools.controlpanel.ui;
@@ -36,7 +36,7 @@
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.Set;
import java.util.List;
import javax.swing.JButton;
import javax.swing.JPanel;
@@ -606,7 +606,7 @@
    // Rely in numsubordinates...
    boolean isLeaf = true;
    Set<Object> o = searchResult.getAttributeValues("numsubordinates");
    List<Object> o = searchResult.getAttributeValues("numsubordinates");
    if (!o.isEmpty())
    {
      int numsubordinates = Integer.parseInt((String)o.iterator().next());
opends/src/guitools/org/opends/guitools/controlpanel/ui/LDIFViewEntryPanel.java
@@ -22,7 +22,7 @@
 * CDDL HEADER END
 *
 *
 *      Copyright 2008 Sun Microsystems, Inc.
 *      Copyright 2008-2010 Sun Microsystems, Inc.
 */
package org.opends.guitools.controlpanel.ui;
@@ -34,7 +34,7 @@
import java.awt.Point;
import java.io.IOException;
import java.io.StringReader;
import java.util.Set;
import java.util.List;
import javax.swing.JLabel;
import javax.swing.JScrollPane;
@@ -170,7 +170,7 @@
      editableScroll.setVisible(false);
      for (String attrName : sr.getAttributeNames())
      {
        Set<Object> values = sr.getAttributeValues(attrName);
        List<Object> values = sr.getAttributeValues(attrName);
        for (Object o : values)
        {
          sb.append("\n"+ getLDIFLine(attrName, o));
@@ -201,7 +201,7 @@
      {
        if (!schemaReadOnlyAttributesLowerCase.contains(attrName.toLowerCase()))
        {
          Set<Object> values = sr.getAttributeValues(attrName);
          List<Object> values = sr.getAttributeValues(attrName);
          for (Object o : values)
          {
            sb.append("\n"+ getLDIFLine(attrName, o));
@@ -232,7 +232,7 @@
      sb = new StringBuilder();
      for (String attrName : schemaReadOnlyAttributes)
      {
        Set<Object> values = sr.getAttributeValues(attrName);
        List<Object> values = sr.getAttributeValues(attrName);
        for (Object o : values)
        {
          if (oneLineAdded)
@@ -294,7 +294,7 @@
  /**
   * {@inheritDoc}
   */
  protected Set<Object> getValues(String attrName)
  protected List<Object> getValues(String attrName)
  {
    throw new IllegalStateException("This method should not be called.");
  }
opends/src/guitools/org/opends/guitools/controlpanel/ui/ManageTasksPanel.java
@@ -22,7 +22,7 @@
 * CDDL HEADER END
 *
 *
 *      Copyright 2009 Sun Microsystems, Inc.
 *      Copyright 2009-2010 Sun Microsystems, Inc.
 */
package org.opends.guitools.controlpanel.ui;
@@ -57,6 +57,7 @@
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JTextArea;
import javax.swing.ListSelectionModel;
import javax.swing.SwingUtilities;
import javax.swing.event.ListSelectionEvent;
@@ -124,6 +125,10 @@
  private JLabel noDetailsLabel;
  // The panel containing all the labels and values of the details.
  private JPanel detailsSubpanel;
  private JLabel logsLabel;
  private JScrollPane logsScroll;
  private JTextArea logs;
  private JLabel noLogsLabel;
  private static final Logger LOG =
    Logger.getLogger(ManageTasksPanel.class.getName());
@@ -251,7 +256,21 @@
    gbc.insets.top = 10;
    gbc.anchor = GridBagConstraints.NORTHWEST;
    // Done to provide a good size to the table.
    tableModel = new TaskTableModel();
    tableModel = new TaskTableModel()
    {
      private static final long serialVersionUID = 55555512319230987L;
      /**
       * Updates the table model contents and sorts its contents depending on
       * the sort options set by the user.
       */
      public void forceResort()
      {
        Set<String> selectedIds = getSelectedIds();
        super.forceResort();
        setSelectedIds(selectedIds);
      }
    };
    tableModel.setData(createDummyTaskList());
    taskTable =
      Utilities.createSortableTable(tableModel, new TaskCellRenderer());
@@ -292,10 +311,44 @@
    gbc.gridy ++;
    gbc.gridx = 0;
    gbc.gridwidth = 2;
    gbc.weightx = 0.0;
    gbc.weighty = 0.0;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.anchor = GridBagConstraints.NORTHWEST;
    gbc.insets.top = 15;
    gbc.insets.left = 0;
    logsLabel = Utilities.createDefaultLabel(
        INFO_CTRL_PANEL_TASK_LOG_LABEL.get());
    logsLabel.setFont(ColorAndFontConstants.titleFont);
    add(logsLabel, gbc);
    logs = Utilities.createNonEditableTextArea(Message.EMPTY, 5, 50);
    logs.setFont(ColorAndFontConstants.defaultFont);
    gbc.fill = GridBagConstraints.BOTH;
    gbc.weightx = 1.0;
    gbc.weighty = 0.7;
    gbc.gridy ++;
    gbc.insets.top = 5;
    logsScroll = Utilities.createScrollPane(logs);
    add(logsScroll, gbc);
    int height = logsScroll.getPreferredSize().height;
    add(Box.createVerticalStrut(height), gbc);
    logsScroll.setVisible(false);
    gbc.anchor = GridBagConstraints.CENTER;
    gbc.fill = GridBagConstraints.NONE;
    gbc.weightx = 1.0;
    gbc.weighty = 1.0;
    noLogsLabel =
      Utilities.createDefaultLabel(INFO_CTRL_PANEL_NO_TASK_SELECTED.get());
    add(noLogsLabel, gbc);
    gbc.fill = GridBagConstraints.BOTH;
    gbc.weightx = 1.0;
    gbc.weighty = 0.8;
    gbc.gridy ++;
    gbc.insets.left = 0;
    gbc.insets.top = 15;
    createDetailsPanel();
    add(detailsPanel, gbc);
@@ -321,12 +374,16 @@
  {
    detailsPanel = new JPanel(new GridBagLayout());
    detailsPanel.setOpaque(false);
    detailsPanel.setBorder(Utilities.makeTitledBorder(
        INFO_CTRL_PANEL_TASK_SPECIFIC_DETAILS.get()));
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.gridx = 1;
    gbc.gridy = 1;
    gbc.anchor = GridBagConstraints.NORTHWEST;
    JLabel label = Utilities.createDefaultLabel(
        INFO_CTRL_PANEL_TASK_SPECIFIC_DETAILS.get());
    label.setFont(ColorAndFontConstants.titleFont);
    detailsPanel.add(label, gbc);
    gbc.gridy ++;
    gbc.anchor = GridBagConstraints.CENTER;
    gbc.fill = GridBagConstraints.NONE;
    gbc.weightx = 1.0;
@@ -360,17 +417,45 @@
    if (tasks.isEmpty())
    {
      noDetailsLabel.setText(INFO_CTRL_PANEL_NO_TASK_SELECTED.get().toString());
      logsScroll.setVisible(false);
      noLogsLabel.setText(INFO_CTRL_PANEL_NO_TASK_SELECTED.get().toString());
      noLogsLabel.setVisible(true);
    }
    else if (tasks.size() > 1)
    {
      noDetailsLabel.setText(
          INFO_CTRL_PANEL_MULTIPLE_TASKS_SELECTED.get().toString());
      logsScroll.setVisible(false);
      noLogsLabel.setText(
          INFO_CTRL_PANEL_MULTIPLE_TASKS_SELECTED.get().toString());
      noLogsLabel.setVisible(true);
    }
    else
    {
      TaskEntry taskEntry = tasks.iterator().next();
      Map<Message,List<String>> taskSpecificAttrs =
        taskEntry.getTaskSpecificAttributeValuePairs();
      List<Message> lastLogMessages = taskEntry.getLogMessages();
      if (!lastLogMessages.isEmpty())
      {
        StringBuilder sb = new StringBuilder();
        for (Message msg : lastLogMessages)
        {
          if (sb.length() != 0)
          {
            sb.append("\n");
          }
          sb.append(msg);
        }
        logs.setText(sb.toString());
      }
      else
      {
        logs.setText("");
      }
      logsScroll.setVisible(true);
      noLogsLabel.setVisible(false);
      if (taskSpecificAttrs.isEmpty())
      {
        noDetailsLabel.setText(
@@ -397,25 +482,16 @@
          gbc.gridx = 1;
          gbc.insets.right = 10;
          Message msg;
          String s = Utils.getStringFromCollection(values, "<br>");
          if (values.size() > 1)
          {
            msg = Message.raw(
                "<html>"+Utilities.applyFont(s,
                    ColorAndFontConstants.defaultFont));
          }
          else
          {
            msg = Message.raw(s);
          }
          detailsSubpanel.add(Utilities.createDefaultLabel(msg), gbc);
          String s = Utils.getStringFromCollection(values, "\n");
          detailsSubpanel.add(
              Utilities.makeHtmlPane(s, ColorAndFontConstants.defaultFont),
              gbc);
          gbc.gridy ++;
        }
        gbc.gridx = 0;
        gbc.insets = new Insets(0, 0, 0, 0);
        detailsSubpanel.add(Box.createVerticalStrut(10), gbc);
        detailsSubpanel.add(Box.createVerticalStrut(30), gbc);
        gbc.gridx = 1;
        gbc.weightx = 1.0;
        gbc.weighty = 1.0;
@@ -479,7 +555,7 @@
      };
      for (int j=0; j < attrNames.length; j++)
      {
        Set<Object> attrValues = new HashSet<Object>(1);
        List<Object> attrValues = new ArrayList<Object>(1);
        attrValues.add(values[j] + r.nextInt());
        csr.set(attrNames[j], attrValues);
      }
@@ -546,7 +622,7 @@
      };
      for (int j=0; j < attrNames.length; j++)
      {
        Set<Object> attrValues = new HashSet<Object>(1);
        List<Object> attrValues = new ArrayList<Object>(1);
        attrValues.add(values[j]);
        csr.set(attrNames[j], attrValues);
      }
@@ -857,11 +933,18 @@
         */
        public void run()
        {
          Set<String> selectedIds = getSelectedIds();
          tableModel.setData(tasks);
          boolean visible = tableModel.getRowCount() > 0;
          if (visible)
          {
            updateTableSizes();
            setSelectedIds(selectedIds);
          }
          else
          {
            logsLabel.setVisible(false);
            logsScroll.setVisible(false);
          }
          tableModel.fireTableDataChanged();
          lNoTasksFound.setVisible(!visible &&
@@ -876,14 +959,16 @@
  private void updateTableSizes()
  {
    Utilities.updateTableSizes(taskTable, 8);
    Utilities.updateTableSizes(taskTable, 5);
    Utilities.updateScrollMode(tableScroll, taskTable);
  }
  private void setAttributesToDisplay(LinkedHashSet<Message> attributes)
  {
    Set<String> selectedIds = getSelectedIds();
    tableModel.setAttributes(attributes);
    tableModel.forceDataStructureChange();
    setSelectedIds(selectedIds);
  }
  /**
@@ -895,7 +980,7 @@
    private static final long serialVersionUID = 5051878116443370L;
    /**
     * structor.
     * Constructor.
     * @param info the control panel info.
     */
    public ManageTasksMenuBar(ControlPanelInfo info)
@@ -925,7 +1010,7 @@
          INFO_CTRL_PANEL_CONNECTION_HANDLER_VIEW_MENU_DESCRIPTION.get());
      menu.setMnemonic(KeyEvent.VK_V);
      final JMenuItem viewOperations = Utilities.createMenuItem(
          INFO_CTRL_PANEL_OPERATIONS_VIEW.get());
          INFO_CTRL_PANEL_TASK_ATTRIBUTES_VIEW.get());
      menu.add(viewOperations);
      viewOperations.addActionListener(new ActionListener()
      {
@@ -937,4 +1022,32 @@
      return menu;
    }
  }
  private Set<String> getSelectedIds()
  {
    Set<String> selectedIds = new HashSet<String>();
    int[] indexes = taskTable.getSelectedRows();
    if (indexes != null)
    {
      for (int index : indexes)
      {
        TaskEntry taskEntry = tableModel.get(index);
        selectedIds.add(taskEntry.getId());
      }
    }
    return selectedIds;
  }
  private void setSelectedIds(Set<String> ids)
  {
    taskTable.getSelectionModel().clearSelection();
    for (int i=0; i<tableModel.getRowCount(); i++)
    {
      TaskEntry taskEntry = tableModel.get(i);
      if (ids.contains(taskEntry.getId()))
      {
        taskTable.getSelectionModel().addSelectionInterval(i, i);
      }
    }
  }
}
opends/src/guitools/org/opends/guitools/controlpanel/ui/SimplifiedViewEntryPanel.java
@@ -22,7 +22,7 @@
 * CDDL HEADER END
 *
 *
 *      Copyright 2008-2009 Sun Microsystems, Inc.
 *      Copyright 2008-2010 Sun Microsystems, Inc.
 */
package org.opends.guitools.controlpanel.ui;
@@ -126,8 +126,8 @@
  private TreePath treePath;
  private JScrollPane scrollAttributes;
  private LinkedHashMap<String, Set<EditorComponent>> hmEditors =
    new LinkedHashMap<String, Set<EditorComponent>>();
  private LinkedHashMap<String, List<EditorComponent>> hmEditors =
    new LinkedHashMap<String, List<EditorComponent>>();
  private Set<String> requiredAttrs = new HashSet<String>();
  private Map<String, JComponent> hmLabels = new HashMap<String, JComponent>();
@@ -469,7 +469,7 @@
      for (String attr : sortedAttributes)
      {
        JLabel label = getLabelForAttribute(attr, sr);
        Set<Object> values = sr.getAttributeValues(attr);
        List<Object> values = sr.getAttributeValues(attr);
        JComponent comp = getReadOnlyComponent(attr, values);
        gbc.weightx = 0.0;
        if (values.size() > 1)
@@ -500,10 +500,10 @@
          Utilities.setRequiredIcon(label);
          requiredAttrs.add(attr.toLowerCase());
        }
        Set<Object> values = sr.getAttributeValues(attr);
        List<Object> values = sr.getAttributeValues(attr);
        if (values.isEmpty())
        {
          values = new HashSet<Object>(1);
          values = new ArrayList<Object>(1);
          if (isBinary(attr))
          {
            values.add(new byte[]{});
@@ -704,7 +704,7 @@
            Utilities.getAttributeNameWithoutOptions(attr).toLowerCase());
    }
    Set<Object> values =
    List<Object> values =
      sr.getAttributeValues(ServerConstants.OBJECTCLASS_ATTRIBUTE_TYPE_NAME);
    // Put first the attributes associated with the objectclass in
@@ -778,7 +778,7 @@
      if (schema != null)
      {
        Set<Object> ocs = sr.getAttributeValues(
        List<Object> ocs = sr.getAttributeValues(
            ServerConstants.OBJECTCLASS_ATTRIBUTE_TYPE_NAME);
        for (Object o : ocs)
        {
@@ -882,7 +882,7 @@
  }
  private JComponent getReadOnlyComponent(final String attrName,
      Set<Object> values)
      List<Object> values)
  {
//  GridLayout is used to avoid the 512 limit of GridBagLayout
    JPanel panel = new JPanel(new GridBagLayout());
@@ -982,14 +982,14 @@
  }
  private JComponent getReadWriteComponent(final String attrName,
      Set<Object> values)
      List<Object> values)
  {
    JPanel panel = new JPanel(new GridBagLayout());
    panel.setOpaque(false);
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.gridy = 0;
    Set<EditorComponent> components = new LinkedHashSet<EditorComponent>();
    List<EditorComponent> components = new ArrayList<EditorComponent>();
    hmEditors.put(attrName.toLowerCase(), components);
    boolean isBinary = hasBinaryValue(values);
@@ -1273,7 +1273,7 @@
      AttributeType attr = schema.getAttributeType(attrName.toLowerCase());
      if (attr != null)
      {
        Set<Object> ocs = sr.getAttributeValues(
        List<Object> ocs = sr.getAttributeValues(
            ServerConstants.OBJECTCLASS_ATTRIBUTE_TYPE_NAME);
        for (Object o : ocs)
        {
@@ -1328,8 +1328,8 @@
    // Check passwords
    for (String attrName : lastUserPasswords.keySet())
    {
      Set<String> pwds = getNewPasswords(attrName);
      Set<String> confirmPwds = getConfirmPasswords(attrName);
      List<String> pwds = getNewPasswords(attrName);
      List<String> confirmPwds = getConfirmPasswords(attrName);
      if (!pwds.equals(confirmPwds))
      {
        setPrimaryInvalid(hmLabels.get(attrName));
@@ -1382,10 +1382,10 @@
    return entry;
  }
  private Set<String> getDisplayedStringValues(String attrName)
  private List<String> getDisplayedStringValues(String attrName)
  {
    Set<String> values = new LinkedHashSet<String>();
    Set<EditorComponent> comps =
    List<String> values = new ArrayList<String>();
    List<EditorComponent> comps =
      hmEditors.get(attrName.toLowerCase());
    if (comps != null)
    {
@@ -1417,14 +1417,14 @@
    return values;
  }
  private Set<String> getNewPasswords(String attrName)
  private List<String> getNewPasswords(String attrName)
  {
    String attr =
      Utilities.getAttributeNameWithoutOptions(attrName).toLowerCase();
    return getDisplayedStringValues(attr);
  }
  private Set<String> getConfirmPasswords(String attrName)
  private List<String> getConfirmPasswords(String attrName)
  {
    return getDisplayedStringValues(getConfirmPasswordKey(attrName));
  }
@@ -1458,10 +1458,10 @@
      }
      else if (isPassword(attrName))
      {
        Set<String> newPwds = getNewPasswords(attrName);
        List<String> newPwds = getNewPasswords(attrName);
        if (newPwds.equals(lastUserPasswords.get(attrName.toLowerCase())))
        {
          Set<Object> oldValues = searchResult.getAttributeValues(attrName);
          List<Object> oldValues = searchResult.getAttributeValues(attrName);
          if (!oldValues.isEmpty())
          {
            appendLDIFLines(sb, attrName, oldValues);
@@ -1482,7 +1482,7 @@
    // Add the attributes that are not displayed
    for (String attrName : schemaReadOnlyAttributesLowerCase)
    {
      Set<Object> values = searchResult.getAttributeValues(attrName);
      List<Object> values = searchResult.getAttributeValues(attrName);
      if (!values.isEmpty())
      {
        appendLDIFLines(sb, attrName, values);
@@ -1494,7 +1494,7 @@
  private boolean isAttrName(String attrName, CustomSearchResult sr)
  {
    boolean isAttrName = false;
    Set<Object> values =
    List<Object> values =
      sr.getAttributeValues(ServerConstants.OBJECTCLASS_ATTRIBUTE_TYPE_NAME);
    for (Object o : values)
    {
@@ -1510,7 +1510,7 @@
    return isAttrName;
  }
  private boolean hasBinaryValue(Set<Object> values)
  private boolean hasBinaryValue(List<Object> values)
  {
    boolean isBinary = false;
    if (values.size() > 0)
@@ -1548,10 +1548,10 @@
  /**
   * {@inheritDoc}
   */
  protected Set<Object> getValues(String attrName)
  protected List<Object> getValues(String attrName)
  {
    Set<Object> values = new LinkedHashSet<Object>();
    Set<EditorComponent> comps = hmEditors.get(attrName);
    List<Object> values = new ArrayList<Object>();
    List<EditorComponent> comps = hmEditors.get(attrName);
    if (comps.size() > 0)
    {
      for (EditorComponent comp : comps)
@@ -1578,7 +1578,7 @@
  private void appendLDIFLines(StringBuilder sb, String attrName)
  {
    Set<Object> values = getValues(attrName);
    List<Object> values = getValues(attrName);
    if (values.size() > 0)
    {
@@ -1608,7 +1608,7 @@
          String sValue = value.getValue().toString();
          Set<String> values = getDisplayedStringValues(attrName);
          List<String> values = getDisplayedStringValues(attrName);
          if (!values.contains(sValue))
          {
            if (values.size() > 0)
@@ -1654,7 +1654,7 @@
              {
                continue;
              }
              Set<EditorComponent> comps = hmEditors.get(attrName);
              List<EditorComponent> comps = hmEditors.get(attrName);
              if (comps.size() > 0)
              {
                Object o = comps.iterator().next().getValue();
@@ -1805,7 +1805,7 @@
    for (String attrName : schemaReadOnlyAttributesLowerCase)
    {
      Set<Object> values = searchResult.getAttributeValues(attrName);
      List<Object> values = searchResult.getAttributeValues(attrName);
      if (!values.isEmpty())
      {
        newResult.set(attrName, values);
@@ -1855,10 +1855,10 @@
        }
        if (isPassword(attrName))
        {
          Set<String> newPwds = getNewPasswords(attrName);
          List<String> newPwds = getNewPasswords(attrName);
          if (newPwds.equals(lastUserPasswords.get(attrName)))
          {
            Set<Object> oldValues = searchResult.getAttributeValues(attrName);
            List<Object> oldValues = searchResult.getAttributeValues(attrName);
            newResult.set(attrName, oldValues);
          }
          else
@@ -1893,7 +1893,7 @@
      }
      else
      {
        Set<EditorComponent> editors = hmEditors.get(attrName);
        List<EditorComponent> editors = hmEditors.get(attrName);
        boolean hasValue = false;
        for (EditorComponent editor : editors)
opends/src/guitools/org/opends/guitools/controlpanel/ui/TableViewEntryPanel.java
@@ -22,7 +22,7 @@
 * CDDL HEADER END
 *
 *
 *      Copyright 2008-2009 Sun Microsystems, Inc.
 *      Copyright 2008-2010 Sun Microsystems, Inc.
 */
package org.opends.guitools.controlpanel.ui;
@@ -433,7 +433,7 @@
  /**
   * {@inheritDoc}
   */
  protected Set<Object> getValues(String attrName)
  protected List<Object> getValues(String attrName)
  {
    return tableModel.getValues(attrName);
  }
@@ -691,9 +691,9 @@
    {
      allSortedValues.clear();
      requiredAttrs.clear();
      Set<String> addedAttrs = new HashSet<String>();
      List<String> addedAttrs = new ArrayList<String>();
      Schema schema = getInfo().getServerDescriptor().getSchema();
      Set<Object> ocs = null;
      List<Object> ocs = null;
      for (String attrName : searchResult.getAttributeNames())
      {
        if (attrName.equalsIgnoreCase(
@@ -798,22 +798,22 @@
    }
    /**
     * Returns the set of values associated with a given attribute.
     * Returns the list of values associated with a given attribute.
     * @param attrName the name of the attribute.
     * @return the set of values associated with a given attribute.
     * @return the list of values associated with a given attribute.
     */
    public Set<Object> getValues(String attrName)
    public List<Object> getValues(String attrName)
    {
      Set<Object> values = new LinkedHashSet<Object>();
      List<Object> values = new ArrayList<Object>();
      for (AttributeValuePair valuePair : dataArray)
      {
        if (valuePair.attrName.equalsIgnoreCase(attrName))
        {
          if (hasValue(valuePair))
          {
            if (valuePair.value instanceof Collection)
            if (valuePair.value instanceof Collection<?>)
            {
              for (Object o : (Collection)valuePair.value)
              for (Object o : (Collection<?>)valuePair.value)
              {
                values.add(o);
              }
@@ -836,7 +836,7 @@
      for (String attrName : schemaReadOnlyAttributesLowerCase)
      {
        Set<Object> values = searchResult.getAttributeValues(attrName);
        List<Object> values = searchResult.getAttributeValues(attrName);
        if (!values.isEmpty())
        {
          newResult.set(attrName, values);
opends/src/guitools/org/opends/guitools/controlpanel/ui/ViewEntryPanel.java
@@ -22,7 +22,7 @@
 * CDDL HEADER END
 *
 *
 *      Copyright 2008-2009 Sun Microsystems, Inc.
 *      Copyright 2008-2010 Sun Microsystems, Inc.
 */
package org.opends.guitools.controlpanel.ui;
@@ -257,7 +257,7 @@
      title.setIcon(null);
    }
    Set<Object> ocs =
    List<Object> ocs =
      sr.getAttributeValues(ServerConstants.OBJECTCLASS_ATTRIBUTE_TYPE_NAME);
    Schema schema = getInfo().getServerDescriptor().getSchema();
    if (!ocs.isEmpty() && (schema != null))
@@ -289,12 +289,12 @@
  /**
   * Returns an object class value representing all the object class values of
   * the entry.
   * @param ocValues the set of object class values.
   * @param ocValues the list of object class values.
   * @param schema the schema.
   * @return an object class value representing all the object class values of
   * the entry.
   */
  protected ObjectClassValue getObjectClassDescriptor(Set<Object> ocValues,
  protected ObjectClassValue getObjectClassDescriptor(List<Object> ocValues,
      Schema schema)
  {
    ObjectClass structuralObjectClass = null;
@@ -418,12 +418,12 @@
  /**
   * Appends the LDIF lines corresponding to the different values of an
   * attribute to the provided StringBuilder.
   * @param sb the StringBuilder that must be udpated.
   * @param sb the StringBuilder that must be updated.
   * @param attrName the attribute name.
   * @param values the attribute values.
   */
  protected void appendLDIFLines(StringBuilder sb, String attrName,
      Set<Object> values)
      List<Object> values)
  {
    for (Object value : values)
    {
@@ -434,7 +434,7 @@
  /**
   * Appends the LDIF line corresponding to the value of an
   * attribute to the provided StringBuilder.
   * @param sb the StringBuilder that must be udpated.
   * @param sb the StringBuilder that must be updated.
   * @param attrName the attribute name.
   * @param value the attribute value.
   */
@@ -558,7 +558,7 @@
   * @param attrName the attribute name.
   * @return the values associated with a given attribute.
   */
  protected abstract Set<Object> getValues(String attrName);
  protected abstract List<Object> getValues(String attrName);
  /**
   * Sets the values displayed in the panel for a given attribute in the
@@ -568,8 +568,8 @@
   */
  protected void setValues(CustomSearchResult sr, String attrName)
  {
    Set<Object> values = getValues(attrName);
    Set<Object> valuesToSet = new LinkedHashSet<Object>();
    List<Object> values = getValues(attrName);
    List<Object> valuesToSet = new ArrayList<Object>();
    for (Object value : values)
    {
      if (value instanceof ObjectClassValue)
opends/src/guitools/org/opends/guitools/controlpanel/util/ConfigFromDirContext.java
@@ -22,7 +22,7 @@
 * CDDL HEADER END
 *
 *
 *      Copyright 2008-2009 Sun Microsystems, Inc.
 *      Copyright 2008-2010 Sun Microsystems, Inc.
 */
package org.opends.guitools.controlpanel.util;
@@ -820,14 +820,15 @@
    {
      LdapName jndiName = new LdapName("cn=monitor");
      NamingEnumeration monitorEntries = ctx.search(jndiName, filter, ctls);
      NamingEnumeration<SearchResult> monitorEntries =
        ctx.search(jndiName, filter, ctls);
      javaVersion = null;
      numberConnections = -1;
      while (monitorEntries.hasMore())
      {
        SearchResult sr = (SearchResult)monitorEntries.next();
        SearchResult sr = monitorEntries.next();
        handleMonitoringSearchResult(sr, "cn=monitor");
      }
    }
@@ -854,11 +855,12 @@
    {
      LdapName jndiName = new LdapName(ConfigConstants.DN_TASK_ROOT);
      NamingEnumeration taskEntries = ctx.search(jndiName, filter, ctls);
      NamingEnumeration<SearchResult> taskEntries =
        ctx.search(jndiName, filter, ctls);
      while (taskEntries.hasMore())
      {
        SearchResult sr = (SearchResult)taskEntries.next();
        SearchResult sr = taskEntries.next();
        handleTaskSearchResult(sr, ConfigConstants.DN_TASK_ROOT, ts);
      }
    }
@@ -1022,7 +1024,7 @@
    DN parent = dn.getParent();
    if ((parent != null) && parent.equals(monitorDN))
    {
      Set vs = csr.getAttributeValues("cn");
      List<?> vs = csr.getAttributeValues("cn");
      if ((vs != null) && !vs.isEmpty())
      {
        String cn = (String)vs.iterator().next();
@@ -1039,7 +1041,7 @@
  private boolean isTaskEntry(CustomSearchResult csr) throws OpenDsException
  {
    boolean isTaskEntry = false;
    Set<Object> vs = csr.getAttributeValues("objectclass");
    List<Object> vs = csr.getAttributeValues("objectclass");
    if ((vs != null) && !vs.isEmpty())
    {
      for (Object oc : vs)
opends/src/guitools/org/opends/guitools/controlpanel/util/RemoteSchemaLoader.java
@@ -22,12 +22,13 @@
 * CDDL HEADER END
 *
 *
 *      Copyright 2009 Sun Microsystems, Inc.
 *      Copyright 2009-2010 Sun Microsystems, Inc.
 */
package org.opends.guitools.controlpanel.util;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import javax.naming.NamingEnumeration;
@@ -98,7 +99,7 @@
    schema = getBaseSchema();
    Set<Object> attrs =
    List<Object> attrs =
      csr.getAttributeValues(ConfigConstants.ATTR_ATTRIBUTE_TYPES_LC);
    Set<String> remainingAttrs = new HashSet<String>();
    for (Object o : attrs)
@@ -135,7 +136,7 @@
      remainingAttrs.removeAll(registeredAttrs);
    }
    Set<Object> objectClasses =
    List<Object> objectClasses =
      csr.getAttributeValues(ConfigConstants.ATTR_OBJECTCLASSES_LC);
    Set<String> remainingOcs = new HashSet<String>();
opends/src/guitools/org/opends/guitools/controlpanel/util/Utilities.java
@@ -49,7 +49,7 @@
import java.util.Collection;
import java.util.Date;
import java.util.Iterator;
import java.util.Set;
import java.util.List;
import javax.naming.CompositeName;
import javax.naming.InvalidNameException;
@@ -2496,7 +2496,7 @@
    Object o = null;
    if (sr != null)
    {
      Set<Object> values = sr.getAttributeValues(attrName);
      List<Object> values = sr.getAttributeValues(attrName);
      if ((values != null) && (values.size() > 0))
      {
        o = values.iterator().next();
opends/src/messages/messages/admin_tool.properties
@@ -20,7 +20,7 @@
#
# CDDL HEADER END
#
#      Copyright 2006-2009 Sun Microsystems, Inc.
#      Copyright 2006-2010 Sun Microsystems, Inc.
@@ -2928,7 +2928,8 @@
INFO_CTRL_PANEL_LAUNCH_LATER_SUMMARY=Launch on %s
INFO_CTRL_PANEL_LAUNCH_PERIODICALLY_SUMMARY=Launch periodically with CRON \
 schedule '%s'
INFO_CTRL_PANEL_TASK_LOG_LABEL=Task Log Message(s)
INFO_CTRL_PANEL_TASK_ATTRIBUTES_VIEW=Show Task Attributes...
MILD_ERR_CTRL_PANEL_LAUNCH_LATER_REQUIRES_SERVER_RUNNING=To be able to launch \
 tasks on a future date, the server must be running.
MILD_ERR_CTRL_PANEL_LAUNCH_SCHEDULE_REQUIRES_SERVER_RUNNING=To be able to \