mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

kenneth_suter
02.07.2007 c9d828643471890c2812f7d959a98ea8cb135fb8
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.
   */