From 75d92e5488ccaa51b1c05242cee772988eec75fe Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Mon, 18 Dec 2006 13:33:24 +0000
Subject: [PATCH] Fix some issues with the dialog position when they were displayed.

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

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 054cf81..c6895b1 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
@@ -94,10 +94,6 @@
     this.parent = parent;
     this.installStatus = installStatus;
     getContentPane().add(createPanel());
-//  TODO: find a way to calculate this dynamically
-    setPreferredSize(new Dimension(500, 300));
-    addComponentListener(new MinimumSizeComponentListener(this,
-        500, 300));
   }
 
   /**
@@ -117,10 +113,17 @@
    */
   public void packAndShow()
   {
+    /*
+     * TODO: find a way to calculate this dynamically.  This is done to avoid
+     * all the text in a single line.
+     */
+    setPreferredSize(new Dimension(500, 300));
+    addComponentListener(new MinimumSizeComponentListener(this,
+        500, 300));
+    getRootPane().setDefaultButton(shutDownButton);
     pack();
     Utils.centerOnComponent(this, parent);
     tfPwd.requestFocusInWindow();
-    getRootPane().setDefaultButton(shutDownButton);
     setVisible(true);
   }
 
@@ -226,10 +229,20 @@
     gbc.insets.left = UIFactory.LEFT_INSET_PRIMARY_FIELD;
     gbc.fill = GridBagConstraints.NONE;
     gbc.gridwidth = GridBagConstraints.REMAINDER;
+    JPanel p3 = new JPanel(new GridBagLayout());
+    p3.setOpaque(false);
     tfPwd = UIFactory.makeJPasswordField(null,
         getMsg("shutdown-directory-manager-pwd-tooltip"),
         UIFactory.PASSWORD_FIELD_SIZE, UIFactory.TextStyle.PASSWORD_FIELD);
     p2.add(tfPwd, gbc);
+    p2.add(p3, gbc);
+    gbc.insets = UIFactory.getEmptyInsets();
+    gbc.gridwidth = GridBagConstraints.RELATIVE;
+    gbc.weightx = 0.0;
+    p3.add(tfPwd, gbc);
+    gbc.gridwidth = GridBagConstraints.REMAINDER;
+    gbc.weightx = 1.0;
+    p3.add(Box.createHorizontalGlue(), gbc);
 
     gbc.fill = GridBagConstraints.HORIZONTAL;
     gbc.insets = UIFactory.getEmptyInsets();
@@ -398,23 +411,6 @@
               pwdInvalid = true;
               possibleCauses.add(getMsg("empty-pwd"));
             }
-            if (possibleCauses.size() > 0)
-            {
-              // Message with causes
-              String[] arg = {
-                  Utils.getStringFromCollection(possibleCauses, "\n")
-              };
-              displayError(
-                  getMsg("cannot-connect-to-shutdown-with-cause", arg),
-                  getMsg("error-title"));
-            }
-            else
-            {
-              // Generic message
-              displayError(
-                  getMsg("cannot-connect-to-shutdown-without-cause"),
-                  getMsg("error-title"));
-            }
 
             if (dnInvalid)
             {
@@ -437,6 +433,24 @@
               UIFactory.setTextStyle(lPwd,
                   UIFactory.TextStyle.PRIMARY_FIELD_VALID);
             }
+
+            if (possibleCauses.size() > 0)
+            {
+              // Message with causes
+              String[] arg = {
+                  Utils.getStringFromCollection(possibleCauses, "\n")
+              };
+              displayError(
+                  getMsg("cannot-connect-to-shutdown-with-cause", arg),
+                  getMsg("error-title"));
+            }
+            else
+            {
+              // Generic message
+              displayError(
+                  getMsg("cannot-connect-to-shutdown-without-cause"),
+                  getMsg("error-title"));
+            }
           }
           else
           {

--
Gitblit v1.10.0