Class FirstLaunchController
java.lang.Object
page.codeberg.friedolyn.gui.controllers.Controller<Void>
page.codeberg.friedolyn.gui.controllers.FirstLaunchController
- All Implemented Interfaces:
javafx.fxml.Initializable,Preparable<Void>
Provides the logic for the
window initially shown to the user when they
start Friedolyn for the first time. This window is used to log in to the University of Jena's Friedolin system.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate javafx.scene.layout.BorderPaneHolds the main content of the window, i.e.private javafx.scene.control.ButtonThe “Cancel” button on the loading screen to abruptly abort the background operation and return to the main window.private javafx.scene.control.Buttonprivate javafx.scene.control.CheckBoxprivate Configurationprivate javafx.scene.control.TextFieldprivate io.github.palexdev.materialfx.controls.MFXProgressSpinnerIndicates how much of the background operation has already been completed.private ResourceBundleprivate javafx.scene.control.TextFieldprivate javafx.scene.layout.VBoxThe loading screen showing aprogress spinner. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Makes the current window or dialog disappear from the user's screen.voidinitialize(URL location, @NonNull ResourceBundle resources) voidTries to connect to a running instance of the KeePassXC password manager and retrieve the user's Friedolin login credentials from there.voidproceed()Handles the user's click on the“Proceed” buttonand tries to log in to the University of Jena's Friedolin system with the student's credentials entered in theusernameandpasswordfields.protected voidsetResourceBundle(ResourceBundle resourceBundle) Updates theresourceBundleof this controller if it hasn't been set yet.voidToggles the state of the“I accept the obligation of use” checkbox.private voidtoggleLoadingSpinner(boolean active) Shows or hides the loading screen showing aprogress spinner.Methods inherited from class page.codeberg.friedolyn.gui.controllers.Controller
getSuccess, prepare
-
Field Details
-
resourceBundle
-
configuration
-
textFieldUser
private javafx.scene.control.TextField textFieldUser -
passwordField
private javafx.scene.control.TextField passwordField -
checkBoxObligationOfUse
private javafx.scene.control.CheckBox checkBoxObligationOfUse -
buttonProceed
private javafx.scene.control.Button buttonProceed -
borderPaneMain
private javafx.scene.layout.BorderPane borderPaneMainHolds the main content of the window, i.e. the login fields and the “Proceed” button. This is disabled while theloading screenis shown. -
vBoxLoading
private javafx.scene.layout.VBox vBoxLoadingThe loading screen showing aprogress spinner. -
progressSpinner
private io.github.palexdev.materialfx.controls.MFXProgressSpinner progressSpinnerIndicates how much of the background operation has already been completed. Child of theloading screen. -
buttonCancelLogin
private javafx.scene.control.Button buttonCancelLoginThe “Cancel” button on the loading screen to abruptly abort the background operation and return to the main window. Child of theloading screen.
-
-
Constructor Details
-
FirstLaunchController
public FirstLaunchController()
-
-
Method Details
-
setResourceBundle
Updates theresourceBundleof this controller if it hasn't been set yet.- Parameters:
resourceBundle- The resource bundle to set.- Throws:
IllegalStateException- If the resource bundle has already been set.
-
initialize
-
loginWithKeePassXC
public void loginWithKeePassXC() -
proceed
public void proceed()Handles the user's click on the“Proceed” buttonand tries to log in to the University of Jena's Friedolin system with the student's credentials entered in theusernameandpasswordfields.Will show an error popup if the
“I accept the obligation of use” checkboxis not checked. All non-GUI operations are executed in a separate thread in order to not block the GUI and not incentivise the operating system (looking at you, Windows) to tell the user that we're "not responding". Instead, a loading screen with aprogress spinneris displayed. -
toggleAcceptObligationOfUseCheckBox
public void toggleAcceptObligationOfUseCheckBox()Toggles the state of the“I accept the obligation of use” checkbox. If it was checked, it will be unchecked and vice versa. -
toggleLoadingSpinner
private void toggleLoadingSpinner(boolean active) Shows or hides the loading screen showing aprogress spinner. This is supposed to be used while performing heavy non-GUI operations whose response time could be significant, like making a network request or reading from a file.Did you know?
The loading screen features theprogressSpinnerwhoseprogress propertycan be bound to aTask's progress propertyto show a percentage indicating how much of the operation has already been completed.- Parameters:
active-trueto show the loading screen,falseto hide it.- Implementation Note:
- You might want to consider ordering the disabling/enabling statements such that disabling an element is done before enabling another one, to prevent them from being clickable both at the same time. However, this would require introducing several conditionals, which wouldn't be worth it in this case, because the enabling/disabling is almost instantaneous.
-
close
public void close()Makes the current window or dialog disappear from the user's screen.- Specified by:
closein classController<Void>
-