Class DialogService

java.lang.Object
de.spiritscorp.datasync.gui.DialogService

public class DialogService extends Object
Service responsible for managing UI dialogs and alerts. Ensures strict thread safety by bridging background thread calls to the JavaFX Application Thread.
Author:
Tom Spirit
  • Constructor Details

    • DialogService

      public DialogService(javafx.stage.Stage stage)
      Constructs a new DialogService bound to a specific primary window stage.
      Parameters:
      stage - The parent stage container, must not be null
      Throws:
      NoSuchElementException - if the provided stage is null
  • Method Details

    • promptOkChancel

      public boolean promptOkChancel(String title, String header, String content)
      Displays a modal confirmation dialog requesting an OK or Cancel decision from the user. Automatically handles cross-thread invocations without throwing structural exceptions.
      Parameters:
      title - The descriptive title of the dialog window
      header - The contextual header text of the notification
      content - The message body containing instructions or questions
      Returns:
      true if the user confirmed via OK, false if canceled, dismissed, or closed
    • promptYesNo

      public boolean promptYesNo(String title, String header, String content)
      Displays a modal confirmation dialog requesting a Yes or No decision from the user. Automatically handles cross-thread invocations without throwing structural exceptions.
      Parameters:
      title - The descriptive title of the dialog window
      header - The contextual header text of the notification
      content - The message body containing instructions or questions
      Returns:
      true if the user confirmed via YES, false if denied, dismissed, or closed
    • promptTextInput

      public String promptTextInput(String title, String header, String content)
      Dispatches a modal text input dialog to capture a textual response from the user. This method blocks the calling thread and safely orchestrates thread switches if invoked outside the primary JavaFX Application Thread.
      Parameters:
      title - The descriptive title of the dialog window
      header - The contextual header text of the notification
      content - The descriptive label text guiding the user input
      Returns:
      The sanitized string captured from the input field, or an empty string if dismissed