From 1d533a6fc8a4e1ff0d29e168d3aff2da43b679a0 Mon Sep 17 00:00:00 2001
From: kenneth_suter <kenneth_suter@localhost>
Date: Thu, 24 May 2007 15:31:54 +0000
Subject: [PATCH] resolves issue 1627 to make use of the framework's plumbing for marking the lone upgrader input field with the invalid field styling if the value is invalid

---
 opends/src/quicksetup/org/opends/quicksetup/upgrader/ui/WelcomePanel.java |   21 ++++++++++++++++++++-
 opends/src/quicksetup/org/opends/quicksetup/upgrader/Upgrader.java        |    2 +-
 2 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/opends/src/quicksetup/org/opends/quicksetup/upgrader/Upgrader.java b/opends/src/quicksetup/org/opends/quicksetup/upgrader/Upgrader.java
index fce3739..1ef0942 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/upgrader/Upgrader.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/upgrader/Upgrader.java
@@ -638,7 +638,7 @@
             }
 
             uud.setServerLocation(serverLocationString);
-
+            qs.displayFieldInvalid(FieldName.SERVER_LOCATION, false);
           } catch (IllegalArgumentException iae) {
             LOG.log(Level.INFO,
                     "illegal OpenDS installation directory selected", iae);
diff --git a/opends/src/quicksetup/org/opends/quicksetup/upgrader/ui/WelcomePanel.java b/opends/src/quicksetup/org/opends/quicksetup/upgrader/ui/WelcomePanel.java
index 736dc24..05f15b5 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/upgrader/ui/WelcomePanel.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/upgrader/ui/WelcomePanel.java
@@ -48,6 +48,8 @@
 
   private static final long serialVersionUID = 8695606871542491768L;
 
+  private JLabel lblServerLocation;
+
   private JTextComponent tcServerLocation;
 
   private JTextComponent tcCurrentServerBuildNumber;
@@ -82,6 +84,21 @@
   /**
    * {@inheritDoc}
    */
+  public void displayFieldInvalid(FieldName fieldName, boolean invalid) {
+    UIFactory.TextStyle style;
+    if (invalid) {
+      style = UIFactory.TextStyle.PRIMARY_FIELD_INVALID;
+    } else {
+      style = UIFactory.TextStyle.PRIMARY_FIELD_VALID;
+    }
+    if (FieldName.SERVER_LOCATION.equals(fieldName)) {
+      UIFactory.setTextStyle(lblServerLocation, style);
+    }
+  }
+
+  /**
+   * {@inheritDoc}
+   */
   protected String getTitle() {
     return getMsg("upgrade-welcome-panel-title");
   }
@@ -138,6 +155,8 @@
     // command line implies a build.
     if (Utils.isWebStart()) {
 
+      lblServerLocation = UIFactory.makeJLabel(serverLocationDescriptor);
+
       tcServerLocation =
               UIFactory.makeJTextComponent(serverLocationDescriptor,
                       userData.getServerLocation());
@@ -153,7 +172,7 @@
       butBrowse.addActionListener(l);
 
       JPanel pnlBrowser = Utilities.createBrowseButtonPanel(
-              UIFactory.makeJLabel(serverLocationDescriptor),
+              lblServerLocation,
               tcServerLocation,
               butBrowse);
       pnlBrowser.setOpaque(false);

--
Gitblit v1.10.0