Class AfficherProductClientControllers
- All Implemented Interfaces:
javafx.fxml.Initializable
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final List<javafx.scene.control.CheckBox>
private javafx.scene.layout.AnchorPane
private final Chat
private javafx.scene.layout.AnchorPane
javafx.scene.control.Button
private javafx.scene.control.ScrollPane
private org.kordamp.ikonli.javafx.FontIcon
private static final Logger
private javafx.scene.layout.AnchorPane
private javafx.scene.layout.FlowPane
private long
javafx.scene.control.TextField
javafx.scene.layout.FlowPane
private final List<javafx.scene.control.CheckBox>
private javafx.scene.layout.VBox
private javafx.scene.layout.FlowPane
private javafx.scene.layout.FlowPane
private javafx.scene.control.ComboBox<String>
private javafx.scene.control.TextArea
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) void
Allows users to input a comment on a product, checks for bad words and prevents further processing if found.(package private) void
AddComment
(javafx.scene.input.MouseEvent event) Adds a new comment to an item and displays all comments for that item upon button click.private javafx.scene.layout.HBox
addCommentToView
(Comment comment) Adds an comment to a view by creating an image view with the user's profile picture, adding it to a container with an image circle and a card for the comment, and then adding the container to the ScrollPane.private void
afficherShoppingCart
(Product produitAjoute) Clears the current pane, adds the newly added product to a new pane, and makes the updated pane visible while hiding other panes.private void
ajouterAuShoppingCart
(long produitId, int quantity) Adds a product to the shopping cart based on the product ID and quantity.(package private) void
cinemaclient
(javafx.event.ActionEvent event) Charges a new FXML interface, creates a new scene, and attaches it to a new stage, while also closing the current stage.void
Close
(javafx.scene.input.MouseEvent mouseEvent) Sets the opacity and visibility of a `FlowPane` component to control its appearance and accessibility.void
CloseFilter
(javafx.scene.input.MouseEvent mouseEvent) Sets the opacity and visibility of a `FlowPane` and its child elements, and hides an `Anchor` element.private javafx.scene.layout.VBox
createProductCard
(Product Product) Creates a Card component that displays the details of a product, including its image, name, description, price, and buttons for adding to cart or viewing comments.private void
createProductCards
(List<Product> produits) Creates a card for each `Product` object in the `produits` list and adds them to the `produitFlowPane`.private javafx.scene.layout.HBox
createShoppingCartCard
(Product produit) Generates a card for the shopping cart, containing the total quantity and price of each product, a "Continue Shopping" button, and an "Order Now" button.javafx.scene.layout.VBox
createtopthree
(Product produit) Generates a `VBox` container with three components: an image view, a label with the product name, and a label with the price.private void
displayAllComments
(Long idproduit) Retrieves and displays all comments associated with a product ID using a `VBox` container to hold the comment views and a `getChildren()` method to add them.(package private) void
eventClient
(javafx.event.ActionEvent event) Loads a new FXML interface, creates a new scene, and attaches it to a new stage when an event is triggered.private void
fermerShoppingCartCard
(javafx.scene.layout.HBox shoppingcartContainer) Makes a panel invisible and sets another panel's visibility and opacity to 1, effectively hiding the panel that was previously visible.private void
filterCategorieProducts
(String searchText) Filters a list of products based on a search text, by adding to an observable list only those products whose category name contains the search text.void
filtercinema
(javafx.event.ActionEvent event) Filters a list of products based on selected categories, updates the visible state of an anchor and a flow pane, and updates the list of displayed products.(package private) void
filtrer
(javafx.scene.input.MouseEvent event) Sets the opacity of a pane to 0.5, makes a panel visible, clears lists of check boxes and recieves unique addresses from a database for each category.Retrieves a list of all product categories from the service layer using the `ProductService`.getAllComment
(Long idproduit) Retrieves all comments for a given product ID, filters them to keep only those related to the specified cinema, and returns the filtered list of comments.Retrieves a list of category names from a database by mapping the categories to their respective names using the `getName_categorie()` method.Retrieves a list of selected addresses from an `AnchorPane` component and filters them based on the selected state of CheckBoxes within the pane.void
initialize
(URL location, ResourceBundle resources) Sets up UI components for searching and displaying produits, including a search bar, a filter category combo box, and a flow pane to display results.private void
Loads all products from a service and adds them to a flow pane using a recursive method.void
Retrieves and displays the top 3 products with the highest quantity and status from a service, creating a VBox for each product and adding it to a parent container.(package private) void
MovieClient
(javafx.event.ActionEvent event) Loads a new FXML interface using `FXMLLoader`, creates a new scene with it, and attaches the scene to a new stage.(package private) void
produitClient
(javafx.event.ActionEvent event) Loads a new FXML file, creates a new scene and stage, and replaces the current stage with the new one.(package private) void
profilclient
(javafx.event.ActionEvent event) Likely profiles a client application, possibly collecting data on its performance or behavior.rechercher
(List<Product> liste, String recherche) Searches for products in a list based on a given search term and returns a list of matching products.(package private) void
SerieClient
(javafx.event.ActionEvent event) Loads a new FXML interface, creates a new scene with it, and attaches the scene to a new stage, while closing the current stage.(package private) void
shoppingcart
(javafx.scene.input.MouseEvent event) Loads a new UI component (`ShoppingCartProduct.fxml`) when a button is clicked, creates a new scene with the loaded component, and attaches it to a new stage.private void
updateProductFlowPane
(List<Product> filteredProducts) Clears and re-adds a list of products to a flow pane, using a `VBox` container for each product.
-
Field Details
-
LOGGER
-
addressCheckBoxes
-
statusCheckBoxes
-
shoppingcartList
-
chat
-
shoppingcartFlowPane
public javafx.scene.layout.FlowPane shoppingcartFlowPane -
SearchBar
public javafx.scene.control.TextField SearchBar -
forward_message
public javafx.scene.control.Button forward_message -
filterAnchor
private javafx.scene.layout.AnchorPane filterAnchor -
produitFlowPane
private javafx.scene.layout.FlowPane produitFlowPane -
topproduitFlowPane
private javafx.scene.layout.FlowPane topproduitFlowPane -
idfilter
private org.kordamp.ikonli.javafx.FontIcon idfilter -
l1
-
produitId
private long produitId -
top3anchorpane
private javafx.scene.layout.VBox top3anchorpane -
topthreeVbox
private javafx.scene.layout.FlowPane topthreeVbox -
txtAreaComments
private javafx.scene.control.TextArea txtAreaComments -
idcomment
private javafx.scene.control.ScrollPane idcomment -
AnchorComments
private javafx.scene.layout.AnchorPane AnchorComments -
produitAnchor
private javafx.scene.layout.AnchorPane produitAnchor -
tricomboBox
-
-
Constructor Details
-
AfficherProductClientControllers
public AfficherProductClientControllers()
-
-
Method Details
-
rechercher
Searches for products in a list based on a given search term and returns a list of matching products.- Parameters:
liste
- list of products that will be searched for matches with the given search query.- It is a list of `Product` objects.
recherche
- search query used to filter the list of `Product` objects returned by the function.
-
initialize
Sets up UI components for searching and displaying produits, including a search bar, a filter category combo box, and a flow pane to display results. It also initializes a produitService object and sets up listeners for the search bar and category combo box to update the displayed produits.- Specified by:
initialize
in interfacejavafx.fxml.Initializable
- Parameters:
location
- URL of the web page that the function is initializing, which is used to load the accepted products and display them on the screen.- `URL location`: This represents a URL that provides information about the accepted products.
resources
- ResourceBundle object that provides localized messages and key for displaying comments and top3 produits.- `location`: The URL of the location where the application is running. - `resources`: A `ResourceBundle` object containing key-value pairs of resources used in the application.
-
loadAcceptedProducts
private void loadAcceptedProducts()Loads all products from a service and adds them to a flow pane using a recursive method. -
createProductCard
Creates a Card component that displays the details of a product, including its image, name, description, price, and buttons for adding to cart or viewing comments.- Parameters:
Product
- Product object that contains the details of the product being displayed, and it is used to access the product's properties and methods throughout the function, such as retrieving its name, price, and ID.- `id_produit`: The unique identifier for the product - `nom`: The product name - `description`: The product description - `prix`: The product price - `image`: The product image URL
-
afficherShoppingCart
Clears the current pane, adds the newly added product to a new pane, and makes the updated pane visible while hiding other panes.- Parameters:
produitAjoute
- product that is being added to the shopping cart, which is used to create a new `HBox` representing the product card and add it to the `shoppingcartFlowPane`.- `Product produitAjoute`: This is an instance of the `Product` class, representing a product added to the cart.
-
ajouterAuShoppingCart
private void ajouterAuShoppingCart(long produitId, int quantity) Adds a product to the shopping cart based on the product ID and quantity. It first verifies if the product is available, then creates a new shoppingcart object with the product details and user data, and finally adds it to the shoppingcart service for display in the user interface.- Parameters:
produitId
- ID of the product to be added to the cart.quantity
- number of items to be added to the shopping cart.
-
createProductCards
Creates a card for each `Product` object in the `produits` list and adds them to the `produitFlowPane`.- Parameters:
produits
- list of products to create cards for, and is used to iterate over the products in the list to create the cards.- `produits`: A list of `Product` objects, containing information about individual products.
-
createShoppingCartCard
Generates a card for the shopping cart, containing the total quantity and price of each product, a "Continue Shopping" button, and an "Order Now" button. When the "Continue Shopping" button is clicked, the stage closes and the order summary is displayed.- Parameters:
produit
- products to be added to the shopping cart, and it is used to display the product name and quantity in the `ShoppingCartProduct` FXML file.- `name`: the name of the product - `quantite`: the quantity of the product in the cart - `sommeTotale`: the total cost of the product in the cart - `imageView`: an image view of the product - `orderr`: a button to add the product to the cart or continue shopping.
-
fermerShoppingCartCard
private void fermerShoppingCartCard(javafx.scene.layout.HBox shoppingcartContainer) Makes a panel invisible and sets another panel's visibility and opacity to 1, effectively hiding the panel that was previously visible.- Parameters:
shoppingcartContainer
- HBox component that contains the panel containing the shopping cart.- `shoppingcartContainer`: A `HBox` component representing the container for the shoppingcart (basket) display.
-
shoppingcart
void shoppingcart(javafx.scene.input.MouseEvent event) Loads a new UI component (`ShoppingCartProduct.fxml`) when a button is clicked, creates a new scene with the loaded component, and attaches it to a new stage. The new stage is then displayed and the previous stage is closed.- Parameters:
event
- MouseEvent object that triggered the function, providing the source of the event and any relevant data.- Event source: The element that triggered the event (not specified).
-
filterCategorieProducts
Filters a list of products based on a search text, by adding to an observable list only those products whose category name contains the search text.- Parameters:
searchText
- search term used to filter the list of products.
-
getAllCategories
Retrieves a list of all product categories from the service layer using the `ProductService`. The list is then returned to the caller. -
filtrer
void filtrer(javafx.scene.input.MouseEvent event) Sets the opacity of a pane to 0.5, makes a panel visible, clears lists of check boxes and recieves unique addresses from a database for each category. It then creates VBoxes for the addresses and adds them to a parent pane, making the parent pane visible.- Parameters:
event
- mouse event that triggered the filtrer method, providing the source of the event and any relevant data.- `event`: A MouseEvent object representing the mouse event that triggered the function. - `MouseEvent.getX()` and `MouseEvent.getY()`: The coordinates of the mouse event in the parent coordinate system.
-
getProductCategory
Retrieves a list of category names from a database by mapping the categories to their respective names using the `getName_categorie()` method. -
filtercinema
public void filtercinema(javafx.event.ActionEvent event) Filters a list of products based on selected categories, updates the visible state of an anchor and a flow pane, and updates the list of displayed products.- Parameters:
event
- an action event triggered by the user, which initiates the filtering process of products based on selected categories.- Type: ActionEvent - Target: Unknown (since it's not explicitly specified) - Code: Unknown (since it's not explicitly specified)
-
updateProductFlowPane
Clears and re-adds a list of products to a flow pane, using a `VBox` container for each product.- Parameters:
filteredProducts
- list of products that have been filtered based on user input, and it is used to populate the `produitFlowPane` with only the relevant products.- `filteredProducts`: A list of `Product` objects that have been filtered based on some criteria.
-
getSelectedCategories
Retrieves a list of selected addresses from an `AnchorPane` component and filters them based on the selected state of CheckBoxes within the pane. -
cinemaclient
void cinemaclient(javafx.event.ActionEvent event) Charges a new FXML interface, creates a new scene, and attaches it to a new stage, while also closing the current stage.- Parameters:
event
- ActionEvent object that triggered the function execution, providing the source of the event and allowing the code to determine the appropriate action to take.- It is an `ActionEvent`, indicating that it represents an action taken on the user interface. - The source of the event is a `Node`, which represents the element in the user interface that triggered the event.
-
eventClient
void eventClient(javafx.event.ActionEvent event) Loads a new FXML interface, creates a new scene, and attaches it to a new stage when an event is triggered. The new stage replaces the current one, and the previous stage is closed.- Parameters:
event
- event that triggered the `eventClient()` method to be called, providing the necessary information for the method to perform its actions.- Event source: The object that generated the event, which is typically a button or other user interface element. - Event type: The type of event that was generated, such as a click or a key press.
-
produitClient
void produitClient(javafx.event.ActionEvent event) Loads a new FXML file, creates a new scene and stage, and replaces the current stage with the new one.- Parameters:
event
- ActionEvent object that triggered the function execution and provides access to the source element that caused the event, which in this case is an button click.- `event`: This represents an action event that occurred in the application. It provides information about the source of the event and its associated actions.
-
profilclient
void profilclient(javafx.event.ActionEvent event) Likely profiles a client application, possibly collecting data on its performance or behavior.- Parameters:
event
- occurrence of an action event that triggered the execution of the `profilclient` function.
-
MovieClient
void MovieClient(javafx.event.ActionEvent event) Loads a new FXML interface using `FXMLLoader`, creates a new scene with it, and attaches the scene to a new stage. It also closes the current stage.- Parameters:
event
- ActionEvent object that triggered the function execution, providing the source of the event and allowing the code to access the relevant information related to the event.- It is an `ActionEvent` representing a user interaction with the application. - The source of the event is the `FXMLLoader` instance that loaded the `filmuser.fxml` file. - The event provides access to the stage and scene associated with the event, which are used to create a new window and replace the current one.
-
SerieClient
void SerieClient(javafx.event.ActionEvent event) Loads a new FXML interface, creates a new scene with it, and attaches the scene to a new stage, while closing the current stage.- Parameters:
event
- ActionEvent object that triggered the function execution, providing information about the source of the event and allowing the code to handle the appropriate action.- It is an `ActionEvent` object representing a user action that triggered the function execution. - The source of the event is typically a button or other widget in the user interface. - The event may carry additional information such as the ID of the button pressed, the modifiers used, and so on.
-
addComment
void addComment()Allows users to input a comment on a product, checks for bad words and prevents further processing if found. If no bad words are detected, it creates a new `Comment` object with the client information and product ID, and adds it to the database using the `CommentService`. -
getAllComment
Retrieves all comments for a given product ID, filters them to keep only those related to the specified cinema, and returns the filtered list of comments.- Parameters:
idproduit
- id of the product for which the comments are to be filtered and returned.
-
displayAllComments
Retrieves and displays all comments associated with a product ID using a `VBox` container to hold the comment views and a `getChildren()` method to add them.- Parameters:
idproduit
- product ID used to retrieve all comments associated with it.
-
AddComment
void AddComment(javafx.scene.input.MouseEvent event) Adds a new comment to an item and displays all comments for that item upon button click.- Parameters:
event
- mouse event that triggered the `AddComment` method, providing the context for the comment creation and display.- `MouseEvent event`: This parameter represents an event object that contains information about the mouse action that triggered the function. Specifically, it provides details on the button pressed (left or right), the location of the click within the parent container, and the state of other buttons.
-
addCommentToView
Adds an comment to a view by creating an image view with the user's profile picture, adding it to a container with an image circle and a card for the comment, and then adding the container to the ScrollPane.- Parameters:
comment
- Comment object containing information about the user's comment, including the client's name and the comment text.- `client`: The client who made the comment (a `CommentClient`) - `photo_de_profil`: The image URL of the user who made the comment (a `String`)
-
Close
public void Close(javafx.scene.input.MouseEvent mouseEvent) Sets the opacity and visibility of a `FlowPane` component to control its appearance and accessibility.- Parameters:
mouseEvent
- MouseEvent object that triggered the `Close` method.- The `mouseEvent` instance represents an event triggered by a mouse action, such as a click or a drag. - It contains information about the event, including the location of the event on the screen and the type of event that occurred.
-
CloseFilter
public void CloseFilter(javafx.scene.input.MouseEvent mouseEvent) Sets the opacity and visibility of a `FlowPane` and its child elements, and hides an `Anchor` element.- Parameters:
mouseEvent
- mouse event that triggered the `CloseFilter()` method, providing information about the location and nature of the event.- `mouseEvent`: The event object representing the mouse action that triggered the function.
-
loadAcceptedTop3
public void loadAcceptedTop3()Retrieves and displays the top 3 products with the highest quantity and status from a service, creating a VBox for each product and adding it to a parent container. -
createtopthree
Generates a `VBox` container with three components: an image view, a label with the product name, and a label with the price. The image view displays an image of the product, while the labels display the product name and price.- Parameters:
produit
- `Product` object that contains information about the product to be displayed, including its name, image, and price.- `nom`: the product name - `image`: the image URL or a default image if null - `prix`: the product price in DT (Djibouti Francs)
-