Beispiel #1
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);
          }
        }
Beispiel #2
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();
          }
        });
  }