java.lang.Object
page.codeberg.friedolyn.gui.GUI
A utility class to open different windows in the Friedolyn application.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final record
A record that represents the user's input in a dialog window.static enum
The windows/scenes/views that are available in the graphical user interface of the Friedolyn application. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic @NonNull GUI.DialogResult
<@NonNull ContactController.ContactResult> openContactDialog
(@NonNull Configuration configuration) Opens theGUI.Window.CONTACT
window to let the user send a message to the developers of the application.static @NonNull GUI.DialogResult
<@NonNull ContactController.ContactResult> openContactDialog
(@NonNull Configuration configuration, Friedolyn.ContactRequest contactRequest) Opens theGUI.Window.CONTACT
window to let the user send a message to the developers of the application.static @NonNull GUI.DialogResult
<@NonNull ContactMethods> openContactReplyDialogWindow
(@NonNull Configuration configuration) Opens theGUI.Window.CONTACT_REPLY_METHOD_DIALOG
window to let the user choose how the developers should reply to their contact request.static void
openContactWindow
(@NonNull Configuration configuration, boolean wait) Opens theGUI.Window.CONTACT
window to let the user contact the developers of the application.static void
openContactWindow
(ContactController.InitialisationParameters parameters, boolean wait) Opens theGUI.Window.SETUP
window to let the user set their preferences for the application.private static @NonNull GUI.DialogResult
<@NonNull Object> openDialogWindow
(@NonNull GUI.Window window, @NonNull Object parameters) Opens a dialog window and passes some parameters to its controller class.static void
openFirstLaunchWindow
(boolean wait) Opens theGUI.Window.FIRST_LAUNCH
window to let the user log in to Friedolin for the first time.static void
openMainWindow
(@NonNull Friedolyn friedolyn, boolean wait) Opens theGUI.Window.MAIN
window to let the user interact with the application.static @NonNull GUI.DialogResult
<@NonNull EMailNotifier> openSetupEmailDialogWindow
(@NonNull Configuration configuration) static @NonNull GUI.DialogResult
<@NonNull NtfyNotifier> openSetupNtfyDialogWindow
(@NonNull Configuration configuration) Opens a dialog window that asks the user to configure aNtfyNotifier
for push notifications.static void
openSetupNtfyDialogWindow
(@NonNull Configuration configuration, boolean wait) Opens theGUI.Window.SETUP_NTFY_DIALOG
window to let the user configure aNtfyNotifier
for push notifications.static @NonNull GUI.DialogResult
<@NonNull UnifiedPushNotifier> openSetupUnifiedPushDialogWindow
(@NonNull Configuration configuration) Opens a dialog window that asks the user to configure aUnifiedPushNotifier
for push notifications.static void
openSetupUnifiedPushDialogWindow
(@NonNull Configuration configuration, boolean wait) Opens theGUI.Window.SETUP_UNIFIED_PUSH_DIALOG
window to let the user configure aUnifiedPushNotifier
for push notifications.static GUI.DialogResult
<Friedolyn> openSetupWindow
(@NonNull Friedolyn friedolyn) Opens theGUI.Window.SETUP
window to let the user set their preferences for the application.static void
openWebsiteInDefaultBrowser
(@NonNull URL url) Opens a givenURL
in the default web browser of the user's operating system.private static void
openWindow
(@NonNull GUI.Window window, boolean wait) Shows a given FXML file as a new GUI window.private static void
openWindowWithParameter
(@NonNull GUI.Window window, @NonNull Object parameter, boolean wait) Opens aGUI.Window
and passes someObject
to its controller class.
-
Constructor Details
-
GUI
public GUI()
-
-
Method Details
-
openFirstLaunchWindow
public static void openFirstLaunchWindow(boolean wait) Opens theGUI.Window.FIRST_LAUNCH
window to let the user log in to Friedolin for the first time.- Parameters:
wait
- Whether to wait for the window to be closed before returning.
-
openSetupWindow
Opens theGUI.Window.SETUP
window to let the user set their preferences for the application.- Parameters:
friedolyn
- TheFriedolyn
object to pass to the controller class. Will be used to store the user's preferences.
-
openSetupNtfyDialogWindow
public static void openSetupNtfyDialogWindow(@NonNull @NonNull Configuration configuration, boolean wait) Opens theGUI.Window.SETUP_NTFY_DIALOG
window to let the user configure aNtfyNotifier
for push notifications.- Parameters:
configuration
- The configuration to pass to the controller class. Will be used as specified inSetupNtfyDialogController.prepare(page.codeberg.friedolyn.configuration.Configuration)
.wait
- Whether to wait for the window to be closed before returning.
-
openSetupUnifiedPushDialogWindow
public static void openSetupUnifiedPushDialogWindow(@NonNull @NonNull Configuration configuration, boolean wait) Opens theGUI.Window.SETUP_UNIFIED_PUSH_DIALOG
window to let the user configure aUnifiedPushNotifier
for push notifications.- Parameters:
configuration
- The configuration to pass to the controller class. Will be used as specified inSetupUnifiedPushDialogController.prepare(page.codeberg.friedolyn.configuration.Configuration)
.wait
- Whether to wait for the window to be closed before returning.
-
openMainWindow
Opens theGUI.Window.MAIN
window to let the user interact with the application.- Parameters:
friedolyn
- TheFriedolyn
object to pass to the controller class. Will be used as specified inMainController.prepare(page.codeberg.friedolyn.Friedolyn)
.wait
- Whether to wait for the window to be closed before returning.
-
openContactWindow
public static void openContactWindow(@NonNull ContactController.InitialisationParameters parameters, boolean wait) throws IllegalArgumentException Opens theGUI.Window.SETUP
window to let the user set their preferences for the application.- Parameters:
parameters
- The parameters to pass to the controller class.wait
- Whether to wait for the window to be closed before returning.- Throws:
IllegalArgumentException
- SeeContactController.prepare(page.codeberg.friedolyn.gui.controllers.ContactController.InitialisationParameters)
for more information.
-
openContactWindow
public static void openContactWindow(@NonNull @NonNull Configuration configuration, boolean wait) throws IllegalArgumentException Opens theGUI.Window.CONTACT
window to let the user contact the developers of the application.- Parameters:
configuration
- The configuration to be used byFriedolyn
.wait
- Whether to wait for the window to be closed before returning.- Throws:
IllegalArgumentException
- SeeContactController.prepare(page.codeberg.friedolyn.gui.controllers.ContactController.InitialisationParameters)
for more information.
-
openContactDialog
@NonNull public static @NonNull GUI.DialogResult<@NonNull ContactController.ContactResult> openContactDialog(@NonNull @NonNull Configuration configuration) throws IllegalArgumentException Opens theGUI.Window.CONTACT
window to let the user send a message to the developers of the application.- Parameters:
configuration
- The configuration to pass to the controller class. Will be used as specified inContactController.prepare(page.codeberg.friedolyn.gui.controllers.ContactController.InitialisationParameters)
.- Returns:
GUI.DialogResult.success()
will betrue
if the user clicked the "Send" button,false
otherwise.GUI.DialogResult.result()
will contain the user's message (if submitted).- Throws:
IllegalArgumentException
- SeeContactController.prepare(page.codeberg.friedolyn.gui.controllers.ContactController.InitialisationParameters)
for more information.
-
openContactDialog
@NonNull public static @NonNull GUI.DialogResult<@NonNull ContactController.ContactResult> openContactDialog(@NonNull @NonNull Configuration configuration, @NonNull Friedolyn.ContactRequest contactRequest) throws IllegalArgumentException Opens theGUI.Window.CONTACT
window to let the user send a message to the developers of the application.- Parameters:
configuration
- The configuration to pass to the controller class. Will be used as specified inContactController.prepare(page.codeberg.friedolyn.gui.controllers.ContactController.InitialisationParameters)
.contactRequest
- The reason why the user is contacting the developers.- Returns:
GUI.DialogResult.success()
will betrue
if the user clicked the "Send" button,false
otherwise.GUI.DialogResult.result()
will contain- the user's message
- the user's contact information
- Throws:
IllegalArgumentException
- SeeContactController.prepare(page.codeberg.friedolyn.gui.controllers.ContactController.InitialisationParameters)
for more information.
-
openContactReplyDialogWindow
@NonNull public static @NonNull GUI.DialogResult<@NonNull ContactMethods> openContactReplyDialogWindow(@NonNull @NonNull Configuration configuration) throws IllegalArgumentException Opens theGUI.Window.CONTACT_REPLY_METHOD_DIALOG
window to let the user choose how the developers should reply to their contact request.- Parameters:
configuration
- The configuration to pass to the controller class. Will be used as specified inContactReplyMethodDialogController.prepare(Configuration)
.- Returns:
GUI.DialogResult.success()
will betrue
if the user clicked the "OK" button,false
otherwise.GUI.DialogResult.result()
will contain thecontact methods
to use for replying to the user (if the user has specified any).- Throws:
IllegalArgumentException
- SeeContactReplyMethodDialogController.prepare(page.codeberg.friedolyn.configuration.Configuration)
for more information.
-
openSetupEmailDialogWindow
@NonNull public static @NonNull GUI.DialogResult<@NonNull EMailNotifier> openSetupEmailDialogWindow(@NonNull @NonNull Configuration configuration) throws IllegalArgumentException - Throws:
IllegalArgumentException
-
openSetupNtfyDialogWindow
@NonNull public static @NonNull GUI.DialogResult<@NonNull NtfyNotifier> openSetupNtfyDialogWindow(@NonNull @NonNull Configuration configuration) throws IllegalArgumentException Opens a dialog window that asks the user to configure aNtfyNotifier
for push notifications.- Parameters:
configuration
- The configuration to pass tothe controller class
. Will be used as specified in theprepare
method.- Returns:
- The user's input (if any).
- Throws:
IllegalArgumentException
- If the window could not be opened or if a critical error occurred while it was open.
-
openSetupUnifiedPushDialogWindow
@NonNull public static @NonNull GUI.DialogResult<@NonNull UnifiedPushNotifier> openSetupUnifiedPushDialogWindow(@NonNull @NonNull Configuration configuration) throws IllegalArgumentException Opens a dialog window that asks the user to configure aUnifiedPushNotifier
for push notifications.- Parameters:
configuration
- The configuration to pass tothe controller class
. Will be used as specified in theprepare
method.- Returns:
- The user's input (if any).
- Throws:
IllegalArgumentException
- If the window could not be opened or if a critical error occurred while it was open.
-
openDialogWindow
@NonNull private static @NonNull GUI.DialogResult<@NonNull Object> openDialogWindow(@NonNull @NonNull GUI.Window window, @NonNull @NonNull Object parameters) throws IllegalArgumentException Opens a dialog window and passes some parameters to its controller class.- Parameters:
window
- The FXML file to open.parameters
- The parameters to pass to the controller class.GUI.Window.MAIN
requires aFriedolyn
objectGUI.Window.SETUP_EMAIL_DIALOG
requires aConfiguration
objectGUI.Window.SETUP_NTFY_DIALOG
requires aConfiguration
objectGUI.Window.SETUP_UNIFIED_PUSH_DIALOG
requires aConfiguration
objectGUI.Window.CONTACT
requiresContactController.InitialisationParameters
GUI.Window.CONTACT_REPLY_METHOD_DIALOG
requires aConfiguration
object
- Returns:
- The user's input (if any).
- Throws:
IllegalArgumentException
- If the parameters are invalid.
-
openWindow
Shows a given FXML file as a new GUI window.- Parameters:
window
- The FXML file to open.
-
openWindowWithParameter
private static void openWindowWithParameter(@NonNull @NonNull GUI.Window window, @NonNull @NonNull Object parameter, boolean wait) throws IllegalArgumentException Opens aGUI.Window
and passes someObject
to its controller class.- Parameters:
window
- The FXML file to open.parameter
- The parameter to pass to the controller class.GUI.Window.SETUP
requires aFriedolyn
objectGUI.Window.SETUP_NTFY_DIALOG
requires aConfiguration
objectGUI.Window.SETUP_UNIFIED_PUSH_DIALOG
requires aConfiguration
objectGUI.Window.CONTACT
requiresContactController.InitialisationParameters
GUI.Window.CONTACT_REPLY_METHOD_DIALOG
requires aConfiguration
object
wait
- Whether to wait for the window to be closed before returning.- Throws:
IllegalArgumentException
- If the givenGUI.Window
is unknown or if the parameter is invalid. SeeController.prepare(PreparationType)
for more information.- API Note:
- For
GUI.Window.FIRST_LAUNCH
, the parameter is ignored. UseopenFirstLaunchWindow(boolean)
instead.
-
openWebsiteInDefaultBrowser
Opens a givenURL
in the default web browser of the user's operating system.- Parameters:
url
- The URL to open.- Throws:
RuntimeException
- If the URL could not be opened in the default browser.
-