Esempio n. 1
0
  void resetButtonsToPanelRules() {
    //  Reset the buttons to support the original panel rules,
    //  including whether the next or back buttons are enabled or
    //  disabled, or if the panel is finishable.

    WizardModel model = wizard.getModel();
    WizardPanelDescriptor descriptor = model.getCurrentPanelDescriptor();
    if (descriptor == null) return;

    //  If the panel in question has another panel behind it, enable
    //  the back button. Otherwise, disable it.
    if (descriptor.getBackPanelDescriptor() != null) wizard.setBackButtonEnabled(true);
    else wizard.setBackButtonEnabled(false);

    //  If the panel in question has one or more panels in front of it,
    //  enable the next button. Otherwise, disable it.
    if (descriptor.getNextPanelDescriptor() != null) wizard.setNextButtonEnabled(true);
    else wizard.setNextButtonEnabled(false);

    //  If the panel in question is the last panel in the series, change
    //  the Next button to Finish. Otherwise, set the text back to Next.
    if (descriptor.getNextPanelDescriptor() != null
        && descriptor.getNextPanelDescriptor().equals(WizardPanelDescriptor.FINISH_IDENTIFIER)) {
      wizard.setNextButtonText(Wizard.FINISH_TEXT);
    } else {
      wizard.setNextButtonText(Wizard.NEXT_TEXT);
    }
  }
  void resetButtonsToPanelRules() {
    WizardModel model = this.wizard.getModel();
    if (model != null) {
      model.setCancelButtonText("Cancel");
      model.setCancelButtonIcon(null);

      model.setBackButtonText("<Back");
      model.setBackButtonIcon(null);

      WizardPanelDescriptor descriptor = model.getCurrentPanel();

      if (descriptor != null && descriptor.getBackPanelDescriptor() != null)
        model.setBackButtonEnabled(Boolean.TRUE);
      else model.setBackButtonEnabled(Boolean.FALSE);

      if (descriptor != null && descriptor.getNextPanelDescriptor() != null)
        model.setNextButtonEnabled(Boolean.TRUE);
      else model.setNextButtonEnabled(Boolean.FALSE);

      if (descriptor != null
          && descriptor.getNextPanelDescriptor() != null
          && descriptor.getNextPanelDescriptor() instanceof Wizard.FinishIdentifier) {
        model.setNextButtonText("Finish");
        model.setNextButtonIcon(null);
      } else {
        model.setNextButtonText("Next>");
        model.setNextButtonIcon(null);
      }
    }
  }
 private void nextButtonPressed() {
   WizardModel model = this.wizard.getModel();
   if (model != null && model.getCurrentPanel() != null) {
     WizardPanelDescriptor descriptor = model.getCurrentPanel();
     Object nextPanelDescriptor = descriptor.getNextPanelDescriptor();
     if (nextPanelDescriptor != null && nextPanelDescriptor instanceof Wizard.FinishIdentifier) {
       this.wizard.close(Wizard.FINISH_RETURN_CODE);
     } else {
       this.wizard.setCurrentPanelDescriptor(nextPanelDescriptor);
     }
   }
 }
Esempio n. 4
0
  /** go to the next panel */
  private void nextButtonPressed() {
    WizardModel model = wizard.getModel();
    WizardPanelDescriptor descriptor = model.getCurrentPanelDescriptor();

    //  If it is a finishable panel, close down the dialog. Otherwise,
    //  get the ID that the current panel identifies as the next panel,
    //  and display it.

    String nextPanelDescriptor = descriptor.getNextPanelDescriptor();

    if (nextPanelDescriptor.equals(WizardPanelDescriptor.FINISH_IDENTIFIER)) {
      wizard.close(Wizard.FINISH_RETURN_CODE);
    } else {
      try {
        wizard.setCurrentPanel(nextPanelDescriptor);
      } catch (Exception e) {
        e.printStackTrace();
      }
    }
  }