@Nonnull
 static WizardFlow newFirstTimeWizardFlow() {
   final List<WizardStep> wizardSteps = new ArrayList<WizardStep>();
   for (WizardStep wizardStep : CalculatorWizardStep.values()) {
     if (wizardStep.isVisible()) {
       wizardSteps.add(wizardStep);
     }
   }
   return new ListWizardFlow(wizardSteps);
 }
 @Nonnull
 static WizardFlow newDefaultWizardFlow() {
   final List<WizardStep> wizardSteps = new ArrayList<WizardStep>();
   for (WizardStep wizardStep : CalculatorWizardStep.values()) {
     if (wizardStep != welcome && wizardStep != last && wizardStep.isVisible()) {
       wizardSteps.add(wizardStep);
     }
   }
   return new ListWizardFlow(wizardSteps);
 }
  public void goToWizardStep(WizardStep step) {
    currentStep = step;
    view.showPrevButton(step.hasPrev());
    view.showNextButton(step.hasNext());

    switch (step) {
      case START:
        view.showStartStep(budget);
        break;
      case INCOMES:
        view.showIncomesStep(budget);
        break;
      case EXPENSES:
        view.showExpensesStep(budget);
        break;
      case FINISH:
        view.showFinishStep(budget);
        break;
      default:
        break;
    }
  }
 public void goPrevStep() {
   if (currentStep.hasPrev()) {
     goToWizardStep(currentStep.getPrev());
   }
 }
 public void goNextStep() {
   if (currentStep.hasNext()) {
     goToWizardStep(currentStep.getNext());
   }
 }
示例#6
0
  public WizardStep getStage(String stage) {

    final WhatsNew _this = this;

    WizardStep ws = new WizardStep();

    int ind = stage.indexOf(":");

    Version v = new Version(stage.substring(0, ind));

    int lind = Integer.parseInt(stage.substring(ind + 1));

    java.util.List<WhatsNewItem> its = this.items.get(v);

    if (its == null) {

      return null;
    }

    WhatsNewItem item = its.get(lind);

    if (item == null) {

      return null;
    }

    ws.title = item.title;
    ws.helpText = this.getFirstHelpText();

    if ((item.description != null) || (item.component != null)) {

      final Box b = new Box(BoxLayout.Y_AXIS);

      if (item.description != null) {

        JTextPane hp = UIUtils.createHelpTextPane(item.description, this.projectViewer);

        hp.setBorder(null);
        hp.setSize(new Dimension(UIUtils.getPopupWidth() - 25, 500));

        Box hpb = new Box(BoxLayout.Y_AXIS);
        hpb.add(hp);
        hpb.setMaximumSize(hpb.getPreferredSize());
        hpb.setBorder(UIUtils.createPadding(0, 5, 0, 0));
        b.add(hpb);
      }

      if (item.component != null) {

        if (item.description != null) {

          b.add(Box.createVerticalStrut(5));
        }

        item.component.setAlignmentY(Component.TOP_ALIGNMENT);
        item.component.setBorder(UIUtils.createPadding(5, 10, 0, 0));

        b.add(item.component);
      }

      b.add(Box.createVerticalGlue());

      ws.panel = b;
    }

    return ws;
  }