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 theFriedolyn
object whoseconfiguration
has been set up according to the user's input.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static class
Represents a time span in days, hours, and minutes. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate javafx.scene.control.Button
private javafx.scene.control.Button
private javafx.scene.control.Button
private javafx.scene.control.CheckBox
private javafx.scene.control.CheckBox
private javafx.scene.control.CheckBox
private javafx.scene.control.CheckBox
private javafx.scene.control.CheckBox
private javafx.scene.control.CheckBox
private javafx.scene.control.CheckBox
private org.controlsfx.control.CheckComboBox
<String> private org.controlsfx.control.CheckListView
<String> private javafx.scene.control.ChoiceBox
<String> private javafx.scene.control.ChoiceBox
<String> private File
The newinvalid reference
directory
private Friedolyn
Holds theconfiguration
that is being set up.private javafx.scene.layout.ColumnConstraints
private javafx.scene.layout.GridPane
private javafx.scene.layout.RowConstraints
private javafx.scene.layout.HBox
private javafx.scene.text.Text
private javafx.scene.text.Text
private javafx.scene.text.Text
private boolean
This will turntrue
once the user has set up anEMailNotifier
.private boolean
This will turntrue
once the user has set up aNtfyNotifier
.private boolean
This will turntrue
once the user has set up aUnifiedPushNotifier
.private final @NonNull SetupController.Interval
The time span between two fetches of the exam data from Friedolin.private static final javafx.scene.text.Font
private javafx.scene.control.Label
private javafx.scene.control.Label
private javafx.scene.control.Label
private javafx.scene.control.RadioButton
private javafx.scene.control.RadioButton
private javafx.scene.control.RadioButton
private @NonNull ResourceBundle
private boolean
Whether 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.Font
private javafx.scene.control.Tab
private javafx.scene.control.Tab
private javafx.scene.control.TabPane
private javafx.scene.control.Tab
private javafx.scene.control.Tab
private javafx.scene.control.Tab
private javafx.scene.text.Text
private javafx.scene.control.TextField
private javafx.scene.text.TextFlow
private javafx.scene.text.TextFlow
private javafx.scene.text.Text
private javafx.scene.text.Text
private javafx.scene.text.Text
private javafx.scene.text.Text
private javafx.scene.text.Text
private javafx.scene.text.Text
private javafx.scene.text.Text
private javafx.scene.text.Text
private javafx.scene.text.Text
private boolean
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
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.void
Asks the user to select thedirectory
.void
close()
Makes the current dialog disappear from the user's screen.void
confirm()
Called when the user has finished the setup.@NonNull FuzzyBoolean
private void
Initialises thechoiceBoxUserAgentClient
andchoiceBoxUserAgentPlatform
with theuser agents
available, so that the user can select aclient
and aplatform
.void
initialize
(URL location, ResourceBundle resources) It is required to call theprepare(page.codeberg.friedolyn.Friedolyn)
method immediately after this method.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.private boolean
private boolean
Opens theNtfy setup dialog
to ask the user to configure a newNtfyNotifier
.private boolean
Opens theUnifiedPush setup dialog
to ask the user to configure a newUnifiedPushNotifier
.void
It is required to call this method immediately afterinitialize(java.net.URL, java.util.ResourceBundle)
.private void
resize()
void
void
Sets thecheckBoxNtfy
to the opposite of its current value, i.e.void
Sets thecheckBoxEmail
to the opposite of its current value, i.e.private void
toggleTracking
(boolean verbose) void
Sets thecheckBoxUnifiedPush
to the opposite of its current value, i.e.private void
private boolean
validate()
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 theconfiguration
that is being set up. -
directory
The newinvalid reference
directory
-
initialisedEmail
private boolean initialisedEmailThis will turntrue
once the user has set up anEMailNotifier
. This information is needed for the decision whether to automaticallyopen
the setup dialog fore-mail notifications
when 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 notifications
or not. To find out that, checkthe configuration
. -
initialisedNtfy
private boolean initialisedNtfyThis will turntrue
once the user has set up aNtfyNotifier
. This information is needed for the decision whether to automaticallyopen
the setup dialog forNtfy
when 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
Ntfy
or not. To find out that, checkthe configuration
. -
initialisedUnifiedPush
private boolean initialisedUnifiedPushThis will turntrue
once the user has set up aUnifiedPushNotifier
. This information is needed for the decision whether to automaticallyopen
the setup dialog forUnifiedPush
when 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
UnifiedPush
or 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:
getSuccess
in classController<Friedolyn>
- Returns:
FuzzyBoolean.TRUE
if the user has successfully entered valid data and closed the dialog,FuzzyBoolean.FALSE
otherwise. It is guaranteed thatFuzzyBoolean.MAYBE
is never returned.
-
getResult
- Specified by:
getResult
in classDialogController<Friedolyn,
Friedolyn> - Returns:
- A
Friedolyn
object whoseconfiguration
has been set up according to the user's input.
-
updateInterval
private void updateInterval()Updates thespinnerHours
andspinnerMinutes
based 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 dialog
to ask the user to configure a newNtfyNotifier
. -
openUnifiedPushDialog
private boolean openUnifiedPushDialog()Opens theUnifiedPush setup dialog
to ask the user to configure a newUnifiedPushNotifier
. -
toggleEmail
public void toggleEmail() -
toggleNtfy
public void toggleNtfy()Sets thecheckBoxNtfy
to the opposite of its current value, i.e. the user toggles the setting whether to send notifications viaNtfy
. -
toggleUnifiedPush
public void toggleUnifiedPush()Sets thecheckBoxUnifiedPush
to the opposite of its current value, i.e. the user toggles the setting whether to send notifications viaUnifiedPush
. -
initialiseStealthTab
private void initialiseStealthTab()Initialises thechoiceBoxUserAgentClient
andchoiceBoxUserAgentPlatform
with theuser agents
available, so that the user can select aclient
and 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.Initialises
the stealth tab with theuser agents
available.- Specified by:
prepare
in interfacePreparable<Friedolyn>
- Overrides:
prepare
in classController<Friedolyn>
- Parameters:
friedolyn
- TheFriedolyn
object whoseconfiguration
is being set up.- See Also:
-
toggleOverwritePDFs
public void toggleOverwritePDFs()Sets thecheckBoxEmail
to 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:
true
if the user input is valid,false
otherwise.
-
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.Validates
the user input and closes the window if the input is valid.- Specified by:
confirm
in classDialogController<Friedolyn,
Friedolyn>
-
resize
- Throws:
NullPointerException
-
close
public void close()Makes the current dialog disappear from the user's screen.- Specified by:
close
in classController<Friedolyn>
-