From 5c475d832939f651fa10f4726ef41e1aad86d19a Mon Sep 17 00:00:00 2001
From: kenneth_suter <kenneth_suter@localhost>
Date: Wed, 25 Apr 2007 21:48:40 +0000
Subject: [PATCH] - Addresses issues that was forcing OpenDS.jar to be downloaded during WebStart version of Upgrade. Upgrade now uses the WebStartDownloader to load jars in the background - Fixes UI timing issues with build information being downloaded in a different thread - Introduces a loading panel that is swapped in while panels are in begin draw state to make the UI more responsive when initialization takes a long time
---
opends/src/quicksetup/org/opends/quicksetup/ui/CurrentStepPanel.java | 46 +++++++++++++++++++++++++++++++++-------------
1 files changed, 33 insertions(+), 13 deletions(-)
diff --git a/opends/src/quicksetup/org/opends/quicksetup/ui/CurrentStepPanel.java b/opends/src/quicksetup/org/opends/quicksetup/ui/CurrentStepPanel.java
index 9ce692a..c08efbf 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/ui/CurrentStepPanel.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/ui/CurrentStepPanel.java
@@ -27,16 +27,16 @@
package org.opends.quicksetup.ui;
-import java.awt.CardLayout;
-import java.awt.Dimension;
+import java.awt.*;
import java.util.HashMap;
import java.util.Set;
import org.opends.quicksetup.event.ButtonActionListener;
-import org.opends.quicksetup.installer.Installer;
import org.opends.quicksetup.*;
+import javax.swing.*;
+
/**
* This is the class that contains the panel on the right-top part of the
* QuickSetupDialog). It uses a CardLayout that contains all
@@ -54,6 +54,8 @@
{
private static final long serialVersionUID = 5474803491510999334L;
+ private static final String LOADING_PANEL = "loading";
+
private HashMap<WizardStep, QuickSetupStepPanel> hmPanels =
new HashMap<WizardStep, QuickSetupStepPanel>();
@@ -140,12 +142,17 @@
add(getPanel(s), s.toString());
}
+ // Add a special panel to display while panels are
+ // initializing themselves
+ JPanel loadingPanel = UIFactory.makeJPanel();
+ loadingPanel.setLayout(new GridBagLayout());
+ loadingPanel.add(UIFactory.makeJLabel(UIFactory.IconType.NO_ICON,
+ getMsg("general-loading"), UIFactory.TextStyle.PRIMARY_FIELD_VALID),
+ new GridBagConstraints());
+ add(loadingPanel, LOADING_PANEL);
+
// For aesthetical reasons we add a little bit of height
- // TODO: remove this hack
- if (getApplication() instanceof Installer)
- {
- minHeight += UIFactory.EXTRA_DIALOG_HEIGHT;
- }
+ minHeight += getApplication().getExtraDialogHeight();
setPreferredSize(new Dimension(minWidth, minHeight));
setMinimumSize(new Dimension(minWidth, minHeight));
@@ -183,12 +190,25 @@
* @param userData the UserData object that must be used to populate
* the panels.
*/
- public void setDisplayedStep(WizardStep step, UserData userData)
+ public void setDisplayedStep(final WizardStep step, final UserData userData)
{
- CardLayout cl = (CardLayout) (getLayout());
- getPanel(step).beginDisplay(userData);
- cl.show(this, step.toString());
- getPanel(step).endDisplay();
+ final CardLayout cl = (CardLayout) (getLayout());
+
+ // Show the 'loading...' panel and invoke begin
+ // display in another thread in case the panel
+ // taske a while to initialize.
+ cl.show(this, LOADING_PANEL);
+ new Thread(new Runnable() {
+ public void run() {
+ getPanel(step).beginDisplay(userData);
+ SwingUtilities.invokeLater(new Runnable() {
+ public void run() {
+ cl.show(CurrentStepPanel.this, step.toString());
+ getPanel(step).endDisplay();
+ }
+ });
+ }
+ },"panel begin display thread").start();
}
/**
--
Gitblit v1.10.0