Class WizardableController<T extends java.util.Optional<?>>

java.lang.Object
bayern.steinbrecher.wizard.WizardableController<T>
Type Parameters:
T - The type of the result represented by this controller.

public abstract class WizardableController<T extends java.util.Optional<?>>
extends java.lang.Object
Represents a controller of a WizardableView.
Author:
Stefan Huber
  • Property Summary

    Properties 
    Type Property Description
    javafx.beans.property.ObjectProperty<javafx.stage.Stage> stage
    Returns the property holding the currently set Stage.
    javafx.beans.property.ReadOnlyBooleanProperty valid
    A property indicating whether all input handled by this controller is valid.
  • Constructor Summary

    Constructors 
    Constructor Description
    WizardableController()  
  • Method Summary

    Modifier and Type Method Description
    protected void bindValidProperty​(javafx.beans.value.ObservableValue<? extends java.lang.Boolean> binding)  
    protected abstract T calculateResult()
    Calculates the actual result if any.
    T getResult()
    Returns the current result that the content of the page represents.
    javafx.stage.Stage getStage()
    Returns the currently set Stage.
    boolean hasUserAbborted()
    Checks whether the user aborted his input.
    boolean isValid()
    Gets the value of the property valid.
    void setStage​(javafx.stage.Stage stage)
    Sets the stage the controller can refer to.
    javafx.beans.property.ObjectProperty<javafx.stage.Stage> stageProperty()
    Returns the property holding the currently set Stage.
    javafx.beans.property.ReadOnlyBooleanProperty validProperty()
    A property indicating whether all input handled by this controller is valid.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Property Details

    • valid

      public javafx.beans.property.ReadOnlyBooleanProperty validProperty
      A property indicating whether all input handled by this controller is valid.
      See Also:
      isValid()
    • stage

      public javafx.beans.property.ObjectProperty<javafx.stage.Stage> stageProperty
      Returns the property holding the currently set Stage.
      Returns:
      The property holding the currently set Stage.
  • Constructor Details

  • Method Details

    • getResult

      public T getResult()
      Returns the current result that the content of the page represents.
      Returns:
      Iff the user aborted the wizard or the content of this page is invalid this method returns Optional.empty(). Otherwise it returns the represented result.
    • calculateResult

      protected abstract T calculateResult()
      Calculates the actual result if any. It does not recognize any criteria about whether to return a result or not. This is handled by getResult().
      Returns:
      The actual result if any.
      See Also:
      getResult()
    • validProperty

      public javafx.beans.property.ReadOnlyBooleanProperty validProperty()
      A property indicating whether all input handled by this controller is valid.
      See Also:
      isValid()
    • isValid

      public boolean isValid()
      Gets the value of the property valid.
      Property description:
      A property indicating whether all input handled by this controller is valid.
    • bindValidProperty

      protected void bindValidProperty​(javafx.beans.value.ObservableValue<? extends java.lang.Boolean> binding)
    • stageProperty

      public javafx.beans.property.ObjectProperty<javafx.stage.Stage> stageProperty()
      Returns the property holding the currently set Stage.
      Returns:
      The property holding the currently set Stage.
    • setStage

      public void setStage​(javafx.stage.Stage stage)
      Sets the stage the controller can refer to. (E.g. for closing the stage) NOTE: It overrides Window.onCloseRequest.
      Parameters:
      stage - The stage to refer to.
    • getStage

      public javafx.stage.Stage getStage()
      Returns the currently set Stage.
      Returns:
      The currently set Stage.
    • hasUserAbborted

      public boolean hasUserAbborted()
      Checks whether the user aborted his input.
      Returns:
      true only if the user aborted his input explicitly.