Class FXMLDialogWrapper<ReturnType,Controller extends javafx.fxml.Initializable>
- java.lang.Object
-
- com.jgcomptech.tools.dialogs.FXMLDialogWrapper<ReturnType,Controller>
-
- 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.ObjectLoads 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 booleanequals(java.lang.Object o)ControllergetController()Returns the controller associated with theDialog.voidgetController(javafx.fxml.Initializable controller)Defines the controller associated with theDialog.javafx.scene.control.Dialog<ReturnType>getDialog()Returns theDialogas aDialogobject.javafx.scene.image.ImagegetIcon()Returns the icon image for theDialogthat is used in the window decorations and when minimized.javafx.fxml.FXMLLoadergetLoader()Returns theFXMLLoaderthat was used to load theDialog.javafx.stage.StagegetOwner()Returns the owner Window for thisDialog, or null for a top-level, unowned stage.java.lang.StringgetTitle()Returns the title of theDialog.inthashCode()booleanisAlwaysOnTop()Returns whether thisDialogis kept on top of other windows.voidsetAlwaysOnTop(boolean value)Defines whether thisDialogis kept on top of other windows.voidsetIcon(javafx.scene.image.Image value)Defines the icon image for theDialogto be used in the window decorations and when minimized.voidsetOwner(javafx.stage.Stage value)Defines the owner Window for thisDialog, or null for a top-level, unowned stage.voidsetTitle(java.lang.String value)Defines the title of theDialog.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.StringtoString()
-
-
-
Constructor Detail
-
FXMLDialogWrapper
public FXMLDialogWrapper(java.lang.String fxmlPath) throws java.io.IOExceptionCreates 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.IOExceptionCreates an instance of a dialog and sets the specified title and fxml file path.- Parameters:
title- the titlefxmlPath- 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.IOExceptionCreates 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 minimizedfxmlPath- 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.IOExceptionCreates an instance of a dialog and sets the specified owner and fxml file path.- Parameters:
owner- the owner WindowfxmlPath- 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.IOExceptionCreates 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 minimizedowner- the owner WindowfxmlPath- 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.IOExceptionCreates an instance of a dialog and sets the specified title, owner and fxml file path.- Parameters:
title- the titleowner- the owner WindowfxmlPath- 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.IOExceptionCreates an instance of a dialog and sets the specified title, icon and fxml file path.- Parameters:
title- the titleicon- the icon image for the to be used in the window decorations and when minimizedfxmlPath- 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.IOExceptionCreates an instance of a dialog and sets the specified title, icon, owner and fxml file path.- Parameters:
title- the titleicon- the icon image for the to be used in the window decorations and when minimizedowner- the owner WindowfxmlPath- 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 theFXMLLoaderthat was used to load theDialog.- Returns:
- the
FXMLLoaderobject
-
getDialog
public javafx.scene.control.Dialog<ReturnType> getDialog()
Returns theDialogas aDialogobject.- Returns:
- the
Dialogobject
-
getController
public Controller getController()
Returns the controller associated with theDialog.- Returns:
- the
Controllerobject
-
getController
public void getController(javafx.fxml.Initializable controller)
Defines the controller associated with theDialog.- Parameters:
controller- theControllerobject
-
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
Optionalthat contains the result. Refer to theDialogclass 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 theDialog.- Parameters:
value- the title to set.
-
setIcon
public void setIcon(javafx.scene.image.Image value)
Defines the icon image for theDialogto 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 thisDialog, 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 thisDialogis 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 theDialog.- Returns:
- the title
-
getIcon
public javafx.scene.image.Image getIcon()
Returns the icon image for theDialogthat 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 thisDialog, or null for a top-level, unowned stage.- Returns:
- the owner for this dialog.
-
isAlwaysOnTop
public boolean isAlwaysOnTop()
Returns whether thisDialogis 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:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-