예제 #1
0
 protected void navToNextPage() {
   final WizardPage currentPage = getCurrentPage();
   if (hasNextPage() && currentPage != null) {
     final WizardPage nextPage = currentPage.getNextPage();
     if (nextPage != null) navTo(nextPage, true);
   }
 }
예제 #2
0
  private void hideFinishingPage() {
    finishingPage.setVisible(false);
    getChildren().remove(finishingPage);
    getChildren().add(0, finishingPage);

    final WizardPage currentPage = getCurrentPage();
    if (currentPage != null) currentPage.setVisible(true);
  }
예제 #3
0
  public void registerWizardPage(final WizardPage wizardPage) {
    assertNotNull("wizardPage", wizardPage);

    if (wizardPage.getWizard() != null) wizardPage.setWizard(this);

    if (knownPages.containsKey(wizardPage)) return;

    wizardPage.completeProperty().addListener(updateCanFinishInvalidationListener);
    knownPages.put(wizardPage, null);
    wizardPage.setVisible(false);
    getChildren().add(0, wizardPage);
  }
예제 #4
0
  protected void updateCanFinish() {
    boolean canFinish = true;

    for (WizardPage wizardPage : history) {
      if (!wizardPage.completeProperty().getValue()) canFinish = false;
    }

    WizardPage wizardPage = getCurrentPage();
    while (wizardPage != null) {
      if (!wizardPage.completeProperty().getValue()) canFinish = false;

      wizardPage = wizardPage.getNextPage();
    }

    this.canFinish.set(canFinish);
  }
예제 #5
0
        @Override
        public void set(final WizardPage newValue) {
          final WizardPage oldValue = get();
          super.set(newValue);

          if (getCurrentPage() == oldValue) setCurrentPage(null);

          //			if (oldValue != null)
          //				getChildren().remove(oldValue); // TODO is this really needed? and if so, shouldn't
          // we remove all other pages?

          if (newValue != null) {
            newValue.setWizard(Wizard.this);
            newValue.updateButtonsDisable();

            if (getCurrentPage() == null) navTo(newValue, false);
          }
        }
예제 #6
0
  protected void navTo(final WizardPage wizardPage, boolean addToHistory) {
    assertNotNull("wizardPage", wizardPage);
    PlatformUtil.assertFxApplicationThread();

    {
      WizardPage currentPage = getCurrentPage();
      if (currentPage != null) currentPage.onHidden();

      if (currentPage != null && addToHistory) history.addLast(currentPage);
    }

    setCurrentPage(wizardPage);
    for (Node child : getChildren()) child.setVisible(false);

    wizardPage.setVisible(true);
    getChildren().remove(wizardPage); // remove from z-order wherever it is (it might be missing!).
    getChildren().add(wizardPage); // re-add as last, which means top-most z-order.

    wizardPage.updateButtonsDisable();
    updateCanFinish();

    if (getParent() != null) getParent().requestFocus();

    this.requestFocus();
    wizardPage.requestFocus();

    Platform.runLater(
        new Runnable() {
          @Override
          public void run() {
            final Scene scene = getScene();
            final Window window = scene == null ? null : scene.getWindow();
            if (window != null) window.sizeToScene();

            if (getParent() != null) getParent().requestFocus();

            Wizard.this.requestFocus();
            wizardPage.requestFocus();
            wizardPage.onShown();
          }
        });
  }
예제 #7
0
  protected boolean hasNextPage() {
    final WizardPage currentPage = getCurrentPage();
    if (currentPage == null) return false;

    return currentPage.getNextPage() != null;
  }