From d33116e2529f45737e467e74ed0899c22d371c80 Mon Sep 17 00:00:00 2001
From: kenneth_suter <kenneth_suter@localhost>
Date: Thu, 12 Jul 2007 15:47:29 +0000
Subject: [PATCH] moved UI specific utilties to UI specific utility class

---
 opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/ui/Utilities.java                            |  207 +++++++++++++++++++++++++
 opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/ui/WebBrowserErrorDialog.java                |    3 
 opendj-sdk/opends/src/statuspanel/org/opends/statuspanel/ui/StatusPanelDialog.java                  |    2 
 opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/SplashScreen.java                            |    4 
 opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/util/Utils.java                              |  213 --------------------------
 opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/ui/QuickSetupDialog.java                     |    9 
 opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/ui/WebProxyDialog.java                       |    3 
 opendj-sdk/opends/src/statuspanel/org/opends/statuspanel/StatusPanelController.java                 |   16 +
 opendj-sdk/opends/src/statuspanel/org/opends/statuspanel/ui/LoginDialog.java                        |    5 
 opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/ui/SecurityOptionsDialog.java      |    5 
 opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/ui/DirectoryManagerAuthenticationDialog.java |    6 
 opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/ui/SelectAliasDialog.java          |    4 
 opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/ui/CertificateDialog.java                    |    3 
 13 files changed, 238 insertions(+), 242 deletions(-)

diff --git a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/SplashScreen.java b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/SplashScreen.java
index 35b8260..ac0eaf8 100644
--- a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/SplashScreen.java
+++ b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/SplashScreen.java
@@ -38,7 +38,7 @@
 import javax.swing.SwingUtilities;
 
 import org.opends.quicksetup.i18n.ResourceProvider;
-import org.opends.quicksetup.util.Utils;
+import org.opends.quicksetup.ui.Utilities;
 
 /**
  * This is the class that displays a splash screen and in the background it will
@@ -112,7 +112,7 @@
       int height = image.getHeight(this);
       setPreferredSize(new Dimension(width, height));
       setSize(width, height);
-      Utils.centerOnScreen(this);
+      Utilities.centerOnScreen(this);
 
     } catch (Exception ex)
     {
diff --git a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/ui/SecurityOptionsDialog.java b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/ui/SecurityOptionsDialog.java
index 0101bc4..8977196 100644
--- a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/ui/SecurityOptionsDialog.java
+++ b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/ui/SecurityOptionsDialog.java
@@ -60,6 +60,7 @@
 import org.opends.quicksetup.i18n.ResourceProvider;
 import org.opends.quicksetup.installer.Installer;
 import org.opends.quicksetup.ui.UIFactory;
+import org.opends.quicksetup.ui.Utilities;
 import org.opends.quicksetup.util.BackgroundTask;
 import org.opends.quicksetup.util.Utils;
 import org.opends.server.util.CertificateManager;
@@ -133,7 +134,7 @@
     });
     setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
 
-    Utils.centerOnComponent(this, parent);
+    Utilities.centerOnComponent(this, parent);
   }
 
   /**
@@ -735,7 +736,7 @@
    */
   private void displayError(String msg, String title)
   {
-    Utils.displayError(this, msg, title);
+    Utilities.displayError(this, msg, title);
     toFront();
   }
 
diff --git a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/ui/SelectAliasDialog.java b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/ui/SelectAliasDialog.java
index 2499687..0075beb 100644
--- a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/ui/SelectAliasDialog.java
+++ b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/ui/SelectAliasDialog.java
@@ -47,7 +47,7 @@
 import org.opends.quicksetup.event.MinimumSizeComponentListener;
 import org.opends.quicksetup.i18n.ResourceProvider;
 import org.opends.quicksetup.ui.UIFactory;
