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

jvergara
06.12.2007 247adc2b524e82e284fa74798ea1a21f2d754892
Add the code required to update the list of steps that appear on the left of the wizard dynamically.

Now in the merged version of the setup when the user clicks on the radio button for the upgrade, the steps on the left pane are updated directly.
9 files modified
138 ■■■■ changed files
opends/src/quicksetup/org/opends/quicksetup/ButtonName.java 10 ●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/installandupgrader/InstallAndUpgrader.java 33 ●●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/installandupgrader/ui/WelcomePanel.java 6 ●●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java 23 ●●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/installer/ui/DataReplicationPanel.java 7 ●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/installer/ui/SuffixesToReplicatePanel.java 5 ●●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/ui/GuiApplication.java 22 ●●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/ui/QuickSetup.java 15 ●●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/ui/StepsPanel.java 17 ●●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/ButtonName.java
@@ -29,7 +29,7 @@
/**
 * This enumeration defines the logical names of the buttons that appear on the
 * bottom of the wizard dialog.
 * the wizard dialog.
 */
public enum ButtonName
{
@@ -60,5 +60,11 @@
  /**
   * The Launch Status Panel button.
   */
  LAUNCH_STATUS_PANEL
  LAUNCH_STATUS_PANEL,
  /**
   * Input panel button.  This is used to identify generic buttons inside
   * the panels and the notifications are used for instance to update the
   * visibility of the steps on the right.
   */
  INPUT_PANEL_BUTTON
}
opends/src/quicksetup/org/opends/quicksetup/installandupgrader/InstallAndUpgrader.java
@@ -310,7 +310,7 @@
  /**
   * {@inheritDoc}
   */
  public boolean isVisible(WizardStep step)
  public boolean isVisible(WizardStep step, UserData userData)
  {
    boolean isVisible;
    if (step == Step.WELCOME)
@@ -319,7 +319,8 @@
    }
    else
    {
      isVisible = getDelegateApplication().isVisible(step) &&
      isVisible = getDelegateApplication().isVisible(step,
          getDelegateApplication().getUserData()) &&
      getDelegateApplication().getWizardSteps().contains(step);
    }
    return isVisible;
@@ -328,6 +329,34 @@
  /**
   * {@inheritDoc}
   */
  public boolean isVisible(WizardStep step, QuickSetup qs)
  {
    boolean isVisible;
    if (step == Step.WELCOME)
    {
      isVisible = true;
    }
    else
    {
      GuiApplication appl;
      Boolean isUpgrade = (Boolean)qs.getFieldValue(FieldName.IS_UPGRADE);
      if (Boolean.TRUE.equals(isUpgrade))
      {
        appl = upgrader;
      }
      else
      {
        appl = installer;
      }
      isVisible = appl.isVisible(step, qs) &&
      appl.getWizardSteps().contains(step);
    }
    return isVisible;
  }
  /**
   * {@inheritDoc}
   */
  public boolean isSubStep(WizardStep step)
  {
    boolean isSubStep;
opends/src/quicksetup/org/opends/quicksetup/installandupgrader/ui/WelcomePanel.java
@@ -28,8 +28,10 @@
package org.opends.quicksetup.installandupgrader.ui;
import org.opends.quicksetup.ui.*;
import org.opends.quicksetup.ButtonName;
import org.opends.quicksetup.UserData;
import org.opends.quicksetup.event.BrowseActionListener;
import org.opends.quicksetup.event.ButtonEvent;
import org.opends.quicksetup.installandupgrader.InstallAndUpgradeUserData;
import org.opends.quicksetup.installandupgrader.InstallAndUpgrader;
import org.opends.server.util.DynamicConstants;
@@ -154,6 +156,9 @@
      public void actionPerformed(ActionEvent ev)
      {
        checkEnablingState();
        ButtonEvent be = new ButtonEvent(ev.getSource(),
            ButtonName.INPUT_PANEL_BUTTON);
        notifyButtonListeners(be);
      }
    };
    rbInstall.addActionListener(l);
@@ -171,6 +176,7 @@
    gbc.insets.top = UIFactory.TOP_INSET_SECONDARY_FIELD;
    p.add(rbUpgrade, gbc);
    gbc.insets.left = UIFactory.LEFT_INSET_RADIO_SUBORDINATE;
    p.add(createUpgraderPanel(), gbc);
    gbc.insets.top = 0;
opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java
@@ -253,17 +253,17 @@
  /**
   * {@inheritDoc}
   */
  public boolean isVisible(WizardStep step)
  public boolean isVisible(WizardStep step, UserData userData)
  {
    boolean isVisible;
    if (step == CREATE_GLOBAL_ADMINISTRATOR)
    {
       isVisible = getUserData().mustCreateAdministrator();
       isVisible = userData.mustCreateAdministrator();
    }
    else if (step == NEW_SUFFIX_OPTIONS)
    {
      SuffixesToReplicateOptions suf =
        getUserData().getSuffixesToReplicateOptions();
        userData.getSuffixesToReplicateOptions();
      if (suf != null)
      {
        isVisible = suf.getType() !=
@@ -276,8 +276,7 @@
    }
    else if (step == SUFFIXES_OPTIONS)
    {
      DataReplicationOptions repl =
        getUserData().getReplicationOptions();
      DataReplicationOptions repl = userData.getReplicationOptions();
      if (repl != null)
      {
        isVisible =
@@ -291,9 +290,9 @@
    }
    else if (step == REMOTE_REPLICATION_PORTS)
    {
      isVisible = isVisible(SUFFIXES_OPTIONS) &&
      (getUserData().getRemoteWithNoReplicationPort().size() > 0) &&
      (getUserData().getSuffixesToReplicateOptions().getType() ==
      isVisible = isVisible(SUFFIXES_OPTIONS, userData) &&
      (userData.getRemoteWithNoReplicationPort().size() > 0) &&
      (userData.getSuffixesToReplicateOptions().getType() ==
        SuffixesToReplicateOptions.Type.REPLICATE_WITH_EXISTING_SUFFIXES);
    }
    else
@@ -306,6 +305,14 @@
  /**
   * {@inheritDoc}
   */
  public boolean isVisible(WizardStep step, QuickSetup qs)
  {
    return isVisible(step, getUserData());
  }
  /**
   * {@inheritDoc}
   */
  public boolean finishClicked(final WizardStep cStep, final QuickSetup qs) {
    if (cStep == Step.REVIEW) {
        updateUserDataForReviewPanel(qs);
opends/src/quicksetup/org/opends/quicksetup/installer/ui/DataReplicationPanel.java
@@ -46,7 +46,9 @@
import javax.swing.event.DocumentListener;
import javax.swing.text.JTextComponent;
import org.opends.quicksetup.ButtonName;
import org.opends.quicksetup.UserData;
import org.opends.quicksetup.event.ButtonEvent;
import org.opends.quicksetup.installer.AuthenticationData;
import org.opends.quicksetup.installer.DataReplicationOptions;
import org.opends.quicksetup.ui.FieldName;
@@ -568,9 +570,12 @@
  {
    final ActionListener l = new ActionListener()
    {
      public void actionPerformed(ActionEvent e)
      public void actionPerformed(ActionEvent ev)
      {
        checkEnablingState();
        ButtonEvent be = new ButtonEvent(ev.getSource(),
            ButtonName.INPUT_PANEL_BUTTON);
        notifyButtonListeners(be);
      }
    };
    rbReplicated.addActionListener(l);
opends/src/quicksetup/org/opends/quicksetup/installer/ui/SuffixesToReplicatePanel.java
@@ -56,7 +56,9 @@
import org.opends.admin.ads.ServerDescriptor;
import org.opends.admin.ads.SuffixDescriptor;
import org.opends.quicksetup.ButtonName;
import org.opends.quicksetup.UserData;
import org.opends.quicksetup.event.ButtonEvent;
import org.opends.quicksetup.installer.SuffixesToReplicateOptions;
import org.opends.quicksetup.ui.FieldName;
import org.opends.quicksetup.ui.GuiApplication;
@@ -343,6 +345,9 @@
      public void actionPerformed(ActionEvent ev)
      {
        checkEnablingState();
        ButtonEvent be = new ButtonEvent(ev.getSource(),
            ButtonName.INPUT_PANEL_BUTTON);
        notifyButtonListeners(be);
      }
    };
    rbCreateNewSuffix.addActionListener(l);
opends/src/quicksetup/org/opends/quicksetup/ui/GuiApplication.java
@@ -237,13 +237,31 @@
  }
  /**
   * Indicates whether the provided <code>step</code> is visible or not.
   * Indicates whether the provided <code>step</code> is visible or not
   * depending on the contents of the UserData object that is provided.
   * @param step WizardStep for which the return value indicates whether
   * or not is visible.
   * @param userData the UserData to be used to determine if the step is
   * visible or not.
   * @return boolean where true indicates the provided <code>step</code> is
   * visible.
   */
  public boolean isVisible(WizardStep step)
  public boolean isVisible(WizardStep step, UserData userData)
  {
    return true;
  }
  /**
   * Indicates whether the provided <code>step</code> is visible or not
   * depending on the contents of the QuickSetup object that is provided.
   * @param step WizardStep for which the return value indicates whether
   * or not is visible.
   * @param qs the QuickSetup to be used to determine if the step is
   * visible or not.
   * @return boolean where true indicates the provided <code>step</code> is
   * visible.
   */
  public boolean isVisible(WizardStep step, QuickSetup qs)
  {
    return true;
  }
opends/src/quicksetup/org/opends/quicksetup/ui/QuickSetup.java
@@ -172,6 +172,10 @@
      launchStatusPanelClicked();
      break;
    case INPUT_PANEL_BUTTON:
      inputPanelButtonClicked();
      break;
    default:
      throw new IllegalArgumentException("Unknown button name: "
          + ev.getButtonName());
@@ -445,6 +449,17 @@
  }
  /**
   * This method tries to update the visibility of the steps panel.  The
   * contents are updated because the user clicked in one of the buttons
   * that could make the steps panel to change.
   *
   */
  private void inputPanelButtonClicked()
  {
    getDialog().getStepsPanel().updateStepVisibility(this);
  }
  /**
   * Method called when we want to quit the setup (for instance when the user
   * clicks on 'Close' or 'Quit' buttons and has confirmed that (s)he wants to
   * quit the program.
opends/src/quicksetup/org/opends/quicksetup/ui/StepsPanel.java
@@ -96,7 +96,22 @@
              UIFactory.TextStyle.NOT_CURRENT_STEP);
        }
      }
      setStepVisible(s, getApplication().isVisible(s));
      setStepVisible(s, getApplication().isVisible(s, userData));
    }
  }
  /**
   * Updates the visiblitiy of the steps depending on the current contents
   * of the panels (uses the QuickSetup to know what is displayed in the
   * panels).
   *
   * @param qs the QuickSetup object.
   */
  public void updateStepVisibility(QuickSetup qs)
  {
    for (WizardStep s : getApplication().getWizardSteps())
    {
      setStepVisible(s, getApplication().isVisible(s, qs));
    }
  }