Package Controller
Class LoginController
java.lang.Object
Controller.LoginController
Controller for the Login Screen
- Since:
- 2023-03-07
-
Field Summary
Modifier and TypeFieldDescriptionprivate javafx.scene.control.Button
Button
that tiggersonBackspace(ActionEvent)
private DatabaseConnect
Connection to the databaseprivate boolean
Boolean determining if the pin is hiddenprivate javafx.scene.control.Button
Button
that triggersloginButtonClicked(ActionEvent)
private static final int
Max number of digits that PIN can holdprivate javafx.scene.control.Button
Button
that triggerssetPin(ActionEvent)
private javafx.scene.control.Button
Button
that triggerssetPin(ActionEvent)
private javafx.scene.control.Button
Button
that triggerssetPin(ActionEvent)
private javafx.scene.control.Button
Button
that triggerssetPin(ActionEvent)
private javafx.scene.control.Button
Button
that triggerssetPin(ActionEvent)
private javafx.scene.control.Button
Button
that triggerssetPin(ActionEvent)
private javafx.scene.control.Button
Button
that triggerssetPin(ActionEvent)
private javafx.scene.control.Button
Button
that triggerssetPin(ActionEvent)
private javafx.scene.control.Button
Button
that triggerssetPin(ActionEvent)
private javafx.scene.control.Button
Button
that triggerssetPin(ActionEvent)
private javafx.scene.control.TextField
TextField
to input the PINprivate String
Represents current typed PINprivate SceneSwitch
Switches between scenes or tabsprivate SessionData
Current session dataprivate javafx.scene.control.ToggleButton
ToggleButton
that triggersonShowPin(ActionEvent)
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionInitalize the connection to the databaselong
Determine the ID of the employee that logged in.void
Inialize the connection to the database.void
loginButtonClicked
(javafx.event.ActionEvent event) Log into the database and switch scenes.RetreivesSessionData
of the employee who logged invoid
onBackspace
(javafx.event.ActionEvent ae) Handles pressingbackspace
void
onPinBoxTyped
(javafx.scene.input.KeyEvent event) Handle typing directly intopinBox
void
onShowPin
(javafx.event.ActionEvent ae) Toggles between showing and hidding the pinvoid
setPin
(javafx.event.ActionEvent event) Sets thepinNumber
when a pin inputButton
is pressedprivate void
Update thepinBox
-
Field Details
-
MAX_PIN_LENGTH
private static final int MAX_PIN_LENGTHMax number of digits that PIN can hold- See Also:
-
session
Current session data- See Also:
-
database
Connection to the database- See Also:
-
sceneSwitch
Switches between scenes or tabs- See Also:
-
login
private javafx.scene.control.Button loginButton
that triggersloginButtonClicked(ActionEvent)
-
num0
private javafx.scene.control.Button num0Button
that triggerssetPin(ActionEvent)
-
num1
private javafx.scene.control.Button num1Button
that triggerssetPin(ActionEvent)
-
num2
private javafx.scene.control.Button num2Button
that triggerssetPin(ActionEvent)
-
num3
private javafx.scene.control.Button num3Button
that triggerssetPin(ActionEvent)
-
num4
private javafx.scene.control.Button num4Button
that triggerssetPin(ActionEvent)
-
num5
private javafx.scene.control.Button num5Button
that triggerssetPin(ActionEvent)
-
num6
private javafx.scene.control.Button num6Button
that triggerssetPin(ActionEvent)
-
num7
private javafx.scene.control.Button num7Button
that triggerssetPin(ActionEvent)
-
num8
private javafx.scene.control.Button num8Button
that triggerssetPin(ActionEvent)
-
num9
private javafx.scene.control.Button num9Button
that triggerssetPin(ActionEvent)
-
backspace
private javafx.scene.control.Button backspaceButton
that tiggersonBackspace(ActionEvent)
-
showPin
private javafx.scene.control.ToggleButton showPinToggleButton
that triggersonShowPin(ActionEvent)
-
pinBox
private javafx.scene.control.TextField pinBoxTextField
to input the PIN -
pinNumber
Represents current typed PIN -
isShowingPin
private boolean isShowingPinBoolean determining if the pin is hidden
-
-
Constructor Details
-
LoginController
public LoginController()Constructor -
LoginController
Constructor- Parameters:
session
- Session's Information
-
-
Method Details
-
initialize
public void initialize()Inialize the connection to the database. -
updatePin
private void updatePin()Update thepinBox
-
setPin
public void setPin(javafx.event.ActionEvent event) Sets thepinNumber
when a pin inputButton
is pressed- Parameters:
event
-ActionEvent
of the pin inputButton
-
onPinBoxTyped
public void onPinBoxTyped(javafx.scene.input.KeyEvent event) Handle typing directly intopinBox
- Parameters:
event
-KeyEvent
of key pressed
-
onBackspace
public void onBackspace(javafx.event.ActionEvent ae) Handles pressingbackspace
- Parameters:
ae
-ActionEvent
ofbackspace
-
onShowPin
public void onShowPin(javafx.event.ActionEvent ae) Toggles between showing and hidding the pin- Parameters:
ae
-ActionEvent
ofshowPin
-
databaseInitializer
Initalize the connection to the database- Returns:
DatabaseConnect
-
loginInitializer
RetreivesSessionData
of the employee who logged in- Returns:
SessionData
-
loginButtonClicked
Log into the database and switch scenes.- Parameters:
event
-ActionEvent
oflogin
- Throws:
IOException
- if loading the new window failed
-
getEmployeeId
public long getEmployeeId()Determine the ID of the employee that logged in.- Returns:
- ID of the employee
-