-import org.opends.quicksetup.util.Utils;
+import org.opends.quicksetup.ui.Utilities;
 
 /**
  * This class is a dialog that appears when the user must choose the alias to
@@ -86,7 +86,7 @@
     });
     setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
 
-    Utils.centerOnComponent(this, parent);
+    Utilities.centerOnComponent(this, parent);
     setModal(true);
   }
 
diff --git a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/ui/CertificateDialog.java b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/ui/CertificateDialog.java
index 6475f9e..513869d 100644
--- a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/ui/CertificateDialog.java
+++ b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/ui/CertificateDialog.java
@@ -63,7 +63,6 @@
 import org.opends.quicksetup.UserDataCertificateException;
 import org.opends.quicksetup.event.MinimumSizeComponentListener;
 import org.opends.quicksetup.i18n.ResourceProvider;
-import org.opends.quicksetup.util.Utils;
 
 /**
  * This class is used to present the user a certificate to the user in order
@@ -121,7 +120,7 @@
     });
     setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
 
-    Utils.centerOnComponent(this, parent);
+    Utilities.centerOnComponent(this, parent);
   }
 
   /**
diff --git a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/ui/DirectoryManagerAuthenticationDialog.java b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/ui/DirectoryManagerAuthenticationDialog.java
index 7922a3b..7028453 100644
--- a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/ui/DirectoryManagerAuthenticationDialog.java
+++ b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/ui/DirectoryManagerAuthenticationDialog.java
@@ -124,7 +124,7 @@
         500, 300));
     getRootPane().setDefaultButton(shutDownButton);
     pack();
-    Utils.centerOnComponent(this, parent);
+    Utilities.centerOnComponent(this, parent);
     tfPwd.requestFocusInWindow();
     setVisible(true);
   }
@@ -509,7 +509,7 @@
    */
   private void displayError(String msg, String title)
   {
-    Utils.displayError(parent, msg, title);
+    Utilities.displayError(parent, msg, title);
   }
 
   /**
@@ -522,7 +522,7 @@
    */
   private void displayInformationMessage(String msg, String title)
   {
-    Utils.displayInformationMessage(parent, msg, title);
+    Utilities.displayInformationMessage(parent, msg, title);
   }
 
   /**
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 4d3ab63..ae3285b 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
@@ -46,7 +46,6 @@
 import org.opends.quicksetup.event.MinimumSizeComponentListener;
 import org.opends.quicksetup.ProgressDescriptor;
 import org.opends.quicksetup.util.ProgressMessageFormatter;
-import org.opends.quicksetup.util.Utils;
 
 /**
  * This class represents the dialog used by quicksetup applications.
@@ -125,7 +124,7 @@
     frame.pack();
     int minWidth = (int) frame.getPreferredSize().getWidth();
     int minHeight = (int) frame.getPreferredSize().getHeight();
-    Utils.centerOnScreen(frame);
+    Utilities.centerOnScreen(frame);
     setFocusOnButton(application.getInitialFocusButtonName());
     frame.addComponentListener(new MinimumSizeComponentListener(frame,
         minWidth, minHeight));
@@ -146,7 +145,7 @@
     frame.getContentPane().removeAll();
     frame.getContentPane().add(getFramePanel());
     frame.pack();
-    Utils.centerOnScreen(frame);
+    Utilities.centerOnScreen(frame);
     setFocusOnButton(ButtonName.NEXT);
     int minWidth = (int) frame.getPreferredSize().getWidth();
     int minHeight = (int) frame.getPreferredSize().getHeight();
@@ -210,7 +209,7 @@
    */
   public void displayError(String msg, String title)
   {
-    Utils.displayError(getFrame(), msg, title);
+    Utilities.displayError(getFrame(), msg, title);
   }
 
   /**
@@ -225,7 +224,7 @@
    */
   public boolean displayConfirmation(String msg, String title)
   {
-    return Utils.displayConfirmation(getFrame(), msg, title);
+    return Utilities.displayConfirmation(getFrame(), msg, title);
   }
 
   /**
diff --git a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/ui/Utilities.java b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/ui/Utilities.java
index c3aa9af..954f9a5 100644
--- a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/ui/Utilities.java
+++ b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/ui/Utilities.java
@@ -32,6 +32,7 @@
 import javax.swing.*;
 import javax.swing.text.JTextComponent;
 import java.awt.*;
+import java.util.StringTokenizer;
 
 /**
  * A set of utilities specific to GUI QuickSetup applications.
@@ -92,4 +93,210 @@
     frame.setIconImage(UIFactory.getImageIcon(ic).getImage());
   }
 
+  /**
+   * Center the component location based on its preferred size. The code
+   * considers the particular case of 2 screens and puts the component on the
+   * center of the left screen
+   *
+   * @param comp the component to be centered.
+   */
+  public static void centerOnScreen(Component comp)
+  {
+    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
+
+    int width = (int) comp.getPreferredSize().getWidth();
+    int height = (int) comp.getPreferredSize().getHeight();
+
+    boolean multipleScreen = screenSize.width / screenSize.height >= 2;
+
+    if (multipleScreen)
+    {
+      comp.setLocation((screenSize.width / 4) - (width / 2),
+          (screenSize.height - height) / 2);
+    } else
+    {
+      comp.setLocation((screenSize.width - width) / 2,
+          (screenSize.height - height) / 2);
+    }
+  }
+
+  /**
+   * Center the component location of the ref component.
+   *
+   * @param comp the component to be centered.
+   * @param ref the component to be used as reference.
+   *
+   */
+  public static void centerOnComponent(Window comp, Component ref)
+  {
+    comp.setLocationRelativeTo(ref);
+  }
+
+  /**
+   * Displays a confirmation message dialog.
+  *
+  * @param parent
+   *          the parent frame of the confirmation dialog.
+   * @param msg
+  *          the confirmation message.
+  * @param title
+  *          the title of the dialog.
+  * @return <CODE>true</CODE> if the user confirms the message, or
+  * <CODE>false</CODE> if not.
+  */
+ public static boolean displayConfirmation(JFrame parent, String msg,
+     String title)
+ {
+   return JOptionPane.YES_OPTION == JOptionPane.showOptionDialog(
+       parent, wrapMsg(msg, 100), title, JOptionPane.YES_NO_OPTION,
+       JOptionPane.QUESTION_MESSAGE, null, // don't use a custom
+       // Icon
+       null, // the titles of buttons
+       null); // default button title
+ }
+
+  /**
+   * Displays an error message dialog.
+   *
+   * @param parent
+   *          the parent component of the error dialog.
+   * @param msg
+   *          the error message.
+   * @param title
+   *          the title for the dialog.
+   */
+  public static void displayError(Component parent, String msg, String title)
+  {
+    JOptionPane.showMessageDialog(parent, wrapMsg(msg, 100), title,
+        JOptionPane.ERROR_MESSAGE);
+  }
+
+  /**
+   * Displays an information message dialog.
+   *
+   * @param parent
+   *          the parent frame of the information dialog.
+   * @param msg
+   *          the error message.
+   * @param title
+   *          the title for the dialog.
+   */
+  public static void displayInformationMessage(JFrame parent, String msg,
+      String title)
+  {
+    JOptionPane.showMessageDialog(parent, wrapMsg(msg, 100), title,
+        JOptionPane.INFORMATION_MESSAGE);
+  }
+
+  /**
+   * Private method used to wrap the messages that are displayed in dialogs
+   * of type JOptionPane.
+   * @param msg the message.
+   * @param width the maximum width of the column.
+   * @return the wrapped message.
+   */
+  public static String wrapMsg(String msg, int width)
+  {
+    StringBuilder   buffer        = new StringBuilder();
+    StringTokenizer lineTokenizer = new StringTokenizer(msg, "\n", true);
+    while (lineTokenizer.hasMoreTokens())
+    {
+      String line = lineTokenizer.nextToken();
+      if (line.equals("\n"))
+      {
+        // It's an end-of-line character, so append it as-is.
+        buffer.append(line);
+      }
+      else if (line.length() < width)
+      {
+        // The line fits in the specified width, so append it as-is.
+        buffer.append(line);
+      }
+      else
+      {
+        // The line doesn't fit in the specified width, so it needs to be
+        // wrapped.  Do so at space boundaries.
+        StringBuilder   lineBuffer    = new StringBuilder();
+        StringBuilder   delimBuffer   = new StringBuilder();
+        StringTokenizer wordTokenizer = new StringTokenizer(line, " ", true);
+        while (wordTokenizer.hasMoreTokens())
+        {
+          String word = wordTokenizer.nextToken();
+          if (word.equals(" "))
+          {
+            // It's a space, so add it to the delim buffer only if the line
+            // buffer is not empty.
+            if (lineBuffer.length() > 0)
+            {
+              delimBuffer.append(word);
+            }
+          }
+          else if (word.length() > width)
+          {
+            // This is a long word that can't be wrapped, so we'll just have to
+            // make do.
+            if (lineBuffer.length() > 0)
+            {
+              buffer.append(lineBuffer);
+              buffer.append("\n");
+              lineBuffer = new StringBuilder();
+            }
+            buffer.append(word);
+
+            if (wordTokenizer.hasMoreTokens())
+            {
+              // The next token must be a space, so remove it.  If there are
+              // still more tokens after that, then append an EOL.
+              wordTokenizer.nextToken();
+              if (wordTokenizer.hasMoreTokens())
+              {
+                buffer.append("\n");
+              }
+            }
+
+            if (delimBuffer.length() > 0)
+            {
+              delimBuffer = new StringBuilder();
+            }
+          }
+          else
+          {
+            // It's not a space, so see if we can fit it on the current line.
+            int newLineLength = lineBuffer.length() + delimBuffer.length() +
+            word.length();
+            if (newLineLength < width)
+            {
+              // It does fit on the line, so add it.
+              lineBuffer.append(delimBuffer).append(word);
+
+              if (delimBuffer.length() > 0)
+              {
+                delimBuffer = new StringBuilder();
+              }
+            }
+            else
+            {
+              // It doesn't fit on the line, so end the current line and start
+              // a new one.
+              buffer.append(lineBuffer);
+              buffer.append("\n");
+
+              lineBuffer = new StringBuilder();
+              lineBuffer.append(word);
+
+              if (delimBuffer.length() > 0)
+              {
+                delimBuffer = new StringBuilder();
+              }
+            }
+          }
+        }
+
+        // If there's anything left in the line buffer, then add it to the
+        // final buffer.
+        buffer.append(lineBuffer);
+      }
+    }
+    return buffer.toString();
+  }
 }
