From 535613fb5fd9a2e33c5d5717dd17a2afaf2139ff Mon Sep 17 00:00:00 2001
From: kenneth_suter <kenneth_suter@localhost>
Date: Fri, 27 Apr 2007 14:36:16 +0000
Subject: [PATCH] Addresses issues with GUI access to builds repository - Fixes a bug in which caused the connection problem dialog to fail to appear - Fixes a presentation problem with the HTML presented in the connection problem dialog - Properly associates the web proxy dialog with its parent and centers on the screen

---
 opends/src/quicksetup/org/opends/quicksetup/resources/Resources.properties               |    2 +-
 opends/src/quicksetup/org/opends/quicksetup/ui/WebProxyDialog.java                       |    3 +++
 opends/src/quicksetup/org/opends/quicksetup/upgrader/ui/BuildListDownloadErrorPanel.java |    4 +++-
 opends/src/quicksetup/org/opends/quicksetup/upgrader/RemoteBuildManager.java             |    9 ---------
 opends/src/quicksetup/org/opends/quicksetup/upgrader/ui/ChooseVersionPanel.java          |   28 +++++++++++++++++++++++-----
 5 files changed, 30 insertions(+), 16 deletions(-)

diff --git a/opends/src/quicksetup/org/opends/quicksetup/resources/Resources.properties b/opends/src/quicksetup/org/opends/quicksetup/resources/Resources.properties
index 8450239..6771129 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/resources/Resources.properties
+++ b/opends/src/quicksetup/org/opends/quicksetup/resources/Resources.properties
@@ -876,7 +876,7 @@
   <br>Unable to retrieve the list of builds from {0} due to: {1}.<br>\
   Possible Causes:<br>\
   <ul><li>Need to specify a proxy.<br><table><tr><td>\
-  <input value="Specify Proxy" type="submit"/></td><td>Current Proxy: {2}<td>\
+  <input value="Specify Proxy" type="submit"></input></td><td>Current Proxy: {2}<td>\
   </tr></table><br></li><li>{0} \
   is down or experiencing difficulty.</li></ul><br>You can still continue with \
   upgrade but will need to download a build separately and then point to it in \
diff --git a/opends/src/quicksetup/org/opends/quicksetup/ui/WebProxyDialog.java b/opends/src/quicksetup/org/opends/quicksetup/ui/WebProxyDialog.java
index 49639e0..33a4731 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/ui/WebProxyDialog.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/ui/WebProxyDialog.java
@@ -27,6 +27,8 @@
 
 package org.opends.quicksetup.ui;
 
+import org.opends.quicksetup.util.Utils;
+
 import javax.swing.*;
 import java.awt.*;
 import java.awt.event.ActionListener;
@@ -115,6 +117,7 @@
         tfHost.requestFocusInWindow();
       }
     });
+    Utils.centerOnComponent(this, getParent());
     pack();
   }
 
diff --git a/opends/src/quicksetup/org/opends/quicksetup/upgrader/RemoteBuildManager.java b/opends/src/quicksetup/org/opends/quicksetup/upgrader/RemoteBuildManager.java
index b540caf..b9967c9 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/upgrader/RemoteBuildManager.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/upgrader/RemoteBuildManager.java
@@ -39,7 +39,6 @@
 import java.util.regex.Pattern;
 import java.util.regex.Matcher;
 import java.util.logging.Logger;
-import java.util.logging.Level;
 import java.io.*;
 import java.awt.*;
 
@@ -186,14 +185,6 @@
     String line;
     while (null != (line = reader.readLine())) {
       builder.append(line);
-
-      // FOR TESTING
-       try {
-          Thread.sleep(50);
-       } catch (InterruptedException e) {
-          LOG.log(Level.INFO, "error", e);
-       }
-
     }
     return builder.toString();
   }
diff --git a/opends/src/quicksetup/org/opends/quicksetup/upgrader/ui/BuildListDownloadErrorPanel.java b/opends/src/quicksetup/org/opends/quicksetup/upgrader/ui/BuildListDownloadErrorPanel.java
index b755818..fad5430 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/upgrader/ui/BuildListDownloadErrorPanel.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/upgrader/ui/BuildListDownloadErrorPanel.java
@@ -110,7 +110,9 @@
     CustomHTMLEditorKit ek = new CustomHTMLEditorKit();
     ek.addActionListener(new ActionListener() {
       public void actionPerformed(ActionEvent ev) {
-        specifyProxy(getParent());
+        Component dlg = SwingUtilities.getAncestorOfClass(Window.class,
+                BuildListDownloadErrorPanel.this);
+        specifyProxy(dlg);
 
         // Since the proxy info may change we need
         // to regenerate the text
diff --git a/opends/src/quicksetup/org/opends/quicksetup/upgrader/ui/ChooseVersionPanel.java b/opends/src/quicksetup/org/opends/quicksetup/upgrader/ui/ChooseVersionPanel.java
index 576e093..15e3fc2 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/upgrader/ui/ChooseVersionPanel.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/upgrader/ui/ChooseVersionPanel.java
@@ -70,7 +70,7 @@
    */
   public ChooseVersionPanel(GuiApplication application) {
     super(application);
-    createBuildLoader();
+    getBuildLoader();
   }
 
   /**
@@ -245,7 +245,7 @@
     return getMsg("upgrade-choose-version-panel-instructions");
   }
 
-  private RemoteBuildListComboBoxModelCreator createBuildLoader() {
+  private RemoteBuildListComboBoxModelCreator getBuildLoader() {
     if (bld == null) {
       RemoteBuildManager rbm =
               ((Upgrader) getApplication()).getRemoteBuildManager();
@@ -356,15 +356,25 @@
       throws IOException
     {
       this.rbm = rbm;
-      this.in = rbm.getDailyBuildsInputStream(getMainWindow(),
-              "Reading build information");
+
+      // This is a lengthy operation that must be
+      // performed in the event thread.  So try
+      // to do this work now during construction
+      // rather than when the panel becomes visible
+      // for the first time.  If we fail we'll try
+      // again later.
+      try {
+        getInputStream();
+      } catch (IOException e) {
+        LOG.log(Level.INFO, "Error obtaining build list input stream", e);
+      }
     }
 
     /**
      * {@inheritDoc}
      */
     public java.util.List<Build> processBackgroundTask() throws Exception {
-      return rbm.listBuilds(in);
+      return rbm.listBuilds(getInputStream());
     }
 
     /**
@@ -424,6 +434,14 @@
         });
       }
     }
+
+    private InputStream getInputStream() throws IOException {
+      if (this.in == null) {
+        this.in = rbm.getDailyBuildsInputStream(getMainWindow(),
+                "Reading build information");
+      }
+      return this.in;
+    }
   }
 
 }

--
Gitblit v1.10.0