Class DialogService
java.lang.Object
de.spiritscorp.datasync.gui.DialogService
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 Summary
ConstructorsConstructorDescriptionDialogService(javafx.stage.Stage stage) Constructs a new DialogService bound to a specific primary window stage. -
Method Summary
Modifier and TypeMethodDescriptionbooleanpromptOkChancel(String title, String header, String content) Displays a modal confirmation dialog requesting an OK or Cancel decision from the user.promptTextInput(String title, String header, String content) Dispatches a modal text input dialog to capture a textual response from the user.booleanpromptYesNo(String title, String header, String content) Displays a modal confirmation dialog requesting a Yes or No decision from the user.
-
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
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 windowheader- The contextual header text of the notificationcontent- The message body containing instructions or questions- Returns:
- true if the user confirmed via OK, false if canceled, dismissed, or closed
-
promptYesNo
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 windowheader- The contextual header text of the notificationcontent- The message body containing instructions or questions- Returns:
- true if the user confirmed via YES, false if denied, dismissed, or closed
-
promptTextInput
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 windowheader- The contextual header text of the notificationcontent- The descriptive label text guiding the user input- Returns:
- The sanitized string captured from the input field, or an empty string if dismissed
-