Class FXMLDialogWrapper<ReturnType,​Controller extends javafx.fxml.Initializable>

  • Type Parameters:
    ReturnType - the class type to be returned when the dialog is closed.
    Controller - the controller class to be used for the dialog.

    public final class FXMLDialogWrapper<ReturnType,​Controller extends javafx.fxml.Initializable>
    extends java.lang.Object
    Loads a dialog using the specified JavaFX fxml file.
    Since:
    1.3.1
    • Constructor Summary

      Constructors 
      Constructor Description
      FXMLDialogWrapper​(java.lang.String fxmlPath)
      Creates an instance of a dialog and sets the specified fxml file path.
      FXMLDialogWrapper​(java.lang.String title, java.lang.String fxmlPath)
      Creates an instance of a dialog and sets the specified title and fxml file path.
      FXMLDialogWrapper​(java.lang.String title, javafx.scene.image.Image icon, java.lang.String fxmlPath)
      Creates an instance of a dialog and sets the specified title, icon and fxml file path.
      FXMLDialogWrapper​(java.lang.String title, javafx.scene.image.Image icon, javafx.stage.Stage owner, java.lang.String fxmlPath)
      Creates an instance of a dialog and sets the specified title, icon, owner and fxml file path.
      FXMLDialogWrapper​(java.lang.String title, javafx.stage.Stage owner, java.lang.String fxmlPath)
      Creates an instance of a dialog and sets the specified title, owner and fxml file path.
      FXMLDialogWrapper​(javafx.scene.image.Image icon, java.lang.String fxmlPath)
      Creates an instance of a dialog and sets the specified icon and fxml file path.
      FXMLDialogWrapper​(javafx.scene.image.Image icon, javafx.stage.Stage owner, java.lang.String fxmlPath)
      Creates an instance of a dialog and sets the specified icon, owner and fxml file path.
      FXMLDialogWrapper​(javafx.stage.Stage owner, java.lang.String fxmlPath)
      Creates an instance of a dialog and sets the specified owner and fxml file path.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object o)  
      Controller getController()
      Returns the controller associated with the Dialog.
      void getController​(javafx.fxml.Initializable controller)
      Defines the controller associated with the Dialog.
      javafx.scene.control.Dialog<ReturnType> getDialog()
      Returns the Dialog as a Dialog object.
      javafx.scene.image.Image getIcon()
      Returns the icon image for the Dialog that is used in the window decorations and when minimized.
      javafx.fxml.FXMLLoader getLoader()
      Returns the FXMLLoader that was used to load the Dialog.
      javafx.stage.Stage getOwner()
      Returns the owner Window for this Dialog, or null for a top-level, unowned stage.
      java.lang.String getTitle()
      Returns the title of the Dialog.
      int hashCode()  
      boolean isAlwaysOnTop()
      Returns whether this Dialog is kept on top of other windows.
      void setAlwaysOnTop​(boolean value)
      Defines whether this Dialog is kept on top of other windows.
      void setIcon​(javafx.scene.image.Image value)
      Defines the icon image for the Dialog to be used in the window decorations and when minimized.
      void setOwner​(javafx.stage.Stage value)
      Defines the owner Window for this Dialog, or null for a top-level, unowned stage.
      void setTitle​(java.lang.String value)
      Defines the title of the Dialog.
      java.util.Optional<ReturnType> showAndWait()
      Shows the dialog and waits for the user response (in other words, brings up a blocking dialog, with the returned value the users input).
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • FXMLDialogWrapper

        public FXMLDialogWrapper​(java.lang.String fxmlPath)
                          throws java.io.IOException
        Creates an instance of a dialog and sets the specified fxml file path.
        Parameters:
        fxmlPath - the path of the fxml file
        Throws:
        java.io.IOException - if fxml file fails to load
      • FXMLDialogWrapper

        public FXMLDialogWrapper​(java.lang.String title,
                                 java.lang.String fxmlPath)
                          throws java.io.IOException
        Creates an instance of a dialog and sets the specified title and fxml file path.
        Parameters:
        title - the title
        fxmlPath - the path of the fxml file
        Throws:
        java.io.IOException - if fxml file fails to load
      • FXMLDialogWrapper

        public FXMLDialogWrapper​(javafx.scene.image.Image icon,
                                 java.lang.String fxmlPath)
                          throws java.io.IOException
        Creates an instance of a dialog and sets the specified icon and fxml file path.
        Parameters:
        icon - the icon image for the to be used in the window decorations and when minimized
        fxmlPath - the path of the fxml file
        Throws:
        java.io.IOException - if fxml file fails to load
      • FXMLDialogWrapper

        public FXMLDialogWrapper​(javafx.stage.Stage owner,
                                 java.lang.String fxmlPath)
                          throws java.io.IOException
        Creates an instance of a dialog and sets the specified owner and fxml file path.
        Parameters:
        owner - the owner Window
        fxmlPath - the path of the fxml file
        Throws:
        java.io.IOException - if fxml file fails to load
      • FXMLDialogWrapper

        public FXMLDialogWrapper​(javafx.scene.image.Image icon,
                                 javafx.stage.Stage owner,
                                 java.lang.String fxmlPath)
                          throws java.io.IOException
        Creates an instance of a dialog and sets the specified icon, owner and fxml file path.
        Parameters:
        icon - the icon image for the to be used in the window decorations and when minimized
        owner - the owner Window
        fxmlPath - the path of the fxml file
        Throws:
        java.io.IOException - if fxml file fails to load
      • FXMLDialogWrapper

        public FXMLDialogWrapper​(java.lang.String title,
                                 javafx.stage.Stage owner,
                                 java.lang.String fxmlPath)
                          throws java.io.IOException
        Creates an instance of a dialog and sets the specified title, owner and fxml file path.
        Parameters:
        title - the title
        owner - the owner Window
        fxmlPath - the path of the fxml file
        Throws:
        java.io.IOException - if fxml file fails to load
      • FXMLDialogWrapper

        public FXMLDialogWrapper​(java.lang.String title,
                                 javafx.scene.image.Image icon,
                                 java.lang.String fxmlPath)
                          throws java.io.IOException
        Creates an instance of a dialog and sets the specified title, icon and fxml file path.
        Parameters:
        title - the title
        icon - the icon image for the to be used in the window decorations and when minimized
        fxmlPath - the path of the fxml file
        Throws:
        java.io.IOException - if fxml file fails to load
      • FXMLDialogWrapper

        public FXMLDialogWrapper​(java.lang.String title,
                                 javafx.scene.image.Image icon,
                                 javafx.stage.Stage owner,
                                 java.lang.String fxmlPath)
                          throws java.io.IOException
        Creates an instance of a dialog and sets the specified title, icon, owner and fxml file path.
        Parameters:
        title - the title
        icon - the icon image for the to be used in the window decorations and when minimized
        owner - the owner Window
        fxmlPath - the path of the fxml file
        Throws:
        java.io.IOException - if fxml file fails to load
    • Method Detail

      • getLoader

        public javafx.fxml.FXMLLoader getLoader()
        Returns the FXMLLoader that was used to load the Dialog.
        Returns:
        the FXMLLoader object
      • getDialog

        public javafx.scene.control.Dialog<ReturnType> getDialog()
        Returns the Dialog as a Dialog object.
        Returns:
        the Dialog object
      • getController

        public Controller getController()
        Returns the controller associated with the Dialog.
        Returns:
        the Controller object
      • getController

        public void getController​(javafx.fxml.Initializable controller)
        Defines the controller associated with the Dialog.
        Parameters:
        controller - the Controller object
      • showAndWait

        public java.util.Optional<ReturnType> showAndWait()
        Shows the dialog and waits for the user response (in other words, brings up a blocking dialog, with the returned value the users input).

        This method must be called on the JavaFX Application thread. Additionally, it must either be called from an input event handler or From the run method of a Runnable passed to Platform.runLater. It must not be called during animation or layout processing.

        Returns:
        An Optional that contains the result. Refer to the Dialog class documentation for more detail.
        Throws:
        java.lang.IllegalStateException - if this method is called on a thread other than the JavaFX Application Thread.
        java.lang.IllegalStateException - if this method is called during animation or layout processing.
      • setTitle

        public void setTitle​(java.lang.String value)
        Defines the title of the Dialog.
        Parameters:
        value - the title to set.
      • setIcon

        public void setIcon​(javafx.scene.image.Image value)
        Defines the icon image for the Dialog to be used in the window decorations and when minimized.
        Parameters:
        value - the icon image
      • setOwner

        public void setOwner​(javafx.stage.Stage value)
        Defines the owner Window for this Dialog, or null for a top-level, unowned stage. This must be done prior to making the stage visible.
        Parameters:
        value - the owner for this dialog.
        Throws:
        java.lang.IllegalStateException - if this property is set after the stage has ever been made visible.
        java.lang.IllegalStateException - if this stage is the primary stage.
      • setAlwaysOnTop

        public void setAlwaysOnTop​(boolean value)
        Defines whether this Dialog is kept on top of other windows.

        If some other window is already always-on-top then the relative order between these windows is unspecified (depends on platform).

        There are differences in behavior between applications if a security manager is present. Applications with permissions are allowed to set "always on top" flag on a Stage. In applications without the proper permissions, an attempt to set the flag will be ignored and the property value will be restored to "false".

        Parameters:
        value - the value to set.
      • getTitle

        public java.lang.String getTitle()
        Returns the title of the Dialog.
        Returns:
        the title
      • getIcon

        public javafx.scene.image.Image getIcon()
        Returns the icon image for the Dialog that is used in the window decorations and when minimized.
        Returns:
        the icon image, null if no icon exists
      • getOwner

        public javafx.stage.Stage getOwner()
        Returns the owner Window for this Dialog, or null for a top-level, unowned stage.
        Returns:
        the owner for this dialog.
      • isAlwaysOnTop

        public boolean isAlwaysOnTop()
        Returns whether this Dialog is kept on top of other windows.

        If some other window is already always-on-top then the relative order between these windows is unspecified (depends on platform).

        There are differences in behavior between applications if a security manager is present. Applications with permissions are allowed to set "always on top" flag on a Stage. In applications without the proper permissions, an attempt to set the flag will be ignored and the property value will be restored to "false".

        Returns:
        if dialog is kept on top of other windows
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object