Class SetupController
java.lang.Object
page.codeberg.friedolyn.gui.controllers.Controller<Friedolyn>
page.codeberg.friedolyn.gui.controllers.DialogController<Friedolyn,Friedolyn>
page.codeberg.friedolyn.gui.controllers.SetupController
- All Implemented Interfaces:
javafx.fxml.Initializable,Preparable<Friedolyn>
Defines the behaviour of the
GUI.Window.SETUP window, which allows the user to set up a new
configuration via a graphical user interface.
- Call the
prepare(page.codeberg.friedolyn.Friedolyn)method beforeinitialize(java.net.URL, java.util.ResourceBundle). -
Call the
getResult()method to get theFriedolynobject whoseconfigurationhas been set up according to the user's input.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classRepresents a time span in days, hours, and minutes. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate javafx.scene.control.Buttonprivate javafx.scene.control.Buttonprivate javafx.scene.control.Buttonprivate javafx.scene.control.CheckBoxprivate javafx.scene.control.CheckBoxprivate javafx.scene.control.CheckBoxprivate javafx.scene.control.CheckBoxprivate javafx.scene.control.CheckBoxprivate javafx.scene.control.CheckBoxprivate javafx.scene.control.CheckBoxprivate org.controlsfx.control.CheckComboBox<String> private org.controlsfx.control.CheckListView<String> private javafx.scene.control.ChoiceBox<String> private javafx.scene.control.ChoiceBox<String> private FileThe newthat the user has selected.invalid reference
directoryprivate FriedolynHolds theconfigurationthat is being set up.private javafx.scene.layout.ColumnConstraintsprivate javafx.scene.layout.GridPaneprivate javafx.scene.layout.RowConstraintsprivate javafx.scene.layout.HBoxprivate javafx.scene.text.Textprivate javafx.scene.text.Textprivate javafx.scene.text.Textprivate booleanThis will turntrueonce the user has set up anEMailNotifier.private booleanThis will turntrueonce the user has set up aNtfyNotifier.private booleanThis will turntrueonce the user has set up aUnifiedPushNotifier.private final @NonNull SetupController.IntervalThe time span between two fetches of the exam data from Friedolin.private static final javafx.scene.text.Fontprivate javafx.scene.control.Labelprivate javafx.scene.control.Labelprivate javafx.scene.control.Labelprivate javafx.scene.control.RadioButtonprivate javafx.scene.control.RadioButtonprivate javafx.scene.control.RadioButtonprivate @NonNull ResourceBundleprivate booleanWhether the user has successfully entered valid data and closed the window or dialog.private javafx.scene.control.Spinner<Integer> private javafx.scene.control.Spinner<Double> private javafx.scene.control.Spinner<Integer> private javafx.scene.control.Spinner<Integer> private static final javafx.scene.text.Fontprivate javafx.scene.control.Tabprivate javafx.scene.control.Tabprivate javafx.scene.control.TabPaneprivate javafx.scene.control.Tabprivate javafx.scene.control.Tabprivate javafx.scene.control.Tabprivate javafx.scene.text.Textprivate javafx.scene.control.TextFieldprivate javafx.scene.text.TextFlowprivate javafx.scene.text.TextFlowprivate javafx.scene.text.Textprivate javafx.scene.text.Textprivate javafx.scene.text.Textprivate javafx.scene.text.Textprivate javafx.scene.text.Textprivate javafx.scene.text.Textprivate javafx.scene.text.Textprivate javafx.scene.text.Textprivate javafx.scene.text.Textprivate boolean -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidback()Switches to the previous setup tab without modifying any of the user's input, neither in the current tab nor in the tab to which the user switches.voidAsks the user to select thedirectory.voidclose()Makes the current dialog disappear from the user's screen.voidconfirm()Called when the user has finished the setup.@NonNull FuzzyBooleanprivate voidInitialises thechoiceBoxUserAgentClientandchoiceBoxUserAgentPlatformwith theuser agentsavailable, so that the user can select aclientand aplatform.voidinitialize(URL location, ResourceBundle resources) It is required to call theprepare(page.codeberg.friedolyn.Friedolyn)method immediately after this method.voidnext()Switches to the next setup tab without modifying any of the user's input, neither in the current tab nor in the tab to which the user switches.private booleanprivate booleanOpens theNtfy setup dialogto ask the user to configure a newNtfyNotifier.private booleanOpens theUnifiedPush setup dialogto ask the user to configure a newUnifiedPushNotifier.voidIt is required to call this method immediately afterinitialize(java.net.URL, java.util.ResourceBundle).private voidresize()voidvoidSets thecheckBoxNtfyto the opposite of its current value, i.e.voidSets thecheckBoxEmailto the opposite of its current value, i.e.private voidtoggleTracking(boolean verbose) voidSets thecheckBoxUnifiedPushto the opposite of its current value, i.e.private voidprivate booleanvalidate()Validates the user input.
-
Field Details
-
resourceBundle
-
result
private boolean resultWhether the user has successfully entered valid data and closed the window or dialog. -
friedolyn
Holds theconfigurationthat is being set up. -
directory
The newthat the user has selected.invalid reference
directory -
initialisedEmail
private boolean initialisedEmailThis will turntrueonce the user has set up anEMailNotifier. This information is needed for the decision whether to automaticallyopenthe setup dialog fore-mail notificationswhen the user toggles the corresponding checkbox. (This is only done the first time the user toggles the checkbox.)DOES NOT indicate whether the user wants to use
e-mail notificationsor not. To find out that, checkthe configuration. -
initialisedNtfy
private boolean initialisedNtfyThis will turntrueonce the user has set up aNtfyNotifier. This information is needed for the decision whether to automaticallyopenthe setup dialog forNtfywhen the user toggles the corresponding checkbox. (This is only done the first time the user toggles the checkbox.)DOES NOT indicate whether the user wants to use
Ntfyor not. To find out that, checkthe configuration. -
initialisedUnifiedPush
private boolean initialisedUnifiedPushThis will turntrueonce the user has set up aUnifiedPushNotifier. This information is needed for the decision whether to automaticallyopenthe setup dialog forUnifiedPushwhen the user toggles the corresponding checkbox. (This is only done the first time the user toggles the checkbox.)DOES NOT indicate whether the user wants to use
UnifiedPushor not. To find out that, checkthe configuration. -
trackingVerbose
private boolean trackingVerbose -
SUBTITLE_FONT
private static final javafx.scene.text.Font SUBTITLE_FONT -
LABEL_FONT
private static final javafx.scene.text.Font LABEL_FONT -
interval
The time span between two fetches of the exam data from Friedolin. -
buttonNext
private javafx.scene.control.Button buttonNext -
buttonBack
private javafx.scene.control.Button buttonBack -
tabPaneMain
private javafx.scene.control.TabPane tabPaneMain -
tabYourData
private javafx.scene.control.Tab tabYourData -
tabBasic
private javafx.scene.control.Tab tabBasic -
tabPDFs
private javafx.scene.control.Tab tabPDFs -
tabNotifications
private javafx.scene.control.Tab tabNotifications -
tabStealth
private javafx.scene.control.Tab tabStealth -
textYourDataTitle
private javafx.scene.text.Text textYourDataTitle -
textName
private javafx.scene.text.Text textName -
textUser
private javafx.scene.text.Text textUser -
textEmail
private javafx.scene.text.Text textEmail -
checkListViewDegrees
-
spinnerDays
-
spinnerHours
-
spinnerMinutes
-
textIntervalDescription
private javafx.scene.text.Text textIntervalDescription -
checkBoxEmail
private javafx.scene.control.CheckBox checkBoxEmail -
labelEmail
private javafx.scene.control.Label labelEmail -
hyperlinkEmail
private javafx.scene.text.Text hyperlinkEmail -
checkBoxNtfy
private javafx.scene.control.CheckBox checkBoxNtfy -
labelNtfy
private javafx.scene.control.Label labelNtfy -
hyperlinkNtfy
private javafx.scene.text.Text hyperlinkNtfy -
checkBoxUnifiedPush
private javafx.scene.control.CheckBox checkBoxUnifiedPush -
labelUnifiedPush
private javafx.scene.control.Label labelUnifiedPush -
hyperlinkUnifiedPush
private javafx.scene.text.Text hyperlinkUnifiedPush -
radioIncludeGradesAlways
private javafx.scene.control.RadioButton radioIncludeGradesAlways -
radioIncludeGradesGoodOnes
private javafx.scene.control.RadioButton radioIncludeGradesGoodOnes -
radioIncludeGradesNever
private javafx.scene.control.RadioButton radioIncludeGradesNever -
spinnerGoodGradesMaximum
-
textGoodGradesTitle
private javafx.scene.text.Text textGoodGradesTitle -
textGoodGradesLabel1
private javafx.scene.text.Text textGoodGradesLabel1 -
textGoodGradesLabel2
private javafx.scene.text.Text textGoodGradesLabel2 -
checkComboBoxPDFs
-
checkBoxOverwritePDFs
private javafx.scene.control.CheckBox checkBoxOverwritePDFs -
textFlowOverwritePDFsDescription
private javafx.scene.text.TextFlow textFlowOverwritePDFsDescription -
textOverwritePDFsDescription
private javafx.scene.text.Text textOverwritePDFsDescription -
buttonSelectDirectory
private javafx.scene.control.Button buttonSelectDirectory -
textFieldDirectory
private javafx.scene.control.TextField textFieldDirectory -
choiceBoxUserAgentClient
-
choiceBoxUserAgentPlatform
-
gridPaneTracking
private javafx.scene.layout.GridPane gridPaneTracking -
checkBoxTracking
private javafx.scene.control.CheckBox checkBoxTracking -
gridColumnTrackingCheckBox
private javafx.scene.layout.ColumnConstraints gridColumnTrackingCheckBox -
textTrackingTitle
private javafx.scene.text.Text textTrackingTitle -
textFlowTracking
private javafx.scene.text.TextFlow textFlowTracking -
gridRowDNT
private javafx.scene.layout.RowConstraints gridRowDNT -
hBoxDNT
private javafx.scene.layout.HBox hBoxDNT -
checkBoxGridDNT
private javafx.scene.control.CheckBox checkBoxGridDNT -
checkBoxGridGPC
private javafx.scene.control.CheckBox checkBoxGridGPC
-
-
Constructor Details
-
SetupController
public SetupController()
-
-
Method Details
-
getSuccess
- Overrides:
getSuccessin classController<Friedolyn>- Returns:
FuzzyBoolean.TRUEif the user has successfully entered valid data and closed the dialog,FuzzyBoolean.FALSEotherwise. It is guaranteed thatFuzzyBoolean.MAYBEis never returned.
-
getResult
- Specified by:
getResultin classDialogController<Friedolyn,Friedolyn> - Returns:
- A
Friedolynobject whoseconfigurationhas been set up according to the user's input.
-
updateInterval
private void updateInterval()Updates thespinnerHoursandspinnerMinutesbased on the current value of theinterval.-
If the number of days is
Friedolyn.MAXIMUM_INTERVAL_DAYS, the maximum number of hours and minutes is set to 0 and a message is displayed to the user stating what the maximum number of days is. -
If the number of days is 0 and the number of hours is 0, the minimum number of minutes is set to
Friedolyn.MINIMUM_INTERVAL_MINUTES. -
If the total number of minutes is
Friedolyn.MINIMUM_INTERVAL_MINUTES, a message is displayed to the user stating what the minimum number of minutes is.
-
If the number of days is
-
initialize
It is required to call theprepare(page.codeberg.friedolyn.Friedolyn)method immediately after this method.- Parameters:
location- SeeInitializable.initialize(URL, ResourceBundle).resources- SeeInitializable.initialize(URL, ResourceBundle).
-
toggleTracking
private void toggleTracking(boolean verbose) -
openEmailDialog
private boolean openEmailDialog() -
openNtfyDialog
private boolean openNtfyDialog()Opens theNtfy setup dialogto ask the user to configure a newNtfyNotifier. -
openUnifiedPushDialog
private boolean openUnifiedPushDialog()Opens theUnifiedPush setup dialogto ask the user to configure a newUnifiedPushNotifier. -
toggleEmail
public void toggleEmail() -
toggleNtfy
public void toggleNtfy()Sets thecheckBoxNtfyto the opposite of its current value, i.e. the user toggles the setting whether to send notifications viaNtfy. -
toggleUnifiedPush
public void toggleUnifiedPush()Sets thecheckBoxUnifiedPushto the opposite of its current value, i.e. the user toggles the setting whether to send notifications viaUnifiedPush. -
initialiseStealthTab
private void initialiseStealthTab()Initialises thechoiceBoxUserAgentClientandchoiceBoxUserAgentPlatformwith theuser agentsavailable, so that the user can select aclientand aplatform. -
prepare
It is required to call this method immediately afterinitialize(java.net.URL, java.util.ResourceBundle). Populates the setup dialog with the user's information, such as their name, user name, e-mail address, academic degrees available for tracking.Initialisesthe stealth tab with theuser agentsavailable.- Specified by:
preparein interfacePreparable<Friedolyn>- Overrides:
preparein classController<Friedolyn>- Parameters:
friedolyn- TheFriedolynobject whoseconfigurationis being set up.- See Also:
-
toggleOverwritePDFs
public void toggleOverwritePDFs()Sets thecheckBoxEmailto the opposite of its current value, i.e. the user toggles the setting whether, when downloading the grade table as a PDF, older versions of the PDF should be overwritten.- See Also:
-
chooseDirectory
-
validate
private boolean validate()Validates the user input. If the input is invalid, the user is informed about the error and the corresponding tab is selected. Specifically, it is checked that:- Returns:
trueif the user input is valid,falseotherwise.
-
next
public void next()Switches to the next setup tab without modifying any of the user's input, neither in the current tab nor in the tab to which the user switches. -
back
public void back()Switches to the previous setup tab without modifying any of the user's input, neither in the current tab nor in the tab to which the user switches. -
confirm
public void confirm()Called when the user has finished the setup.Validatesthe user input and closes the window if the input is valid.- Specified by:
confirmin classDialogController<Friedolyn,Friedolyn>
-
resize
- Throws:
NullPointerException
-
close
public void close()Makes the current dialog disappear from the user's screen.- Specified by:
closein classController<Friedolyn>
-