From 3c2731a8b05bc939036a76cb88244f58aceede09 Mon Sep 17 00:00:00 2001
From: kenneth_suter <kenneth_suter@localhost>
Date: Fri, 11 May 2007 13:26:06 +0000
Subject: [PATCH] - Corrected prefetching of build ID information which was broken and consolidated in the Installation class.

---
 opends/src/quicksetup/org/opends/quicksetup/upgrader/ui/ChooseVersionPanel.java |  101 +++++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 83 insertions(+), 18 deletions(-)

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 b122c00..4a5c210 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/upgrader/ui/ChooseVersionPanel.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/upgrader/ui/ChooseVersionPanel.java
@@ -34,11 +34,12 @@
 import org.opends.quicksetup.upgrader.RemoteBuildManager;
 import org.opends.quicksetup.upgrader.Upgrader;
 import org.opends.quicksetup.util.BackgroundTask;
+import org.opends.quicksetup.util.Utils;
 
 import javax.swing.*;
 import java.awt.*;
-import java.awt.event.ActionListener;
 import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
 import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
@@ -55,6 +56,7 @@
 
   static private final long serialVersionUID = -6941309163077121917L;
 
+  private JLabel lblCurrentVersion = null;
   private JRadioButton rbRemote = null;
   private JRadioButton rbLocal = null;
   private ButtonGroup grpRemoteLocal = null;
@@ -78,8 +80,7 @@
   /**
    * {@inheritDoc}
    */
