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

jvergara
27.44.2009 46fbb33b79245cabf8142609679c7ec6a01ee5c8
Fix for issue 4319 (control panel - adding entry from LDIF - should acknoldege validity of entry up check both if OK and NOT OK)
Display a label if the user checks for the syntax. This approach is used instead of a popup dialog, since it is less intrusive (in the case of an error being intrusive is required, but not if the provided data is correct).
2 files modified
66 ■■■■■ changed files
opends/src/guitools/org/opends/guitools/controlpanel/ui/NewEntryFromLDIFPanel.java 63 ●●●●● patch | view | raw | blame | history
opends/src/messages/messages/admin_tool.properties 3 ●●●●● patch | view | raw | blame | history
opends/src/guitools/org/opends/guitools/controlpanel/ui/NewEntryFromLDIFPanel.java
@@ -22,7 +22,7 @@
 * CDDL HEADER END
 *
 *
 *      Copyright 2008 Sun Microsystems, Inc.
 *      Copyright 2008-2009 Sun Microsystems, Inc.
 */
package org.opends.guitools.controlpanel.ui;
@@ -36,10 +36,13 @@
import java.io.IOException;
import java.util.ArrayList;
import javax.swing.Box;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import org.opends.guitools.controlpanel.browser.BrowserController;
import org.opends.guitools.controlpanel.ui.nodes.BasicNode;
@@ -56,6 +59,7 @@
  private static final long serialVersionUID = -3923907357481784964L;
  private JTextArea ldif;
  private JButton checkSyntax;
  private JLabel lSyntaxCorrect;
  /**
   * Default constructor.
@@ -138,10 +142,43 @@
    gbc.gridx = 0;
    gbc.insets.left = 0;
    gbc.weightx = 1.0;
    gbc.gridwidth = 3;
    JLabel label = Utilities.createDefaultLabel(
        INFO_CTRL_PANEL_LDIF_SYNTAX_LABEL.get());
    add(label, gbc);
    lSyntaxCorrect = Utilities.createDefaultLabel(
        INFO_CTRL_PANEL_SYNTAX_CORRECT_LABEL.get());
    lSyntaxCorrect.setIcon(Utilities.createImageIcon(
        "org/opends/quicksetup/images/info_small.gif"));
    ldif = Utilities.createTextArea(Message.EMPTY, 20, 50);
    ldif.getDocument().addDocumentListener(new DocumentListener()
    {
      /**
       * {@inheritDoc}
       */
      public void removeUpdate(DocumentEvent ev)
      {
        lSyntaxCorrect.setVisible(false);
      }
      /**
       * {@inheritDoc}
       */
      public void changedUpdate(DocumentEvent ev)
      {
        removeUpdate(ev);
      }
      /**
       * {@inheritDoc}
       */
      public void insertUpdate(DocumentEvent ev)
      {
       removeUpdate(ev);
      }
    });
    gbc.weightx = 1.0;
    gbc.weighty = 1.0;
    JScrollPane scroll = Utilities.createScrollPane(ldif);
@@ -168,17 +205,41 @@
        {
          displayErrorDialog(errors);
        }
        else
        {
          lSyntaxCorrect.setVisible(true);
        }
      }
    });
    gbc.gridy ++;
    gbc.gridwidth = 1;
    gbc.fill = GridBagConstraints.NONE;
    gbc.weightx = 0.0;
    gbc.anchor = GridBagConstraints.WEST;
    gbc.gridx = 0;
    add(lSyntaxCorrect, gbc);
    gbc.weightx = 1.0;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.gridx = 1;
    add(Box.createHorizontalGlue(), gbc);
    gbc.fill = GridBagConstraints.NONE;
    gbc.weightx = 0.0;
    gbc.anchor = GridBagConstraints.EAST;
    gbc.gridx = 2;
    add(checkSyntax, gbc);
  }
  /**
   * {@inheritDoc}
   */
  public void toBeDisplayed(boolean visible)
  {
    lSyntaxCorrect.setVisible(false);
  }
  /**
   * {@inheritDoc}
   */
  protected void checkSyntax(ArrayList<Message> errors)
  {
    try
opends/src/messages/messages/admin_tool.properties
@@ -2157,6 +2157,7 @@
INFO_CTRL_PANEL_NEW_ENTRY_FROM_LDIF_TITLE=New Entry from LDIF
INFO_CTRL_PANEL_LDIF_SYNTAX_LABEL=Enter LDIF syntax for the new entry:
INFO_CTRL_PANEL_CHECK_SYNTAX_BUTTON=Check Syntax
INFO_CTRL_PANEL_SYNTAX_CORRECT_LABEL=Entry syntax is correct
INFO_CTRL_PANEL_DUPLICATE_ENTRY_TITLE=Duplicate Entry
INFO_CTRL_PANEL_DUPLICATE_ENTRY_MENU=Duplicate Entry...
@@ -2736,6 +2737,8 @@
INFO_CTRL_PANEL_NOVEMBER=November
INFO_CTRL_PANEL_DECEMBER=December
INFO_CTRL_PANEL_TASK_TO_SCHEDULE_TIME=Time:
INFO_CTRL_PANEL_TASK_TO_SCHEDULE_TIME_TOOLTIP=Hour (from 00:00 to 23:59) in \
 the time zone of the server host.
INFO_CTRL_PANEL_TASK_TO_SCHEDULE_DAY=Day:
INFO_CTRL_PANEL_TASK_TO_SCHEDULE_MONTH=Month:
INFO_CTRL_PANEL_TASK_TO_SCHEDULE_YEAR=Year: