From 2018a17d52e02359a5ee60e397831ffcde356139 Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Fri, 06 Jul 2007 11:52:45 +0000
Subject: [PATCH] Move the progress icon inside the panels instead of putting it in the lower left side of the dialog.  Do not display the progress icon when the user clicks on "Launch Status Panel" at the end of the setup but update the icon and put it in busy mode.

---
 opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/ui/QuickSetupStepPanel.java |   58 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 57 insertions(+), 1 deletions(-)

diff --git a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/ui/QuickSetupStepPanel.java b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/ui/QuickSetupStepPanel.java
index 90d4260..7c6475f 100644
--- a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/ui/QuickSetupStepPanel.java
+++ b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/ui/QuickSetupStepPanel.java
@@ -64,6 +64,7 @@
 {
   private Component inputPanel;
 
+  private JLabel checkingLabel;
   private HashSet<ButtonActionListener> buttonListeners =
     new HashSet<ButtonActionListener>();
 
@@ -232,6 +233,39 @@
   }
 
   /**
+   * This method sets up an icon on the bottom left side of the dialog.
+   * Generally this method is called with an animated gif that is passed to
+   * display progress.
+   * @param iconType the icon type to be set.
+   */
+  public void setIcon(UIFactory.IconType iconType)
+  {
+    checkingLabel.setIcon(UIFactory.getImageIcon(iconType));
+    checkingLabel.setText(getTextForIcon(iconType));
+  }
+
+  /**
+   * Returns the text to be displayed in the progress label for a give icon
+   * type.
+   * @param iconType the icon type.
+   * @return the text to be displayed in the progress label for a give icon
+   * type.
+   */
+  protected String getTextForIcon(UIFactory.IconType iconType)
+  {
+    String text;
+    if (iconType == UIFactory.IconType.WAIT)
+    {
+      text = getMsg("general-checking-data");
+    }
+    else
+    {
+      text = "";
+    }
+    return text;
+  }
+
+  /**
    * Notifies the button action listeners that an event occurred.
    * @param ev the button event to be notified.
    */
@@ -308,11 +342,23 @@
       gbc.insets.left = 0;
       add(inputPanel, gbc);
       somethingAdded = true;
-
     } else
     {
       addVerticalGlue(this);
     }
+
+    checkingLabel = UIFactory.makeJLabel(UIFactory.IconType.NO_ICON, "",
+        UIFactory.TextStyle.PROGRESS);
+    if (hasCheckingLabel())
+    {
+      gbc.insets.top = UIFactory.TOP_INSET_SECONDARY_FIELD;
+      gbc.insets.bottom = 0;
+      gbc.insets.left = 0;
+      gbc.weighty = 0.0;
+      gbc.anchor = GridBagConstraints.NORTHWEST;
+      gbc.fill = GridBagConstraints.HORIZONTAL;
+      add(checkingLabel, gbc);
+    }
   }
 
   /**
@@ -350,6 +396,15 @@
   }
 
   /**
+   * Tells whether we must add a label at the bottom left of the panel
+   * containing an icon that will show that we are doing some checkings.
+   * @return true if the checking label must be added and false otherwise.
+   */
+  protected boolean hasCheckingLabel()
+  {
+    return false;
+  }
+  /**
    * This method is called by the URLWorker when it has finished its task.
    * @param worker the URLWorker that finished its task.
    */
@@ -543,3 +598,4 @@
     worker.startBackgroundTask();
   }
 }
+

--
Gitblit v1.10.0