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 recordA record that represents the user's input in a dialog window.static enumThe 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.CONTACTwindow 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.CONTACTwindow 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_DIALOGwindow to let the user choose how the developers should reply to their contact request.static voidopenContactWindow(@NonNull Configuration configuration, boolean wait) Opens theGUI.Window.CONTACTwindow to let the user contact the developers of the application.static voidopenContactWindow(ContactController.InitialisationParameters parameters, boolean wait) Opens theGUI.Window.SETUPwindow 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 voidopenFirstLaunchWindow(boolean wait) Opens theGUI.Window.FIRST_LAUNCHwindow to let the user log in to Friedolin for the first time.static voidopenMainWindow(@NonNull Friedolyn friedolyn, boolean wait) Opens theGUI.Window.MAINwindow 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 aNtfyNotifierfor push notifications.static voidopenSetupNtfyDialogWindow(@NonNull Configuration configuration, boolean wait) Opens theGUI.Window.SETUP_NTFY_DIALOGwindow to let the user configure aNtfyNotifierfor push notifications.static @NonNull GUI.DialogResult<@NonNull UnifiedPushNotifier> openSetupUnifiedPushDialogWindow(@NonNull Configuration configuration) Opens a dialog window that asks the user to configure aUnifiedPushNotifierfor push notifications.static voidopenSetupUnifiedPushDialogWindow(@NonNull Configuration configuration, boolean wait) Opens theGUI.Window.SETUP_UNIFIED_PUSH_DIALOGwindow to let the user configure aUnifiedPushNotifierfor push notifications.static GUI.DialogResult<Friedolyn> openSetupWindow(@NonNull Friedolyn friedolyn) Opens theGUI.Window.SETUPwindow to let the user set their preferences for the application.static voidopenWebsiteInDefaultBrowser(@NonNull URL url) Opens a givenURLin the default web browser of the user's operating system.private static voidopenWindow(@NonNull GUI.Window window, boolean wait) Shows a given FXML file as a new GUI window.private static voidopenWindowWithParameter(@NonNull GUI.Window window, @NonNull Object parameter, boolean wait) Opens aGUI.Windowand passes someObjectto its controller class.
-
Constructor Details
-
GUI
public GUI()
-
-
Method Details
-
openFirstLaunchWindow
public static void openFirstLaunchWindow(boolean wait) Opens theGUI.Window.FIRST_LAUNCHwindow 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.SETUPwindow to let the user set their preferences for the application.- Parameters:
friedolyn- TheFriedolynobject 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_DIALOGwindow to let the user configure aNtfyNotifierfor 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_DIALOGwindow to let the user configure aUnifiedPushNotifierfor 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.MAINwindow to let the user interact with the application.- Parameters:
friedolyn- TheFriedolynobject 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.SETUPwindow 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.CONTACTwindow 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.CONTACTwindow 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 betrueif the user clicked the "Send" button,falseotherwise.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.CONTACTwindow 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 betrueif the user clicked the "Send" button,falseotherwise.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_DIALOGwindow 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 betrueif the user clicked the "OK" button,falseotherwise.GUI.DialogResult.result()will contain thecontact methodsto 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 aNtfyNotifierfor push notifications.- Parameters:
configuration- The configuration to pass tothe controller class. Will be used as specified in thepreparemethod.- 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 aUnifiedPushNotifierfor push notifications.- Parameters:
configuration- The configuration to pass tothe controller class. Will be used as specified in thepreparemethod.- 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.MAINrequires aFriedolynobjectGUI.Window.SETUP_EMAIL_DIALOGrequires aConfigurationobjectGUI.Window.SETUP_NTFY_DIALOGrequires aConfigurationobjectGUI.Window.SETUP_UNIFIED_PUSH_DIALOGrequires aConfigurationobjectGUI.Window.CONTACTrequiresContactController.InitialisationParametersGUI.Window.CONTACT_REPLY_METHOD_DIALOGrequires aConfigurationobject
- 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.Windowand passes someObjectto its controller class.- Parameters:
window- The FXML file to open.parameter- The parameter to pass to the controller class.GUI.Window.SETUPrequires aFriedolynobjectGUI.Window.SETUP_NTFY_DIALOGrequires aConfigurationobjectGUI.Window.SETUP_UNIFIED_PUSH_DIALOGrequires aConfigurationobjectGUI.Window.CONTACTrequiresContactController.InitialisationParametersGUI.Window.CONTACT_REPLY_METHOD_DIALOGrequires aConfigurationobject
wait- Whether to wait for the window to be closed before returning.- Throws:
IllegalArgumentException- If the givenGUI.Windowis 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 givenURLin 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.
-