Package com.esprit.controllers.users
Class AdminDashboardController
java.lang.Object
com.esprit.controllers.users.AdminDashboardController
JavaFX controller class for the RAKCHA application. Handles UI interactions
and manages view logic using FXML.
- Since:
- 1.0.0
- Version:
- 1.0.0
- Author:
- RAKCHA Team
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate javafx.scene.control.TextField
private javafx.scene.control.DatePicker
(package private) javafx.scene.control.TableColumn<User,
javafx.scene.control.DatePicker> (package private) javafx.scene.control.TableColumn<User,
javafx.scene.control.Button> private javafx.scene.control.TextField
private javafx.scene.control.TextField
(package private) net.synedra.validatorfx.Validator
(package private) javafx.scene.control.Tooltip
private javafx.scene.control.TextField
private javafx.scene.control.TextField
private static final Logger
private javafx.scene.control.TextField
private javafx.scene.control.TextField
private javafx.scene.image.ImageView
(package private) javafx.scene.control.TableColumn<User,
javafx.scene.layout.HBox> private javafx.scene.control.ComboBox<String>
(package private) net.synedra.validatorfx.Validator
(package private) javafx.scene.control.Tooltip
private javafx.scene.control.TableView<User>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) void
addAdmin
(javafx.event.ActionEvent event) /** Allows users to create a new admin account by providing their first name, last name, phone number, password, email, and role.private void
addValidationListener
(javafx.scene.control.TextField textField, Predicate<String> validationPredicate, String errorMessage) /** Adds a listener to a `TextField` that validates the inputted string using a provided `Predicate`. (package private) void
clearTextFields
(javafx.event.ActionEvent event) (package private) void
(package private) void
(package private) void
importImage
(javafx.event.ActionEvent event) (package private) void
Sets up user interface components for a table displaying information about users, including text fields, combo boxes, and validation listeners to ensure data validity.(package private) void
Reads data from a User Service and populates the user table view with the retrieved data.private void
Sets up cell factories for the `adresse` and `email` columns of the user table, which will display a text field for each column.private void
private void
Sets up cell value factories for each column of a table displaying information about users.void
signOut
(javafx.event.ActionEvent event) (package private) void
-
Field Details
-
LOGGER
-
roleTableColumn
-
photoDeProfilTableColumn
javafx.scene.control.TableColumn<User,javafx.scene.layout.HBox> photoDeProfilTableColumn -
lastNameTableColumn
-
passwordTableColumn
-
numTelTableColumn
-
firstNameTableColumn
-
dateDeNaissanceTableColumn
javafx.scene.control.TableColumn<User,javafx.scene.control.DatePicker> dateDeNaissanceTableColumn -
adresseTableColumn
-
emailTableColumn
-
deleteTableColumn
javafx.scene.control.TableColumn<User,javafx.scene.control.Button> deleteTableColumn -
formValidator
net.synedra.validatorfx.Validator formValidator -
tableValidator
net.synedra.validatorfx.Validator tableValidator -
formValidatorTooltip
javafx.scene.control.Tooltip formValidatorTooltip -
tableValidatorTooltip
javafx.scene.control.Tooltip tableValidatorTooltip -
adresseTextField
private javafx.scene.control.TextField adresseTextField -
dateDeNaissanceDatePicker
private javafx.scene.control.DatePicker dateDeNaissanceDatePicker -
emailTextField
private javafx.scene.control.TextField emailTextField -
idTextField
private javafx.scene.control.TextField idTextField -
firstNameTextField
private javafx.scene.control.TextField firstNameTextField -
phoneNumberTextField
private javafx.scene.control.TextField phoneNumberTextField -
passwordTextField
private javafx.scene.control.TextField passwordTextField -
photoDeProfilImageView
private javafx.scene.image.ImageView photoDeProfilImageView -
lastNameTextField
private javafx.scene.control.TextField lastNameTextField -
roleComboBox
-
userTableView
-
-
Constructor Details
-
AdminDashboardController
public AdminDashboardController()
-
-
Method Details
-
initialize
void initialize()Sets up user interface components for a table displaying information about users, including text fields, combo boxes, and validation listeners to ensure data validity. -
addValidationListener
private void addValidationListener(javafx.scene.control.TextField textField, Predicate<String> validationPredicate, String errorMessage) /** Adds a listener to a `TextField` that validates the inputted string using a provided `Predicate`. If the string is invalid, a tooltip with an error message is displayed near the text field. - Parameters:
textField
- TextField component whose text value will be validated and whose tooltip will be updated accordingly.validationPredicate
- function that determines whether or not a given string is valid, and it is used to determine whether an error message should be displayed when the user types something into the text field.errorMessage
- message to be displayed as a tooltip when the user enters an invalid value in the text field.
-
readUserTable
void readUserTable()Reads data from a User Service and populates the user table view with the retrieved data. -
addAdmin
void addAdmin(javafx.event.ActionEvent event) /** Allows users to create a new admin account by providing their first name, last name, phone number, password, email, and role. It then validates the input and creates a new admin user using the provided information.- Parameters:
event
- `addAdmin` action, triggering the execution of the code within the function.
-
setupCellValueFactories
private void setupCellValueFactories()Sets up cell value factories for each column of a table displaying information about users. These factories provide the content for each cell, such as a user's first or last name, phone number, password, role, address, date of birth, email, and photo profile picture. -
setupCellFactories
private void setupCellFactories()Sets up cell factories for the `adresse` and `email` columns of the user table, which will display a text field for each column. The `cellFactory` method is used to create TableCells that can display text data in a formatted way. -
setupCellOnEditCommit
private void setupCellOnEditCommit() -
clearTextFields
void clearTextFields(javafx.event.ActionEvent event) -
delete
-
importImage
void importImage(javafx.event.ActionEvent event) -
update
-
generatePDF
void generatePDF() -
signOut
- Throws:
IOException
-