Package Controller

Class LoginController

java.lang.Object
Controller.LoginController

public class LoginController extends Object
Controller for the Login Screen
Since:
2023-03-07
  • Field Details

    • MAX_PIN_LENGTH

      private static final int MAX_PIN_LENGTH
      Max number of digits that PIN can hold
      See Also:
    • session

      private SessionData session
      Current session data
      See Also:
    • database

      private DatabaseConnect database
      Connection to the database
      See Also:
    • sceneSwitch

      private SceneSwitch sceneSwitch
      Switches between scenes or tabs
      See Also:
    • login

      private javafx.scene.control.Button login
      Button that triggers loginButtonClicked(ActionEvent)
    • num0

      private javafx.scene.control.Button num0
      Button that triggers setPin(ActionEvent)
    • num1

      private javafx.scene.control.Button num1
      Button that triggers setPin(ActionEvent)
    • num2

      private javafx.scene.control.Button num2
      Button that triggers setPin(ActionEvent)
    • num3

      private javafx.scene.control.Button num3
      Button that triggers setPin(ActionEvent)
    • num4

      private javafx.scene.control.Button num4
      Button that triggers setPin(ActionEvent)
    • num5

      private javafx.scene.control.Button num5
      Button that triggers setPin(ActionEvent)
    • num6

      private javafx.scene.control.Button num6
      Button that triggers setPin(ActionEvent)
    • num7

      private javafx.scene.control.Button num7
      Button that triggers setPin(ActionEvent)
    • num8

      private javafx.scene.control.Button num8
      Button that triggers setPin(ActionEvent)
    • num9

      private javafx.scene.control.Button num9
      Button that triggers setPin(ActionEvent)
    • backspace

      private javafx.scene.control.Button backspace
      Button that tiggers onBackspace(ActionEvent)
    • showPin

      private javafx.scene.control.ToggleButton showPin
      ToggleButton that triggers onShowPin(ActionEvent)
    • pinBox

      private javafx.scene.control.TextField pinBox
      TextField to input the PIN
    • pinNumber

      private String pinNumber
      Represents current typed PIN
    • isShowingPin

      private boolean isShowingPin
      Boolean determining if the pin is hidden
  • Constructor Details

    • LoginController

      public LoginController()
      Constructor
    • LoginController

      public LoginController(SessionData session)
      Constructor
      Parameters:
      session - Session's Information
  • Method Details

    • initialize

      public void initialize()
      Inialize the connection to the database.
    • updatePin

      private void updatePin()
      Update the pinBox
    • setPin

      public void setPin(javafx.event.ActionEvent event)
      Sets the pinNumber when a pin input Button is pressed
      Parameters:
      event - ActionEvent of the pin input Button
    • onPinBoxTyped

      public void onPinBoxTyped(javafx.scene.input.KeyEvent event)
      Handle typing directly into pinBox
      Parameters:
      event - KeyEvent of key pressed
    • onBackspace

      public void onBackspace(javafx.event.ActionEvent ae)
      Handles pressing backspace
      Parameters:
      ae - ActionEvent of backspace
    • onShowPin

      public void onShowPin(javafx.event.ActionEvent ae)
      Toggles between showing and hidding the pin
      Parameters:
      ae - ActionEvent of showPin
    • databaseInitializer

      public DatabaseConnect databaseInitializer()
      Initalize the connection to the database
      Returns:
      DatabaseConnect
    • loginInitializer

      public SessionData loginInitializer()
      Retreives SessionData of the employee who logged in
      Returns:
      SessionData
    • loginButtonClicked

      public void loginButtonClicked(javafx.event.ActionEvent event) throws IOException
      Log into the database and switch scenes.
      Parameters:
      event - ActionEvent of login
      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