diff --git a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/ui/WebBrowserErrorDialog.java b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/ui/WebBrowserErrorDialog.java
index ef78ce4..cf16de6 100644
--- a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/ui/WebBrowserErrorDialog.java
+++ b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/ui/WebBrowserErrorDialog.java
@@ -43,7 +43,6 @@
 
 import org.opends.quicksetup.event.MinimumSizeComponentListener;
 import org.opends.quicksetup.i18n.ResourceProvider;
-import org.opends.quicksetup.util.Utils;
 import org.opends.quicksetup.util.WebBrowserException;
 
 /**
@@ -89,7 +88,7 @@
     int minHeight = (int) getPreferredSize().getHeight();
     addComponentListener(new MinimumSizeComponentListener(this,
         minWidth, minHeight));
-    Utils.centerOnComponent(this, parent);
+    Utilities.centerOnComponent(this, parent);
     setVisible(true);
   }
 
diff --git a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/ui/WebProxyDialog.java b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/ui/WebProxyDialog.java
index e9636e4..bbb246d 100644
--- a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/ui/WebProxyDialog.java
+++ b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/ui/WebProxyDialog.java
@@ -27,7 +27,6 @@
 
 package org.opends.quicksetup.ui;
 
-import org.opends.quicksetup.util.Utils;
 import org.opends.quicksetup.i18n.ResourceProvider;
 
 import javax.swing.*;
@@ -118,7 +117,7 @@
         tfHost.requestFocusInWindow();
       }
     });
-    Utils.centerOnComponent(this, getParent());
+    Utilities.centerOnComponent(this, getParent());
     pack();
   }
 
diff --git a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/util/Utils.java b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/util/Utils.java
index 85fab21..913958f 100644
--- a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/util/Utils.java
+++ b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/util/Utils.java
@@ -26,10 +26,6 @@
  */
 package org.opends.quicksetup.util;
 
