Class DialogBoxBuilder
java.lang.Object
edu.ntnu.idatt2001.carljgu.client.dialogs.DialogBoxBuilder
A builder class which simplifies the process of
building a DialogBox object. Using a builder makes it easy
to create complex dialogs while still avoiding
the telescoping constructors problem.
It also makes it easier to add attributes in the future.
- Version:
- 1.2 01.05.2022
- Author:
- Carl Gützkow
-
Field Summary
-
Constructor Summary
ConstructorDescriptionDialogBoxBuilder
(javafx.scene.control.Alert.AlertType alertType) Instantiates a new dialog box builder. -
Method Summary
Modifier and TypeMethodDescriptionbuild()
Create the dialog box with the current configurations from this builder object.javafx.scene.control.Alert.AlertType
Gets the alert type for the dialog box.Gets the header for the dialog box.javafx.scene.image.Image
getImage()
Gets the image for the dialog box.Gets the list message for the dialog box.Gets the message for the dialog box.getTitle()
Gets the title of the dialog box.Add header to the dialog box builder configuration.Add image to the dialog box builder configuration.setListMessage
(List<String> listMessages) Adds a list message for the dialog box.setMessage
(String message) Set message to the dialog box builder configuration.Set title to the dialog box builder configuration.
-
Field Details
-
recurringDialogMessage
- See Also:
-
alertType
private javafx.scene.control.Alert.AlertType alertType -
title
-
header
-
message
-
image
private javafx.scene.image.Image image -
listMessages
-
-
Constructor Details
-
DialogBoxBuilder
public DialogBoxBuilder(javafx.scene.control.Alert.AlertType alertType) Instantiates a new dialog box builder. Sets the title and message to a default. They are still optional to set.- Parameters:
alertType
- AlertType - enum from inside the Alert class. Either ERROR, INFORMATION, NONE, CONFIRMATION or WARNING
-
-
Method Details
-
build
Create the dialog box with the current configurations from this builder object.- Returns:
- dialogBox - DialogBox - a dialog box with this builder's configurations.
-
setTitle
Set title to the dialog box builder configuration. The title is displayed on the top of the window.- Parameters:
title
- String - the title of the dialog box- Returns:
- dialogBoxBuilder - DialogBoxBuilder - returned to add further configurations.
-
setHeader
Add header to the dialog box builder configuration. A header is displayed above the message- Parameters:
header
- String - the header of the dialog box- Returns:
- dialogBoxBuilder - DialogBoxBuilder - returned to add further configurations.
-
setMessage
Set message to the dialog box builder configuration.- Parameters:
message
- String - the message of the dialog box- Returns:
- dialogBoxBuilder - DialogBoxBuilder - returned to add further configurations.
-
setImage
Add image to the dialog box builder configuration. The image is displayed as both the window icon and on the actual scene.- Parameters:
imageName
- String - the name of the image to display.- Returns:
- dialogBoxBuilder - DialogBoxBuilder - returned to add further configurations.
-
setListMessage
Adds a list message for the dialog box.- Parameters:
listMessages
- - List - the dialog box' list of messages- Returns:
- dialogBoxBuilder - DialogBoxBuilder - returned to add further configurations.
-
getAlertType
public javafx.scene.control.Alert.AlertType getAlertType()Gets the alert type for the dialog box.- Returns:
- alertType - AlertType - enum from inside the Alert class. Either ERROR, INFORMATION, NONE, CONFIRMATION or WARNING
-
getTitle
Gets the title of the dialog box.- Returns:
- title - String - the dialog box' title
-
getHeader
Gets the header for the dialog box.- Returns:
- header - String - the dialog box' header
-
getMessage
Gets the message for the dialog box.- Returns:
- message - String - the dialog box' message
-
getImage
public javafx.scene.image.Image getImage()Gets the image for the dialog box.- Returns:
- image - Image - the dialog box' icon and image
-
getListMessages
Gets the list message for the dialog box.- Returns:
- listMessages - List - the dialog box' list of messages
-