Class RegistrationController

java.lang.Object
com.ehealthsystem.registration.RegistrationController
All Implemented Interfaces:
javafx.fxml.Initializable

public class RegistrationController extends Object implements javafx.fxml.Initializable
Method for managing the Registration of a new user
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    (package private) javafx.scene.control.TextField
     
    (package private) javafx.scene.control.DatePicker
     
    (package private) javafx.scene.control.TextField
     
    (package private) javafx.scene.control.Label
     
    (package private) javafx.scene.control.TextField
     
    private String
     
    (package private) javafx.scene.control.RadioButton
     
    (package private) javafx.scene.control.RadioButton
     
    (package private) javafx.scene.control.RadioButton
     
    (package private) List<javafx.scene.control.RadioButton>
     
    (package private) javafx.scene.control.TextField
     
    (package private) javafx.scene.control.TextField
     
    (package private) javafx.scene.control.TextField
     
    (package private) javafx.scene.control.PasswordField
     
    (package private) javafx.scene.control.CheckBox
     
    (package private) javafx.scene.control.PasswordField
     
    (package private) javafx.scene.control.TextField
     
    (package private) javafx.scene.control.TextField
    all attributes with a fx:id assigned in the view
    (package private) javafx.scene.control.TextField
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    private void
    fieldError(javafx.scene.control.TextField field, String error)
    Set an error on a field.
    void
    handleBackButton(javafx.event.ActionEvent event)
    Method called when back button is pressed.
    void
    handleBirthdayEditor(javafx.scene.input.KeyEvent event)
    Used to validate the Birthday when user inputs the date into the text field.
    void
    handleEmail(javafx.scene.input.KeyEvent event)
    Method called when Key is pressed and Email Textbox is selected.
    void
    handleFirstName(javafx.scene.input.KeyEvent event)
    Method called when Key is pressed and First Name Textbox is selected.
    void
    handleGenderChoice(javafx.event.ActionEvent event)
    Method to handle the proper functioning of the radio buttons for gender selection
    void
    handleInsuranceName(javafx.scene.input.KeyEvent keyEvent)
    Method called when the insurance name is typed in.
    void
    handleLastName(javafx.scene.input.KeyEvent event)
    Method called when Key is pressed and Last Name Textbox is selected.
    void
    handleNumber(javafx.scene.input.KeyEvent event)
    Method called when Key is pressed and Number Textbox is selected.
    void
    handlePassword(javafx.scene.input.KeyEvent event)
    Method called when Key is pressed and Password PasswordField is selected.
    void
    handleRegistrationButton(javafx.event.ActionEvent event)
    Method called when Button is pressed.
    void
    handleRepeatPassword(javafx.scene.input.KeyEvent event)
    Method called when Key is pressed and Repeated Password PasswordField is selected.
    void
    handleStreet(javafx.scene.input.KeyEvent event)
    Method called when Key is pressed and Street Textbox is selected.
    void
    handleUsername(javafx.scene.input.KeyEvent event)
    Method called when Key is pressed and Username Textbox is selected.
    void
    handleZip(javafx.scene.input.KeyEvent event)
    Method called when Key is pressed and Zip Textbox is selected.
    private void
    hideError(javafx.scene.control.TextField field)
    Hide an error on a field.
    void
    initialize(URL url, ResourceBundle resourceBundle)
    fist method called when scene is switched.
    private void
    normalBackground(javafx.scene.control.TextField field)
    Reset a fields background
    private void
    redBackground(javafx.scene.control.TextField field)
    Set a fields background red when the input is invalid.
    private void
    Shows an individual error label when the input is invalid.
    private boolean
    check if the address exist to validate the users input.
    boolean
    Helper method for the handleRegistrationButton method.
    boolean
    Helper method for the handleRegistrationButton method.
    boolean
    Helper method for the handleRegistrationButton method.
    boolean
    Helper method for the handleRegistrationButton method.
    private boolean
    Check if the insurance name is empty.
    boolean
    Helper method for the handleRegistrationButton method.
    boolean
    Helper method for the handleRegistrationButton method.
    boolean
    Helper method for the handleRegistrationButton method.
    boolean
     
    boolean
    Helper method for the handleRegistrationButton method.
    boolean
    Helper method for the handleRegistrationButton method.
    boolean
    Helper method for the handleRegistrationButton method.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • usernameTextField

      javafx.scene.control.TextField usernameTextField
      all attributes with a fx:id assigned in the view
    • emailTextField

      javafx.scene.control.TextField emailTextField
    • firstNameTextField

      javafx.scene.control.TextField firstNameTextField
    • lastNameTextField

      javafx.scene.control.TextField lastNameTextField
    • streetTextField

      javafx.scene.control.TextField streetTextField
    • numberTextField

      javafx.scene.control.TextField numberTextField
    • zipTextField

      javafx.scene.control.TextField zipTextField
    • birthdayPicker

      javafx.scene.control.DatePicker birthdayPicker
    • genderChoiceMale

      javafx.scene.control.RadioButton genderChoiceMale
    • genderChoiceFemale

      javafx.scene.control.RadioButton genderChoiceFemale
    • genderChoiceOther

      javafx.scene.control.RadioButton genderChoiceOther
    • genderRadioButtons

      List<javafx.scene.control.RadioButton> genderRadioButtons
    • passwordField

      javafx.scene.control.PasswordField passwordField
    • repeatPasswordField

      javafx.scene.control.PasswordField repeatPasswordField
    • insuranceNameTextField

      javafx.scene.control.TextField insuranceNameTextField
    • privateInsuranceCheckBox

      javafx.scene.control.CheckBox privateInsuranceCheckBox
    • errorLabel

      javafx.scene.control.Label errorLabel
    • birthdayEditor

      javafx.scene.control.TextField birthdayEditor
    • gender

      private String gender
  • Constructor Details

    • RegistrationController

      public RegistrationController()
  • Method Details

    • initialize

      public void initialize(URL url, ResourceBundle resourceBundle)
      fist method called when scene is switched. Used to set the choices of the choice box
      Specified by:
      initialize in interface javafx.fxml.Initializable
      Parameters:
      url -
      resourceBundle -
    • showError

      private void showError(String error)
      Shows an individual error label when the input is invalid.
      Parameters:
      error - The error text.
    • redBackground

      private void redBackground(javafx.scene.control.TextField field)
      Set a fields background red when the input is invalid.
      Parameters:
      field - The text field in the registration form.
    • fieldError

      private void fieldError(javafx.scene.control.TextField field, String error)
      Set an error on a field. Field will be shown in red and the error will be displayed.
      Parameters:
      field - the field to show in red
      error - the error to display
    • hideError

      private void hideError(javafx.scene.control.TextField field)
      Hide an error on a field. Field's color will be reset and error message will not be displayed.
      Parameters:
      field - The text field in the registration.
    • normalBackground

      private void normalBackground(javafx.scene.control.TextField field)
      Reset a fields background
      Parameters:
      field - The text field in the registration.
    • handleRegistrationButton

      public void handleRegistrationButton(javafx.event.ActionEvent event) throws IOException, SQLException, javax.mail.MessagingException, InterruptedException, com.google.maps.errors.ApiException
      Method called when Button is pressed. Used to check if values are wrong or missing for registration
      Parameters:
      event - event the Button reacts to
      Throws:
      IOException
      SQLException
      javax.mail.MessagingException
      InterruptedException
      com.google.maps.errors.ApiException
    • handleUsername

      public void handleUsername(javafx.scene.input.KeyEvent event) throws SQLException
      Method called when Key is pressed and Username Textbox is selected. Used to check if information are right/wrong while typing.
      Parameters:
      event - KeyEvent the Textbox reacts to
      Throws:
      SQLException
    • validateUsername

      public boolean validateUsername() throws SQLException
      Helper method for the handleRegistrationButton method. Used to validate the username correctness.
      Returns:
      true if username is entered correctly
      Throws:
      SQLException
    • handleBirthdayEditor

      public void handleBirthdayEditor(javafx.scene.input.KeyEvent event)
      Used to validate the Birthday when user inputs the date into the text field.
      Parameters:
      event - the event that triggered the methods execution
    • handleEmail

      public void handleEmail(javafx.scene.input.KeyEvent event) throws SQLException
      Method called when Key is pressed and Email Textbox is selected. Used to check if information are right/wrong while typing.
      Parameters:
      event - KeyEvent the Textbox reacts to
      Throws:
      SQLException
    • validateEmail

      public boolean validateEmail() throws SQLException
      Helper method for the handleRegistrationButton method. Used to validate the email correctness.
      Returns:
      true if email is entered correctly
      Throws:
      SQLException
    • handleFirstName

      public void handleFirstName(javafx.scene.input.KeyEvent event)
      Method called when Key is pressed and First Name Textbox is selected. Used to check if information are right/wrong while typing.
      Parameters:
      event - KeyEvent the Textbox reacts to
    • validateFirstname

      public boolean validateFirstname()
      Helper method for the handleRegistrationButton method. Used to validate the first name correctness.
      Returns:
      true if first name is entered correctly
    • handleLastName

      public void handleLastName(javafx.scene.input.KeyEvent event)
      Method called when Key is pressed and Last Name Textbox is selected. Used to check if information are right/wrong while typing.
      Parameters:
      event - KeyEvent the Textbox reacts to
    • validateLastname

      public boolean validateLastname()
      Helper method for the handleRegistrationButton method. Used to validate the last name correctness.
      Returns:
      true if last name is entered correctly
    • handleStreet

      public void handleStreet(javafx.scene.input.KeyEvent event)
      Method called when Key is pressed and Street Textbox is selected. Used to check if information are right/wrong while typing.
      Parameters:
      event - KeyEvent the Textbox reacts to
    • validateStreet

      public boolean validateStreet()
      Helper method for the handleRegistrationButton method. Used to validate the street correctness.
      Returns:
      true if street is entered correctly
    • handleNumber

      public void handleNumber(javafx.scene.input.KeyEvent event)
      Method called when Key is pressed and Number Textbox is selected. Used to check if information are right/wrong while typing.
      Parameters:
      event - KeyEvent the Textbox reacts to
    • validateNumber

      public boolean validateNumber()
      Helper method for the handleRegistrationButton method. Used to validate the house numbers correctness.
      Returns:
      true if house number is entered correctly
    • validateAddress

      private boolean validateAddress() throws IOException, InterruptedException, com.google.maps.errors.ApiException
      check if the address exist to validate the users input.
      Returns:
      True if the address exist, else false in addition to showing an error message.
      Throws:
      IOException
      InterruptedException
      com.google.maps.errors.ApiException
    • handleInsuranceName

      public void handleInsuranceName(javafx.scene.input.KeyEvent keyEvent)
      Method called when the insurance name is typed in. Used to validate that the user input is not empty
      Parameters:
      keyEvent - the event that triggers the method execution
    • validateInsuranceName

      private boolean validateInsuranceName()
      Check if the insurance name is empty. If yes throw an error and return false and if not the opposite.
      Returns:
      if the insurance name is valid
    • handleZip

      public void handleZip(javafx.scene.input.KeyEvent event)
      Method called when Key is pressed and Zip Textbox is selected. Used to check if information are right/wrong while typing.
      Parameters:
      event - KeyEvent the Textbox reacts to
    • validateZip

      public boolean validateZip()
      Helper method for the handleRegistrationButton method. Used to validate the zip correctness.
      Returns:
      true if zip is entered correctly
    • validateBirthday

      public boolean validateBirthday()
      Helper method for the handleRegistrationButton method. Used to validate the birthday correctness.
      Returns:
      true if birthday is entered correctly
    • handleGenderChoice

      public void handleGenderChoice(javafx.event.ActionEvent event)
      Method to handle the proper functioning of the radio buttons for gender selection
      Parameters:
      event - ActionEvent triggered when pressing a radio button
    • validateGender

      public boolean validateGender()
      Helper method for the handleRegistrationButton method. Used to validate the gender correctness.
      Returns:
      true if gender is entered correctly
    • handlePassword

      public void handlePassword(javafx.scene.input.KeyEvent event)
      Method called when Key is pressed and Password PasswordField is selected. Used to check if information are right/wrong while typing.
      Parameters:
      event - KeyEvent the Textbox reacts to
    • handleRepeatPassword

      public void handleRepeatPassword(javafx.scene.input.KeyEvent event)
      Method called when Key is pressed and Repeated Password PasswordField is selected. Used to check if information are right/wrong while typing.
      Parameters:
      event - KeyEvent the Textbox reacts to
    • validatePassword

      public boolean validatePassword()
      Helper method for the handleRegistrationButton method. Used to validate the password correctness.
      Returns:
      true if password and repeated password match
    • validateRepeatPassword

      public boolean validateRepeatPassword()
    • handleBackButton

      public void handleBackButton(javafx.event.ActionEvent event) throws IOException
      Method called when back button is pressed.
      Parameters:
      event - Trigger to invoke this method.
      Throws:
      IOException