From c9d828643471890c2812f7d959a98ea8cb135fb8 Mon Sep 17 00:00:00 2001
From: kenneth_suter <kenneth_suter@localhost>
Date: Mon, 02 Apr 2007 15:07:10 +0000
Subject: [PATCH] further refactorings to delegate application logic to Application classes in addition to basic upgrade tool implementation classes and scripts

---
 opends/src/quicksetup/org/opends/quicksetup/uninstaller/Uninstaller.java |  111 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 111 insertions(+), 0 deletions(-)

diff --git a/opends/src/quicksetup/org/opends/quicksetup/uninstaller/Uninstaller.java b/opends/src/quicksetup/org/opends/quicksetup/uninstaller/Uninstaller.java
index 12ff3a5..7ee1c77 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/uninstaller/Uninstaller.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/uninstaller/Uninstaller.java
@@ -28,11 +28,14 @@
 package org.opends.quicksetup.uninstaller;
 
 import org.opends.quicksetup.*;
+import org.opends.quicksetup.ui.*;
 import org.opends.quicksetup.util.Utils;
 import org.opends.server.tools.ConfigureWindowsService;
 
+import javax.swing.*;
 import java.io.*;
 import java.util.*;
+import java.awt.event.WindowEvent;
 
 /**
  * This class is in charge of performing the uninstallation of Open DS.
@@ -56,6 +59,13 @@
   /**
    * {@inheritDoc}
    */
+  public String getFrameTitle() {
+    return getMsg("frame-uninstall-title");
+  }
+
+  /**
+   * {@inheritDoc}
+   */
   public UserData createUserData() {
     return new UninstallUserData();
   }
@@ -63,6 +73,54 @@
   /**
    * {@inheritDoc}
    */
+  public Step getFirstWizardStep() {
+    return Step.CONFIRM_UNINSTALL;
+  }
+
+  /**
+   * {@inheritDoc}
+   */
+  public Step getNextWizardStep(Step step) {
+    Step nextStep = null;
+    if (step != null && step.equals(Step.CONFIRM_UNINSTALL)) {
+      nextStep = Step.PROGRESS;
+    }
+    return nextStep;
+  }
+
+  /**
+   * {@inheritDoc}
+   */
+  protected void setWizardDialogState(QuickSetupDialog dlg,
+                                      UserData userData,
+                                      Step step) {
+      // Set the default button for the frame
+      switch (step) {
+        case CONFIRM_UNINSTALL:
+          dlg.setDefaultButton(ButtonName.FINISH);
+          break;
+
+        case PROGRESS:
+          dlg.setDefaultButton(ButtonName.CLOSE);
+          break;
+      }
+
+      // Set the focus for the current step
+      switch (step) {
+        case CONFIRM_UNINSTALL:
+          dlg.setFocusOnButton(ButtonName.FINISH);
+          break;
+
+        case PROGRESS:
+          dlg.setFocusOnButton(ButtonName.CLOSE);
+          dlg.setButtonEnabled(ButtonName.CLOSE, false);
+          break;
+      }
+  }
+
+  /**
+   * {@inheritDoc}
+   */
   public UserData createUserData(String[] args, CurrentInstallStatus status)
     throws UserDataException
   {
@@ -359,6 +417,59 @@
   }
 
   /**
+   * {@inheritDoc}
+   */
+  public void windowClosing(QuickSetupDialog dlg, WindowEvent evt) {
+    if (dlg.getDisplayedStep() == Step.PROGRESS) {
+      // Simulate a close button event
+      dlg.notifyButtonEvent(ButtonName.CLOSE);
+    } else {
+      // Simulate a quit button event
+      dlg.notifyButtonEvent(ButtonName.QUIT);
+    }
+  }
+
+  /**
+   * {@inheritDoc}
+   */
+  public ButtonName getInitialFocusButtonName() {
+    return ButtonName.FINISH;
+  }
+
+  /**
+   * {@inheritDoc}
+   */
+  public JPanel createFramePanel(QuickSetupDialog dlg) {
+    return new FramePanel(dlg.getStepsPanel(),
+            dlg.getCurrentStepPanel(),
+            dlg.getButtonsPanel());
+  }
+
+  /**
+   * {@inheritDoc}
+   */
+  public Set<Step> getWizardSteps() {
+    return EnumSet.of(Step.CONFIRM_UNINSTALL,
+            Step.PROGRESS);
+  }
+
+  /**
+   * {@inheritDoc}
+   */
+  public QuickSetupStepPanel createWizardStepPanel(Step step) {
+    QuickSetupStepPanel p = null;
+    switch (step) {
+      case CONFIRM_UNINSTALL:
+        p = new ConfirmUninstallPanel(installStatus);
+        break;
+      case PROGRESS:
+        p = new ProgressPanel();
+        break;
+    }
+    return p;
+  }
+
+  /**
    * This methods stops the server.
    * @throws ApplicationException if something goes wrong.
    */

--
Gitblit v1.10.0