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 +++++++++++++++++++
 opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/ui/UIFactory.java                      |    2 
 opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/ui/CurrentStepPanel.java               |   16 +++++
 opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/ui/FramePanel.java                     |   24 -------
 opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/ui/QuickSetup.java                     |    8 ++
 opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/ui/DataReplicationPanel.java |   27 +++++++++
 opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/resources/Resources.properties         |    3 
 opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/ui/QuickSetupDialog.java               |    5 -
 8 files changed, 111 insertions(+), 32 deletions(-)

diff --git a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/ui/DataReplicationPanel.java b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/ui/DataReplicationPanel.java
index c441344..c2b2394 100644
--- a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/ui/DataReplicationPanel.java
+++ b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/ui/DataReplicationPanel.java
@@ -299,6 +299,33 @@
   }
 
   /**
+   * {@inheritDoc}
+   */
+  protected String getTextForIcon(UIFactory.IconType iconType)
+  {
+    String text;
+    if ((iconType == UIFactory.IconType.WAIT) &&
+        rbReplicated.isSelected() && cbTopologyExists.isSelected())
+    {
+      text = getMsg("contacting-server-label");
+    }
+    else
+    {
+      text = super.getTextForIcon(iconType);
+    }
+    return text;
+  }
+
+
+  /**
+   * {@inheritDoc}
+   */
+  protected boolean hasCheckingLabel()
+  {
+    return true;
+  }
+
+  /**
    * Returns the default value for the provided field Name.
    * @param fieldName the field name for which we want to get the default
    * value.
diff --git a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/resources/Resources.properties b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/resources/Resources.properties
index 06a7588..23444ca 100644
--- a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/resources/Resources.properties
+++ b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/resources/Resources.properties
@@ -544,7 +544,7 @@
 topology-exists-label=There is already a server in the topology
 topology-exists-tooltip=Check this if you already created a server that you \
 want to replicate data with.
-
+contacting-server-label=Contacting server...
 
 #
 # The accept certificate dialog.
@@ -1270,6 +1270,7 @@
 installandupgrader-rbupgrade-tooltip=Select to upgrade an existing server \
 instance.
 
+general-checking-data=Checking Data...
 general-loading=Loading...
 general-see-for-details=See {0} for a detailed log of this operation.
 not-available-label=<not available>
diff --git a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/ui/CurrentStepPanel.java b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/ui/CurrentStepPanel.java
index 3f0b88e..cc01adb 100644
--- a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/ui/CurrentStepPanel.java
+++ b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/ui/CurrentStepPanel.java
@@ -225,7 +225,7 @@
   /**
    * Forwards the different panels the ProgressDescriptor so that they
    * can update their contents accordingly.
-   * @param descriptor the descriptor of the Uninstallation progress.
+   * @param descriptor the descriptor of the Application progress.
    */
   public void displayProgress(ProgressDescriptor descriptor)
   {
@@ -236,6 +236,20 @@
   }
 
   /**
+   * 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)
+  {
+    for (WizardStep s : hmPanels.keySet())
+    {
+      getPanel(s).setIcon(iconType);
+    }
+  }
+
+  /**
    * Retrieves the panel for the provided step.
    * @param step the step for which we want to get the panel.
    * @return the panel for the provided step.
diff --git a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/ui/FramePanel.java b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/ui/FramePanel.java
index 8332407..0aa26cd 100644
--- a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/ui/FramePanel.java
+++ b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/ui/FramePanel.java
@@ -35,8 +35,8 @@
 import java.awt.GridBagConstraints;
 import java.awt.GridBagLayout;
 
+import javax.swing.Box;
 import javax.swing.Icon;
-import javax.swing.JLabel;
 import javax.swing.JPanel;
 
 /**
@@ -63,9 +63,6 @@
   private int buttonsPanelVerticalInsets;
 
   private int stepsPanelHorizontalInsets;
-
-  private JLabel progressLabel;
-
   /**
    * The constructor of the FramePanel.
    * @param stepsPanel the steps panel that on the top-left side of the
@@ -110,17 +107,11 @@
     gbc.insets = UIFactory.getEmptyInsets();
     add(currentPanelContainer, gbc);
 
-    progressLabel = UIFactory.makeJLabel(UIFactory.IconType.NO_ICON, null,
-        UIFactory.TextStyle.READ_ONLY);
-    gbc.weighty = 0.0;
-    gbc.insets.left = UIFactory.getStepsPanelInsets().left;
-    gbc.insets.bottom = UIFactory.getButtonsPanelInsets().bottom;
-    add(progressLabel, gbc);
     gbc.gridwidth = GridBagConstraints.RELATIVE;
     gbc.anchor = GridBagConstraints.WEST;
     gbc.weightx = 0.0;
     gbc.weighty = 0.0;
-    add(progressLabel, gbc);
+    add(Box.createHorizontalGlue(), gbc);
 
     gbc.gridwidth = GridBagConstraints.REMAINDER;
     gbc.weightx = 1.0;
@@ -151,17 +142,6 @@
   }
 
   /**
-   * 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 setProgressIcon(UIFactory.IconType iconType)
-  {
-    progressLabel.setIcon(UIFactory.getImageIcon(iconType));
-  }
-
-  /**
    * {@inheritDoc}
    *
    * This method has been overwritten to be able to have a transparency effect
diff --git a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/ui/QuickSetup.java b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/ui/QuickSetup.java
index 35da1ee..19d7b75 100644
--- a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/ui/QuickSetup.java
+++ b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/ui/QuickSetup.java
@@ -39,6 +39,8 @@
 import org.opends.quicksetup.util.Utils;
 
 import javax.swing.*;
+
+import java.awt.Cursor;
 import java.util.logging.Logger;
 import java.util.logging.Level;
 import java.util.logging.Handler;
@@ -428,7 +430,8 @@
       public void backgroundTaskCompleted(Object returnValue,
           Throwable throwable)
       {
-        getDialog().workerFinished();
+        getDialog().getFrame().setCursor(
+            Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
 
         if (throwable != null)
         {
@@ -436,7 +439,8 @@
         }
       }
     };
-    getDialog().workerStarted();
+    getDialog().getFrame().setCursor(
+        Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
     worker.startBackgroundTask();
   }
 
diff --git a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/ui/QuickSetupDialog.java b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/ui/QuickSetupDialog.java
index 346f06d..4d3ab63 100644
--- a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/ui/QuickSetupDialog.java
+++ b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/ui/QuickSetupDialog.java
@@ -538,10 +538,7 @@
 
   private void displayWorkingProgressImage(boolean display)
   {
-    if (getFramePanel() instanceof FramePanel)
-    {
-      ((FramePanel)getFramePanel()).setProgressIcon(display ?
+    getCurrentStepPanel().setIcon(display ?
           UIFactory.IconType.WAIT : UIFactory.IconType.NO_ICON);
-    }
   }
 }
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();
   }
 }
+
diff --git a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/ui/UIFactory.java b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/ui/UIFactory.java
index 0ca9125..9ef24f7 100644
--- a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/ui/UIFactory.java
+++ b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/ui/UIFactory.java
@@ -89,7 +89,7 @@
   /**
    * Specifies the extra left inset for the sub-steps.
    */
-  public static final int LEFT_INSET_SUBSTEP = 10;
+  public static final int LEFT_INSET_SUBSTEP = 20;
   /**
    * Specifies the top inset for the instructions sub panel.
    */

--
Gitblit v1.10.0