Class Modals.ModalBuilder<T extends javafx.scene.Parent>

java.lang.Object
org.fulib.fx.constructs.Modals.ModalBuilder<T>
Type Parameters:
T - The type of the component
Enclosing class:
Modals

public static class Modals.ModalBuilder<T extends javafx.scene.Parent> extends Object
Builder class for displaying modals.
  • Constructor Details

    • ModalBuilder

      public ModalBuilder(FulibFxApp app, T component)
  • Method Details

    • init

      public Modals.ModalBuilder<T> init(BiConsumer<javafx.stage.Stage,T> initializer)
      Adds an initializer.

      If another initializer has been added already, the new initializer will be called after the previous one.

      Parameters:
      initializer - The initializer to add
      Returns:
      The current modal instance
    • owner

      public Modals.ModalBuilder<T> owner(javafx.stage.Stage owner)
      Sets the owner stage.

      If the owner stage is closed, the modal will be closed as well.

      If no owner is set, the FulibFxApp.stage() will be used.

      Parameters:
      owner - The owner stage.
      Returns:
      The current modal instance
    • dialog

      public Modals.ModalBuilder<T> dialog(boolean dialog)
      Adds a pre-made initializer with some default options regarding transparency and modality.

      This will set the stage style to StageStyle.TRANSPARENT, the modality to Modality.WINDOW_MODAL and the scene fill to transparent (see FULIBFX_DIALOG).

      Parameters:
      dialog - Whether the default dialog options should be used
      Returns:
      The current modal instance
    • params

      public Modals.ModalBuilder<T> params(Map<String,Object> params)
      Sets the parameters to be used when initializing/rendering the component.

      The default parameters "modalStage" and "ownerStage" will be added automatically if they are not present already. The modal stage is the current modal stage and the owner stage is the stage that opened the modal (see owner(Stage)).

      Parameters:
      params - The parameter map
      Returns:
      The current modal instance
    • destroyOnClose

      public Modals.ModalBuilder<T> destroyOnClose(boolean destroyOnClose)
    • build

      public javafx.stage.Stage build()
      Builds the stage for the current modal.

      This can only be called once per modal builder.

      Returns:
      The stage for the current modal
    • show

      public javafx.stage.Stage show()
      Builds and displays the stage for the current modal.

      This can only be called once per modal builder.

      Returns:
      The stage for the current modal