java.lang.Object
edu.ntnu.idatt2001.carljgu.client.dialogs.DialogBoxBuilder

public class DialogBoxBuilder extends Object
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 Details

    • recurringDialogMessage

      public static final String recurringDialogMessage
      See Also:
    • alertType

      private javafx.scene.control.Alert.AlertType alertType
    • title

      private String title
    • message

      private String message
    • image

      private javafx.scene.image.Image image
    • listMessages

      private List<String> 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

      public DialogBox 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

      public DialogBoxBuilder setTitle(String title)
      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

      public DialogBoxBuilder setHeader(String header)
      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

      public DialogBoxBuilder setMessage(String message)
      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

      public DialogBoxBuilder setImage(String imageName)
      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

      public DialogBoxBuilder setListMessage(List<String> listMessages)
      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

      public String getTitle()
      Gets the title of the dialog box.
      Returns:
      title - String - the dialog box' title
    • getHeader

      public String getHeader()
      Gets the header for the dialog box.
      Returns:
      header - String - the dialog box' header
    • getMessage

      public String 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

      public List<String> getListMessages()
      Gets the list message for the dialog box.
      Returns:
      listMessages - List - the dialog box' list of messages