-import java.awt.Component;
-import java.awt.Dimension;
-import java.awt.Toolkit;
-import java.awt.Window;
 import java.io.BufferedOutputStream;
 import java.io.File;
 import java.io.FileOutputStream;
@@ -50,8 +46,6 @@
 import javax.net.ssl.HostnameVerifier;
 import javax.net.ssl.SSLHandshakeException;
 import javax.net.ssl.TrustManager;
-import javax.swing.JFrame;
-import javax.swing.JOptionPane;
 
 import org.opends.admin.ads.util.ConnectionUtils;
 import org.opends.quicksetup.*;
@@ -78,45 +72,6 @@
   }
 
   /**
-   * Center the component location based on its preferred size. The code
-   * considers the particular case of 2 screens and puts the component on the
-   * center of the left screen
-   *
-   * @param comp the component to be centered.
-   */
-  public static void centerOnScreen(Component comp)
-  {
-    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
-
-    int width = (int) comp.getPreferredSize().getWidth();
-    int height = (int) comp.getPreferredSize().getHeight();
-
-    boolean multipleScreen = screenSize.width / screenSize.height >= 2;
-
-    if (multipleScreen)
-    {
-      comp.setLocation((screenSize.width / 4) - (width / 2),
-          (screenSize.height - height) / 2);
-    } else
-    {
-      comp.setLocation((screenSize.width - width) / 2,
-          (screenSize.height - height) / 2);
-    }
-  }
-
-  /**
-   * Center the component location of the ref component.
-   *
-   * @param comp the component to be centered.
-   * @param ref the component to be used as reference.
-   *
-   */
-  public static void centerOnComponent(Window comp, Component ref)
-  {
-    comp.setLocationRelativeTo(ref);
-  }
-
-  /**
    * Returns <CODE>true</CODE> if the provided port is free and we can use it,
    * <CODE>false</CODE> otherwise.
    * @param port the port we are analyzing.
@@ -1009,62 +964,6 @@
   }
 
   /**
-   * Displays a confirmation message dialog.
-  *
-  * @param parent
-   *          the parent frame of the confirmation dialog.
-   * @param msg
-  *          the confirmation message.
-  * @param title
-  *          the title of the dialog.
-  * @return <CODE>true</CODE> if the user confirms the message, or
-  * <CODE>false</CODE> if not.
-  */
- public static boolean displayConfirmation(JFrame parent, String msg,
-     String title)
- {
-   return JOptionPane.YES_OPTION == JOptionPane.showOptionDialog(
-       parent, wrapMsg(msg, 100), title, JOptionPane.YES_NO_OPTION,
-       JOptionPane.QUESTION_MESSAGE, null, // don't use a custom
-       // Icon
-       null, // the titles of buttons
-       null); // default button title
- }
-
-  /**
-   * Displays an error message dialog.
-   *
-   * @param parent
-   *          the parent component of the error dialog.
-   * @param msg
-   *          the error message.
-   * @param title
-   *          the title for the dialog.
-   */
-  public static void displayError(Component parent, String msg, String title)
-  {
-    JOptionPane.showMessageDialog(parent, wrapMsg(msg, 100), title,
-        JOptionPane.ERROR_MESSAGE);
-  }
-
-  /**
-   * Displays an information message dialog.
-   *
-   * @param parent
-   *          the parent frame of the information dialog.
-   * @param msg
-   *          the error message.
-   * @param title
-   *          the title for the dialog.
-   */
-  public static void displayInformationMessage(JFrame parent, String msg,
-      String title)
-  {
-    JOptionPane.showMessageDialog(parent, wrapMsg(msg, 100), title,
-        JOptionPane.INFORMATION_MESSAGE);
-  }
-
-  /**
 
    * Returns the max size in character of a line to be displayed in the command
    * line.
@@ -1294,118 +1193,6 @@
   }
 
   /**
-   * Private method used to wrap the messages that are displayed in dialogs
-   * of type JOptionPane.
-   * @param msg the message.
-   * @param width the maximum width of the column.
-   * @return the wrapped message.
-   */
-  private static String wrapMsg(String msg, int width)
-  {
-    StringBuilder   buffer        = new StringBuilder();
-    StringTokenizer lineTokenizer = new StringTokenizer(msg, "\n", true);
-    while (lineTokenizer.hasMoreTokens())
-    {
-      String line = lineTokenizer.nextToken();
-      if (line.equals("\n"))
-      {
-        // It's an end-of-line character, so append it as-is.
-        buffer.append(line);
-      }
-      else if (line.length() < width)
-      {
-        // The line fits in the specified width, so append it as-is.
-        buffer.append(line);
-      }
-      else
-      {
-        // The line doesn't fit in the specified width, so it needs to be
-        // wrapped.  Do so at space boundaries.
-        StringBuilder   lineBuffer    = new StringBuilder();
-        StringBuilder   delimBuffer   = new StringBuilder();
-        StringTokenizer wordTokenizer = new StringTokenizer(line, " ", true);
-        while (wordTokenizer.hasMoreTokens())
-        {
-          String word = wordTokenizer.nextToken();
-          if (word.equals(" "))
-          {
-            // It's a space, so add it to the delim buffer only if the line
-            // buffer is not empty.
-            if (lineBuffer.length() > 0)
-            {
-              delimBuffer.append(word);
-            }
-          }
-          else if (word.length() > width)
-          {
-            // This is a long word that can't be wrapped, so we'll just have to
-            // make do.
-            if (lineBuffer.length() > 0)
-            {
-              buffer.append(lineBuffer);
-              buffer.append("\n");
-              lineBuffer = new StringBuilder();
-            }
-            buffer.append(word);
-
-            if (wordTokenizer.hasMoreTokens())
-            {
-              // The next token must be a space, so remove it.  If there are
-              // still more tokens after that, then append an EOL.
-              wordTokenizer.nextToken();
-              if (wordTokenizer.hasMoreTokens())
-              {
-                buffer.append("\n");
-              }
-            }
-
-            if (delimBuffer.length() > 0)
-            {
-              delimBuffer = new StringBuilder();
-            }
-          }
-          else
-          {
-            // It's not a space, so see if we can fit it on the current line.
-            int newLineLength = lineBuffer.length() + delimBuffer.length() +
-            word.length();
-            if (newLineLength < width)
-            {
-              // It does fit on the line, so add it.
-              lineBuffer.append(delimBuffer).append(word);
-
-              if (delimBuffer.length() > 0)
-              {
-                delimBuffer = new StringBuilder();
-              }
-            }
-            else
-            {
-              // It doesn't fit on the line, so end the current line and start
-              // a new one.
-              buffer.append(lineBuffer);
-              buffer.append("\n");
-
-              lineBuffer = new StringBuilder();
-              lineBuffer.append(word);
-
-              if (delimBuffer.length() > 0)
-              {
-                delimBuffer = new StringBuilder();
-              }
-            }
-          }
-        }
-
-        // If there's anything left in the line buffer, then add it to the
-        // final buffer.
-        buffer.append(lineBuffer);
-      }
-    }
-    return buffer.toString();
-  }
-
-  /**
    * Inserts HTML break tags into <code>d</code> breaking it up
    * so that no line is longer than <code>maxll</code>.
    * @param d String to break
diff --git a/opendj-sdk/opends/src/statuspanel/org/opends/statuspanel/StatusPanelController.java b/opendj-sdk/opends/src/statuspanel/org/opends/statuspanel/StatusPanelController.java
index 1541f0b..f725f28 100644
--- a/opendj-sdk/opends/src/statuspanel/org/opends/statuspanel/StatusPanelController.java
+++ b/opendj-sdk/opends/src/statuspanel/org/opends/statuspanel/StatusPanelController.java
@@ -41,6 +41,7 @@
 
 import org.opends.quicksetup.Installation;
 import org.opends.quicksetup.ui.UIFactory;
+import org.opends.quicksetup.ui.Utilities;
 import org.opends.quicksetup.util.BackgroundTask;
 import org.opends.quicksetup.util.HtmlProgressMessageFormatter;
 import org.opends.quicksetup.util.Utils;
@@ -221,7 +222,8 @@
       if (!getProgressDialog().isVisible())
       {
         getProgressDialog().pack();
-        Utils.centerOnComponent(getProgressDialog(), getStatusPanelDialog());
+        Utilities.centerOnComponent(getProgressDialog(),
+                getStatusPanelDialog());
         getProgressDialog().setVisible(true);
       }
 
@@ -301,7 +303,8 @@
         if (!getProgressDialog().isVisible())
         {
           getProgressDialog().pack();
-          Utils.centerOnComponent(getProgressDialog(), getStatusPanelDialog());
+          Utilities.centerOnComponent(getProgressDialog(),
+                  getStatusPanelDialog());
           getProgressDialog().setVisible(true);
         }
 
@@ -382,7 +385,8 @@
         if (!getProgressDialog().isVisible())
         {
           getProgressDialog().pack();
-          Utils.centerOnComponent(getProgressDialog(), getStatusPanelDialog());
+          Utilities.centerOnComponent(getProgressDialog(),
+                  getStatusPanelDialog());
           getProgressDialog().setVisible(true);
         }
 
@@ -437,7 +441,7 @@
   public void authenticateClicked()
   {
     getLoginDialog().pack();
-    Utils.centerOnComponent(getLoginDialog(), getStatusPanelDialog());
+    Utilities.centerOnComponent(getLoginDialog(), getStatusPanelDialog());
     getLoginDialog().setVisible(true);
     if (!getLoginDialog().isCancelled())
     {
@@ -1134,7 +1138,7 @@
    */
   private boolean confirmStop()
   {
-    return Utils.displayConfirmation(getStatusPanelDialog(),
+    return Utilities.displayConfirmation(getStatusPanelDialog(),
         getMsg("confirm-stop-message"), getMsg("confirm-stop-title"));
   }
 
@@ -1146,7 +1150,7 @@
    */
   private boolean confirmRestart()
   {
-    return Utils.displayConfirmation(getStatusPanelDialog(),
+    return Utilities.displayConfirmation(getStatusPanelDialog(),
         getMsg("confirm-restart-message"), getMsg("confirm-restart-title"));
   }
 
diff --git a/opendj-sdk/opends/src/statuspanel/org/opends/statuspanel/ui/LoginDialog.java b/opendj-sdk/opends/src/statuspanel/org/opends/statuspanel/ui/LoginDialog.java
index fe51dc5..4388dd8 100644
--- a/opendj-sdk/opends/src/statuspanel/org/opends/statuspanel/ui/LoginDialog.java
+++ b/opendj-sdk/opends/src/statuspanel/org/opends/statuspanel/ui/LoginDialog.java
@@ -51,6 +51,7 @@
 import org.opends.quicksetup.Installation;
 import org.opends.quicksetup.event.MinimumSizeComponentListener;
 import org.opends.quicksetup.ui.UIFactory;
+import org.opends.quicksetup.ui.Utilities;
 import org.opends.quicksetup.util.BackgroundTask;
 import org.opends.quicksetup.util.Utils;
 
@@ -510,7 +511,7 @@
    */
   private void displayError(String msg, String title)
   {
-    Utils.displayError(parent, msg, title);
+    Utilities.displayError(parent, msg, title);
     toFront();
 
   }
@@ -525,7 +526,7 @@
    */
   private void displayInformationMessage(String msg, String title)
   {
-    Utils.displayInformationMessage(parent, msg, title);
+    Utilities.displayInformationMessage(parent, msg, title);
     toFront();
   }
 
diff --git a/opendj-sdk/opends/src/statuspanel/org/opends/statuspanel/ui/StatusPanelDialog.java b/opendj-sdk/opends/src/statuspanel/org/opends/statuspanel/ui/StatusPanelDialog.java
index 39e4f6b..db938c3 100644
--- a/opendj-sdk/opends/src/statuspanel/org/opends/statuspanel/ui/StatusPanelDialog.java
+++ b/opendj-sdk/opends/src/statuspanel/org/opends/statuspanel/ui/StatusPanelDialog.java
@@ -166,7 +166,7 @@
       setPreferredSize(new Dimension(minWidth, minHeight));
       pack();
     }
-    Utils.centerOnScreen(this);
+    Utilities.centerOnScreen(this);
 
     lastPackDescriptor = lastDescriptor;
 

--
Gitblit v1.10.0