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

Jean-Noël Rouvignac
20.36.2016 2a3158aad80fc910b83336485b3e545dea50066c
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/ProgressDialog.java
@@ -12,7 +12,7 @@
 * information: "Portions Copyright [year] [name of copyright owner]".
 *
 * Copyright 2008-2010 Sun Microsystems, Inc.
 * Portions Copyright 2015 ForgeRock AS.
 * Portions Copyright 2015-2016 ForgeRock AS.
 */
package org.opends.guitools.controlpanel.ui;
@@ -48,9 +48,7 @@
import org.opends.guitools.controlpanel.util.Utilities;
import org.forgerock.i18n.LocalizableMessage;
/**
 * The dialog that is used to display progress in a task.
 */
/** The dialog that is used to display progress in a task. */
public class ProgressDialog extends GenericDialog
{
  private static final long serialVersionUID = -6462866257463062629L;
@@ -96,11 +94,12 @@
  {
    errorPrintStream.addListener(new PrintStreamListener()
    {
      @Override
      public void newLine(final String msg)
      {
        SwingUtilities.invokeLater(new Runnable()
        {
          /** {@inheritDoc} */
          @Override
          public void run()
          {
            progressPanel.appendErrorLine(msg);
@@ -110,11 +109,12 @@
    });
    outPrintStream.addListener(new PrintStreamListener()
    {
      @Override
      public void newLine(final String msg)
      {
        /** {@inheritDoc} */
        SwingUtilities.invokeLater(new Runnable()
        {
          @Override
          public void run()
          {
            progressPanel.appendOutputLine(msg);
@@ -142,10 +142,7 @@
    progressPanel.appendHtml(text);
  }
  /**
   * Resets the contents of the 'Details' section of the dialog.
   *
   */
  /** Resets the contents of the 'Details' section of the dialog. */
  public void resetProgressLogs()
  {
    progressPanel.resetLogs();
@@ -161,7 +158,7 @@
    progressPanel.setSummary(text);
  }
  /** {@inheritDoc} */
  @Override
  public void setEnabledClose(boolean enable)
  {
    progressPanel.closeButton.setEnabled(enable);
@@ -179,10 +176,7 @@
    progressPanel.closeWhenOverClicked();
  }
  /**
   * The panel contained in the progress dialog.
   *
   */
  /** The panel contained in the progress dialog. */
  static class ProgressPanel extends StatusGenericPanel
  {
    private static final long serialVersionUID = -364496083928260306L;
@@ -209,35 +203,32 @@
    private boolean taskIsOver;
    /**
     * Default constructor.
     *
     */
    /** Default constructor. */
    public ProgressPanel()
    {
      super();
      createLayout();
    }
    /** {@inheritDoc} */
    @Override
    public LocalizableMessage getTitle()
    {
      return null;
    }
    /** {@inheritDoc} */
    @Override
    public boolean requiresScroll()
    {
      return false;
    }
    /** {@inheritDoc} */
    @Override
    public boolean requiresBorder()
    {
      return false;
    }
    /** {@inheritDoc} */
    @Override
    public boolean isDisposeOnClose()
    {
      return true;
@@ -316,20 +307,13 @@
      }
    }
    /**
     * Resets the contents of the logs (Details) section.
     *
     */
    /** Resets the contents of the logs (Details) section. */
    public void resetLogs()
    {
      logs.setText(INIT_TEXT);
    }
    /**
     * Creates the layout of the panel (but the contents are not populated
     * here).
     *
     */
    /** Creates the layout of the panel (but the contents are not populated here). */
    private void createLayout()
    {
      GridBagConstraints gbc = new GridBagConstraints();
@@ -389,7 +373,7 @@
      updateVisibility(lastShowDetails);
      details.addActionListener(new ActionListener()
      {
        /** {@inheritDoc} */
        @Override
        public void actionPerformed(ActionEvent ev)
        {
          lastShowDetails = details.isSelected();
@@ -419,7 +403,7 @@
      closeWhenOver.setOpaque(false);
      closeWhenOver.addActionListener(new ActionListener()
      {
        /** {@inheritDoc} */
        @Override
        public void actionPerformed(ActionEvent ev)
        {
          closeWhenOverClicked();
@@ -446,7 +430,7 @@
      buttonsPanel.add(closeButton, gbc);
      closeButton.addActionListener(new ActionListener()
      {
        /** {@inheritDoc} */
        @Override
        public void actionPerformed(ActionEvent ev)
        {
          closeClicked();
@@ -470,6 +454,7 @@
      {
        final Runnable repaint = new Runnable()
        {
          @Override
          public void run()
          {
            invalidate();
@@ -508,24 +493,24 @@
      }
    }
    /** {@inheritDoc} */
    @Override
    public GenericDialog.ButtonType getButtonType()
    {
      return GenericDialog.ButtonType.NO_BUTTON;
    }
    /** {@inheritDoc} */
    @Override
    public void configurationChanged(ConfigurationChangeEvent ev)
    {
    }
    /** {@inheritDoc} */
    @Override
    public Component getPreferredFocusComponent()
    {
      return details;
    }
    /** {@inheritDoc} */
    @Override
    public void okClicked()
    {
      Utilities.getParentDialog(this).setVisible(false);
@@ -544,7 +529,6 @@
     * Checks if the 'Close when over' check box is selected and if it is the
     * case, closes the dialog after waiting for 2 seconds (so that the user
     * can see the result, or cancel the automatic closing of the dialog).
     *
     */
    private void closeWhenOverClicked()
    {
@@ -553,7 +537,7 @@
      {
        Thread t = new Thread(new Runnable()
        {
          /** {@inheritDoc} */
          @Override
          public void run()
          {
            try
@@ -561,6 +545,7 @@
              Thread.sleep(2000);
              SwingUtilities.invokeLater(new Runnable()
              {
                @Override
                public void run()
                {
                  if (closeWhenOver.isSelected() && taskIsOver)