From 4cd4ffb2771ea2d133b30273b1ffea0fef6b4552 Mon Sep 17 00:00:00 2001
From: kenneth_suter <kenneth_suter@localhost>
Date: Tue, 17 Apr 2007 20:23:12 +0000
Subject: [PATCH] This commit introduces preliminary versions of the upgrader tool's GUI wizard panels.  Effort has been made to make the panels conform to the design at

---
 opends/src/quicksetup/org/opends/quicksetup/upgrader/Upgrader.java |   65 ++++++++++++++++++++++++++------
 1 files changed, 53 insertions(+), 12 deletions(-)

diff --git a/opends/src/quicksetup/org/opends/quicksetup/upgrader/Upgrader.java b/opends/src/quicksetup/org/opends/quicksetup/upgrader/Upgrader.java
index 7c55a5c..88ae62f 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/upgrader/Upgrader.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/upgrader/Upgrader.java
@@ -28,11 +28,13 @@
 package org.opends.quicksetup.upgrader;
 
 import org.opends.quicksetup.*;
+import org.opends.quicksetup.upgrader.ui.WelcomePanel;
+import org.opends.quicksetup.upgrader.ui.ChooseVersionPanel;
+import org.opends.quicksetup.upgrader.ui.UpgraderReviewPanel;
 import org.opends.quicksetup.util.Utils;
 import org.opends.quicksetup.util.FileManager;
 import org.opends.quicksetup.util.ServerController;
-import org.opends.quicksetup.ui.QuickSetupDialog;
-import org.opends.quicksetup.ui.QuickSetupStepPanel;
+import org.opends.quicksetup.ui.*;
 import org.opends.server.tools.BackUpDB;
 import org.opends.server.tools.LDIFDiff;
 import org.opends.server.util.*;
@@ -182,11 +184,6 @@
   private UpgraderCliHelper cliHelper = null;
 
   /**
-   * Directory where we keep files temporarily.
-   */
-  private File stagingDirectory = null;
-
-  /**
    * Directory where backup is kept in case the upgrade needs reversion.
    */
   private File backupDirectory = null;
@@ -292,21 +289,56 @@
    * {@inheritDoc}
    */
   public QuickSetupStepPanel createWizardStepPanel(WizardStep step) {
-    return null;
+    QuickSetupStepPanel pnl = null;
+    if (UpgradeWizardStep.WELCOME.equals(step)) {
+      pnl = new WelcomePanel(this);
+    } else if (UpgradeWizardStep.CHOOSE_VERSION.equals(step)) {
+      pnl = new ChooseVersionPanel(this);
+    } else if (UpgradeWizardStep.REVIEW.equals(step)) {
+      pnl = new UpgraderReviewPanel(this);
+    } else if (UpgradeWizardStep.PROGRESS.equals(step)) {
+      pnl = new ProgressPanel(this);
+    }
+    return pnl;
   }
 
   /**
    * {@inheritDoc}
    */
-  public Step getNextWizardStep(WizardStep step) {
-    return null;
+  public WizardStep getNextWizardStep(WizardStep step) {
+    WizardStep next = null;
+    if (UpgradeWizardStep.WELCOME.equals(step)) {
+      next = UpgradeWizardStep.CHOOSE_VERSION;
+    } else if (UpgradeWizardStep.CHOOSE_VERSION.equals(step)) {
+      next = UpgradeWizardStep.REVIEW;
+    } else if (UpgradeWizardStep.REVIEW.equals(step)) {
+      next = UpgradeWizardStep.PROGRESS;
+    }
+    return next;
   }
 
   /**
    * {@inheritDoc}
    */
   public WizardStep getPreviousWizardStep(WizardStep step) {
-    return null;
+    WizardStep prev = null;
+    if (UpgradeWizardStep.PROGRESS.equals(step)) {
+      prev = UpgradeWizardStep.REVIEW;
+    } else if (UpgradeWizardStep.REVIEW.equals(step)) {
+      prev = UpgradeWizardStep.CHOOSE_VERSION;
+    } else if (UpgradeWizardStep.CHOOSE_VERSION.equals(step)) {
+      prev = UpgradeWizardStep.WELCOME;
+    }
+    return prev;
+  }
+
+  /**
+   * {@inheritDoc}
+   */
+  public boolean canCancel(WizardStep step) {
+    return UpgradeWizardStep.WELCOME == step ||
+            UpgradeWizardStep.CHOOSE_VERSION == step ||
+            UpgradeWizardStep.REVIEW == step;
   }
 
   /**
@@ -318,7 +350,7 @@
   /**
    * {@inheritDoc}
    */
-  protected void updateUserData(WizardStep cStep, QuickSetup qs)
+  public void updateUserData(WizardStep cStep, QuickSetup qs)
           throws UserDataException {
   }
 
@@ -350,6 +382,15 @@
    * {@inheritDoc}
    */
   public void cancelClicked(WizardStep cStep, QuickSetup qs) {
+    // TODO: confirm cancel
+    System.exit(1);
+  }
+
+  /**
+   * {@inheritDoc}
+   */
+  public boolean canFinish(WizardStep step) {
+    return UpgradeWizardStep.REVIEW.equals(step);
   }
 
   /**

--
Gitblit v1.10.0