Class PrimaryEditController

java.lang.Object
com.ehealthsystem.primary.PrimaryEditController
All Implemented Interfaces:
javafx.fxml.Initializable

public class PrimaryEditController extends Object implements javafx.fxml.Initializable
  • Field Details

    • changePasswordCheckbox

      public javafx.scene.control.CheckBox changePasswordCheckbox
    • oldPasswordLabel

      public javafx.scene.control.Label oldPasswordLabel
    • newPasswordLabel

      public javafx.scene.control.Label newPasswordLabel
    • usernameTextField

      javafx.scene.control.TextField usernameTextField
    • emailTextField

      javafx.scene.control.TextField emailTextField
    • firstNameTextField

      javafx.scene.control.TextField firstNameTextField
    • lastNameTextField

      javafx.scene.control.TextField lastNameTextField
    • streetTextField

      javafx.scene.control.TextField streetTextField
    • houseNoTextField

      javafx.scene.control.TextField houseNoTextField
    • zipTextField

      javafx.scene.control.TextField zipTextField
    • birthdayPicker

      javafx.scene.control.DatePicker birthdayPicker
    • genderBox

      javafx.scene.control.ChoiceBox genderBox
    • insuranceNameTextField

      javafx.scene.control.TextField insuranceNameTextField
    • privateInsuranceCheckBox

      javafx.scene.control.CheckBox privateInsuranceCheckBox
    • oldPasswordField

      javafx.scene.control.PasswordField oldPasswordField
    • newPasswordField

      javafx.scene.control.PasswordField newPasswordField
    • errorLabel

      javafx.scene.control.Label errorLabel
    • cancelButton

      javafx.scene.control.Button cancelButton
    • saveButton

      javafx.scene.control.Button saveButton
  • Constructor Details

    • PrimaryEditController

      public PrimaryEditController()
  • Method Details

    • initialize

      public void initialize(URL url, ResourceBundle resourceBundle)
      Method called when scene is switched. Used to set the ChoiceBox choices and to load the user information
      Specified by:
      initialize in interface javafx.fxml.Initializable
      Parameters:
      url -
      resourceBundle -
    • handleCancelButton

      public void handleCancelButton(javafx.event.ActionEvent event) throws IOException
      Method called when cancel button is pressed. Return to the primary window without saving edited user information
      Parameters:
      event - Trigger to invoke this method.
      Throws:
      IOException
    • handleSaveButton

      public void handleSaveButton(javafx.event.ActionEvent event) throws IOException, SQLException
      Method called when save button is pressed. Updates the edited user information in the DB
      Parameters:
      event - Trigger to invoke this method.
      Throws:
      IOException
      SQLException - Throws Exception during connection issues with the Database.
    • loadScene

      public void loadScene(javafx.event.ActionEvent event) throws IOException
      scene switch to primary scene
      Parameters:
      event - Trigger to invoke this method.
      Throws:
      IOException
    • updateUserInformation

      private void updateUserInformation() throws SQLException, javax.activation.UnsupportedDataTypeException
      update user information when save button is pressed
      Throws:
      SQLException - Throws Exception during connection issues with the Database.
      javax.activation.UnsupportedDataTypeException
    • updateUsername

      private void updateUsername(String username) throws SQLException, javax.activation.UnsupportedDataTypeException
      update username when save button is pressed
      Parameters:
      username - The username of the user.
      Throws:
      SQLException - Throws Exception during connection issues with the Database.
      javax.activation.UnsupportedDataTypeException
    • updateEmail

      private void updateEmail(String updateEmail) throws SQLException, javax.activation.UnsupportedDataTypeException
      update email when save button is pressed
      Parameters:
      updateEmail - The E-mail address of the user.
      Throws:
      SQLException - Throws Exception during connection issues with the Database.
      javax.activation.UnsupportedDataTypeException
    • updateFirstName

      private void updateFirstName(String firstName) throws SQLException, javax.activation.UnsupportedDataTypeException
      Update first name when save button is pressed
      Parameters:
      firstName - The first name of the user.
      Throws:
      SQLException - Throws Exception during connection issues with the Database.
      javax.activation.UnsupportedDataTypeException
    • updateLastName

      private void updateLastName(String lastName) throws SQLException, javax.activation.UnsupportedDataTypeException
      Update last name when save button is pressed
      Parameters:
      lastName - The last name of the user.
      Throws:
      SQLException - Throws Exception during connection issues with the Database.
      javax.activation.UnsupportedDataTypeException
    • updateStreet

      private void updateStreet(String street) throws SQLException, javax.activation.UnsupportedDataTypeException
      Update street when save button is pressed
      Parameters:
      street - The street where the user lives.
      Throws:
      SQLException - Throws Exception during connection issues with the Database.
      javax.activation.UnsupportedDataTypeException
    • updateNumber

      private void updateNumber(String houseNo) throws SQLException, javax.activation.UnsupportedDataTypeException
      Update house number when save button is pressed
      Parameters:
      houseNo - The house no. of the street.
      Throws:
      SQLException - Throws Exception during connection issues with the Database.
      javax.activation.UnsupportedDataTypeException
    • updateZip

      private void updateZip(String zip) throws SQLException, javax.activation.UnsupportedDataTypeException
      Update zip when save button is pressed
      Parameters:
      zip - The zip code where the user lives.
      Throws:
      SQLException - Throws Exception during connection issues with the Database.
      javax.activation.UnsupportedDataTypeException
    • updateBirthday

      private void updateBirthday(LocalDate birthday) throws SQLException, javax.activation.UnsupportedDataTypeException
      Update birthday when save button is pressed
      Parameters:
      birthday - The birthday of the user.
      Throws:
      SQLException - Throws Exception during connection issues with the Database.
      javax.activation.UnsupportedDataTypeException
    • updateGender

      private void updateGender(String gender) throws SQLException, javax.activation.UnsupportedDataTypeException
      Update gender when save button is pressed
      Parameters:
      gender - The gender of the user.
      Throws:
      SQLException - Throws Exception during connection issues with the Database.
      javax.activation.UnsupportedDataTypeException
    • updateInsuranceName

      private void updateInsuranceName(String text) throws SQLException, javax.activation.UnsupportedDataTypeException
      Update private insurance name when save button is pressed
      Parameters:
      text - The name of the insurance.
      Throws:
      SQLException - Throws Exception during connection issues with the Database.
      javax.activation.UnsupportedDataTypeException
    • updatePrivateInsurance

      private void updatePrivateInsurance(boolean privateInsurance) throws SQLException, javax.activation.UnsupportedDataTypeException
      Update private insurance when save button is pressed
      Parameters:
      privateInsurance - The type of the insurance.
      Throws:
      SQLException - Throws Exception during connection issues with the Database.
      javax.activation.UnsupportedDataTypeException
    • updatePassword

      private void updatePassword(String oldPassword, String newPassword) throws SQLException
      Update password when save button is pressed
      Parameters:
      oldPassword - The old password of the user.
      newPassword - The new password of the user.
      Throws:
      SQLException - Throws Exception during connection issues with the Database.
    • loadUserDetails

      public void loadUserDetails()
      Load user information when button is pressed
    • setUsernameTextField

      private void setUsernameTextField(String username)
      Set Username Text Field to user information in DB
      Parameters:
      username - The username of the user.
    • setEmailTextField

      private void setEmailTextField(String email)
      Set Email Text Field to user information in DB
      Parameters:
      email - The e-mail address of the user.
    • setFirstNameTextField

      private void setFirstNameTextField(String firstName)
      Set First Name Text Field to user information in DB
      Parameters:
      firstName - The first name of the user.
    • setLastNameTextField

      private void setLastNameTextField(String lastName)
      Set Last Name Text Field to user information in DB
      Parameters:
      lastName - The last name of the user.
    • setStreetTextField

      private void setStreetTextField(String street)
      Set Street Text Field to user information in DB
      Parameters:
      street - The street where the user lives.
    • setHouseNoTextField

      private void setHouseNoTextField(String houseNo)
      Set House Number Text Field to user information in DB
      Parameters:
      houseNo - The house no. of the street.
    • setZipTextField

      private void setZipTextField(String zip)
      Set Zip Text Field to user information in DB
      Parameters:
      zip - The zip code where the user lives.
    • loadBirthday

      private void loadBirthday(LocalDate birthday)
      Set Date Picker to birthday in DB
      Parameters:
      birthday - The birthday of the user.
    • setGenderTextField

      private void setGenderTextField(String gender)
      Set Gender Text Field to user information in DB
      Parameters:
      gender - The gender of the user.
    • setInsuranceNameTextField

      private void setInsuranceNameTextField(String insuranceName)
    • setPrivateInsuranceTextField

      private void setPrivateInsuranceTextField(boolean privateInsurance)
      Set private insurance Check Box to user information in DB
      Parameters:
      privateInsurance - The type of the insurance.
    • handleOldPassword

      public void handleOldPassword(javafx.scene.input.KeyEvent event) throws SQLException
      Check if old password is correct
      Parameters:
      event - Trigger to invoke this method.
      Throws:
      SQLException - Throws Exception during connection issues with the Database.
    • handleNewPassword

      public void handleNewPassword(javafx.scene.input.KeyEvent event) throws SQLException
      Checks if new password is correct while typing
      Parameters:
      event - Trigger to invoke this method.
      Throws:
      SQLException - Throws Exception during connection issues with the Database.
    • handleEmailTextField

      public void handleEmailTextField(javafx.scene.input.KeyEvent event)
      handle Keyboard input for Email Text Field. Check if Email format matches
      Parameters:
      event - Trigger to invoke this method.
    • changePasswordCheckboxChanged

      public void changePasswordCheckboxChanged(javafx.event.ActionEvent event)
      Parameters:
      event - Trigger to invoke this method.