-  public boolean blockingBeginDisplay()
-  {
+  public boolean blockingBeginDisplay() {
     return true;
   }
 
@@ -88,6 +89,7 @@
    */
   public void beginDisplay(UserData data) {
     super.beginDisplay(data);
+
     if (!loadBuildListAttempted) {
 
       // Begin display is called outside the UI
@@ -116,6 +118,10 @@
       t.setRepeats(false);
       t.start();
     }
+
+    lblCurrentVersion.setText(
+            Utils.getBuildString(getApplication().getInstallation()));
+
   }
 
   /**
@@ -144,6 +150,18 @@
 
     JPanel p = UIFactory.makeJPanel();
 
+    LabelFieldDescriptor currentVersionDescriptor = new LabelFieldDescriptor(
+      getMsg("upgrade-review-panel-old-version-label"),
+      getMsg("upgrade-review-panel-old-version-tooltip"),
+      LabelFieldDescriptor.FieldType.READ_ONLY,
+      LabelFieldDescriptor.LabelType.PRIMARY,
+      0
+    );
+
+    lblCurrentVersion = UIFactory.makeJLabel(
+            UIFactory.IconType.NO_ICON,
+            "", UIFactory.TextStyle.SECONDARY_FIELD_VALID);
+
     rbRemote = UIFactory.makeJRadioButton(
             getMsg("upgrade-choose-version-remote-label"),
             getMsg("upgrade-choose-version-remote-tooltip"),
@@ -197,50 +215,72 @@
     p.setLayout(new GridBagLayout());
     // p.setBorder(BorderFactory.createLineBorder(Color.RED));
     GridBagConstraints gbc = new GridBagConstraints();
+
     gbc.gridx = 0;
     gbc.gridy = 0;
+    gbc.anchor = GridBagConstraints.FIRST_LINE_START;
+    gbc.insets.left = UIFactory.LEFT_INSET_PRIMARY_FIELD;
+    gbc.insets.top = UIFactory.TOP_INSET_PRIMARY_FIELD;
+    p.add(UIFactory.makeJLabel(currentVersionDescriptor), gbc);
+
+    gbc.gridx = 1;
     gbc.gridwidth = GridBagConstraints.REMAINDER;
-    gbc.insets = UIFactory.getEmptyInsets();
     gbc.weightx = 1.0;
     gbc.fill = GridBagConstraints.HORIZONTAL;
-    gbc.insets = UIFactory.getEmptyInsets();
-    gbc.insets.top = 15; // non-standard but looks better
+    gbc.anchor = GridBagConstraints.FIRST_LINE_START;
+    gbc.insets.left = UIFactory.LEFT_INSET_PRIMARY_FIELD;
+    gbc.insets.top = UIFactory.TOP_INSET_PRIMARY_FIELD;
+    p.add(lblCurrentVersion, gbc);
+
+    gbc.gridx = 0;
+    gbc.gridy++;
+    gbc.gridwidth = GridBagConstraints.REMAINDER;
+    gbc.weightx = 1.0;
+    gbc.fill = GridBagConstraints.HORIZONTAL;
+    gbc.insets.top = UIFactory.TOP_INSET_RADIOBUTTON + 15;
+    gbc.insets.left = UIFactory.LEFT_INSET_PRIMARY_FIELD;
     gbc.anchor = GridBagConstraints.FIRST_LINE_START;
     p.add(rbRemote, gbc);
 
-    gbc.gridy = 1;
-    gbc.gridwidth = 1;
-    gbc.insets = UIFactory.getEmptyInsets();
+    gbc.gridy++;
+    gbc.gridwidth = 2;
     gbc.insets.top = UIFactory.TOP_INSET_RADIO_SUBORDINATE;
-    gbc.insets.left = UIFactory.LEFT_INSET_RADIO_SUBORDINATE;
+    gbc.insets.left = UIFactory.LEFT_INSET_RADIO_SUBORDINATE +
+            UIFactory.LEFT_INSET_PRIMARY_FIELD;
     gbc.anchor = GridBagConstraints.LINE_START;
     gbc.fill = GridBagConstraints.HORIZONTAL;
     gbc.weightx = 2;
     p.add(cboBuild, gbc);
 
-    gbc.gridy = 1;
     gbc.gridx = 1;
     gbc.weightx = 1.5;
-    gbc.anchor = GridBagConstraints.CENTER;
+    gbc.anchor = GridBagConstraints.LINE_START;
     gbc.fill = GridBagConstraints.HORIZONTAL;
     gbc.insets = UIFactory.getEmptyInsets();
     JPanel fill = UIFactory.makeJPanel();
     // fill.setBorder(BorderFactory.createLineBorder(Color.BLUE));
     p.add(fill, gbc);
 
-    gbc.gridy = 2;
+    gbc.gridy++;
     gbc.gridx = 0;
-    gbc.insets = UIFactory.getEmptyInsets();
-    gbc.insets.top = 15; // UIFactory.TOP_INSET_RADIOBUTTON;
+    gbc.gridwidth = GridBagConstraints.REMAINDER;
+    gbc.fill = GridBagConstraints.HORIZONTAL;
+    gbc.insets.top = UIFactory.TOP_INSET_PRIMARY_FIELD;
+    gbc.insets.left = UIFactory.LEFT_INSET_PRIMARY_FIELD;
     p.add(rbLocal, gbc);
 
-    gbc.gridy = 3;
+    gbc.gridy++;
     gbc.insets = UIFactory.getEmptyInsets();
     gbc.insets.top = UIFactory.TOP_INSET_RADIO_SUBORDINATE;
-    gbc.insets.left = UIFactory.LEFT_INSET_RADIO_SUBORDINATE;
+    gbc.insets.left = UIFactory.LEFT_INSET_RADIO_SUBORDINATE +
+            UIFactory.LEFT_INSET_PRIMARY_FIELD;
+    gbc.gridwidth = GridBagConstraints.REMAINDER;
+    gbc.weightx = 2;
+    gbc.fill = GridBagConstraints.BOTH;
+    // pnlBrowse.setBorder(BorderFactory.createLineBorder(Color.BLUE));
     p.add(pnlBrowse, gbc);
 
-    gbc.gridy = 4;
+    gbc.gridy++;
     gbc.weighty = 1.0;
     gbc.weightx = 1.0;
     gbc.fill = GridBagConstraints.BOTH;
@@ -473,4 +513,29 @@
     tfFile.setEnabled(rbLocal.isSelected());
     butBrowse.setEnabled((rbLocal.isSelected()));
   }
+
+//  public static void main(String[] args) {
+//    final UserData ud = new UpgradeUserData();
+//    ud.setServerLocation("XXX/XXXXX/XX/XXXXXXXXXXXX/XXXX");
+//    Upgrader app = new Upgrader();
+//    app.setUserData(ud);
+//    final ChooseVersionPanel p = new ChooseVersionPanel(app);
+//    p.initialize();
+//    JFrame frame = new JFrame();
+//    frame.getContentPane().add(p);
+//    frame.addComponentListener(new ComponentAdapter() {
+//      public void componentHidden(ComponentEvent componentEvent) {
+//        System.exit(0);
+//      }
+//    });
+//    frame.pack();
+//    frame.setVisible(true);
+//    new Thread(new Runnable() {
+//      public void run() {
+//        p.beginDisplay(ud);
+//      }
+//    }).start();
+//
+//  }
+
 }

--
Gitblit v1.10.0