Package Controller
Class LoginController
java.lang.Object
Controller.LoginController
Controller for the Login Screen
- Since:
- 2023-03-07
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate javafx.scene.control.ButtonButtonthat tiggersonBackspace(ActionEvent)private DatabaseConnectConnection to the databaseprivate booleanBoolean determining if the pin is hiddenprivate javafx.scene.control.ButtonButtonthat triggersloginButtonClicked(ActionEvent)private static final intMax number of digits that PIN can holdprivate javafx.scene.control.ButtonButtonthat triggerssetPin(ActionEvent)private javafx.scene.control.ButtonButtonthat triggerssetPin(ActionEvent)private javafx.scene.control.ButtonButtonthat triggerssetPin(ActionEvent)private javafx.scene.control.ButtonButtonthat triggerssetPin(ActionEvent)private javafx.scene.control.ButtonButtonthat triggerssetPin(ActionEvent)private javafx.scene.control.ButtonButtonthat triggerssetPin(ActionEvent)private javafx.scene.control.ButtonButtonthat triggerssetPin(ActionEvent)private javafx.scene.control.ButtonButtonthat triggerssetPin(ActionEvent)private javafx.scene.control.ButtonButtonthat triggerssetPin(ActionEvent)private javafx.scene.control.ButtonButtonthat triggerssetPin(ActionEvent)private javafx.scene.control.TextFieldTextFieldto input the PINprivate StringRepresents current typed PINprivate SceneSwitchSwitches between scenes or tabsprivate SessionDataCurrent session dataprivate javafx.scene.control.ToggleButtonToggleButtonthat triggersonShowPin(ActionEvent) -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionInitalize the connection to the databaselongDetermine the ID of the employee that logged in.voidInialize the connection to the database.voidloginButtonClicked(javafx.event.ActionEvent event) Log into the database and switch scenes.RetreivesSessionDataof the employee who logged invoidonBackspace(javafx.event.ActionEvent ae) Handles pressingbackspacevoidonPinBoxTyped(javafx.scene.input.KeyEvent event) Handle typing directly intopinBoxvoidonShowPin(javafx.event.ActionEvent ae) Toggles between showing and hidding the pinvoidsetPin(javafx.event.ActionEvent event) Sets thepinNumberwhen a pin inputButtonis pressedprivate voidUpdate 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 loginButtonthat triggersloginButtonClicked(ActionEvent) -
num0
private javafx.scene.control.Button num0Buttonthat triggerssetPin(ActionEvent) -
num1
private javafx.scene.control.Button num1Buttonthat triggerssetPin(ActionEvent) -
num2
private javafx.scene.control.Button num2Buttonthat triggerssetPin(ActionEvent) -
num3
private javafx.scene.control.Button num3Buttonthat triggerssetPin(ActionEvent) -
num4
private javafx.scene.control.Button num4Buttonthat triggerssetPin(ActionEvent) -
num5
private javafx.scene.control.Button num5Buttonthat triggerssetPin(ActionEvent) -
num6
private javafx.scene.control.Button num6Buttonthat triggerssetPin(ActionEvent) -
num7
private javafx.scene.control.Button num7Buttonthat triggerssetPin(ActionEvent) -
num8
private javafx.scene.control.Button num8Buttonthat triggerssetPin(ActionEvent) -
num9
private javafx.scene.control.Button num9Buttonthat triggerssetPin(ActionEvent) -
backspace
private javafx.scene.control.Button backspaceButtonthat tiggersonBackspace(ActionEvent) -
showPin
private javafx.scene.control.ToggleButton showPinToggleButtonthat triggersonShowPin(ActionEvent) -
pinBox
private javafx.scene.control.TextField pinBoxTextFieldto 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 thepinNumberwhen a pin inputButtonis pressed- Parameters:
event-ActionEventof the pin inputButton
-
onPinBoxTyped
public void onPinBoxTyped(javafx.scene.input.KeyEvent event) Handle typing directly intopinBox- Parameters:
event-KeyEventof key pressed
-
onBackspace
public void onBackspace(javafx.event.ActionEvent ae) Handles pressingbackspace- Parameters:
ae-ActionEventofbackspace
-
onShowPin
public void onShowPin(javafx.event.ActionEvent ae) Toggles between showing and hidding the pin- Parameters:
ae-ActionEventofshowPin
-
databaseInitializer
Initalize the connection to the database- Returns:
DatabaseConnect
-
loginInitializer
RetreivesSessionDataof the employee who logged in- Returns:
SessionData
-
loginButtonClicked
Log into the database and switch scenes.- Parameters:
event-ActionEventoflogin- 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
-