java.lang.Object
com.example.cab302project.ProfileController
Controller for the User Profile screen (profile-view.fxml).
Allows the logged-in user to view and update their personal details
including email, phone number, home location, password, and dark mode
preference. Changes are validated before being persisted to the database.
The screen is accessible to both regular users and police officers.
The appropriate hamburger menu variant (
HamburgerMenu or
PoliceHamburgerMenu) is selected at runtime based on the
current user's role from UserSession.-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new ProfileController and initialises the DAO from the main application database instance. -
Method Summary
Modifier and TypeMethodDescriptionvoidInitialises the screen after the FXML has loaded.voidonSave()Validates and saves the user's updated profile information to the database.
-
Constructor Details
-
ProfileController
public ProfileController()Constructs a new ProfileController and initialises the DAO from the main application database instance.
-
-
Method Details
-
initialize
public void initialize()Initialises the screen after the FXML has loaded. Loads the current user from the session, populates the form fields, marks the Profile tab active in the nav bar, and wires up the correct hamburger menu variant based on the user's role. -
onSave
public void onSave()Validates and saves the user's updated profile information to the database. Reads form values, validates email and phone format and coordinate structure, then updates theUserobject and persists it via the DAO. Displays an appropriate alert for success, validation errors, or database failures.
-