Class DetailsProductClientController
- All Implemented Interfaces:
javafx.fxml.Initializable
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate javafx.scene.control.Button
private javafx.scene.layout.AnchorPane
javafx.scene.layout.FlowPane
private static final Logger
private Long
private final int
private org.kordamp.ikonli.javafx.FontIcon
javafx.scene.control.TextField
(package private) ShoppingCart
private javafx.scene.layout.AnchorPane
javafx.scene.layout.FlowPane
(package private) ShoppingCartService
private javafx.scene.layout.AnchorPane
private javafx.scene.layout.FlowPane
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Loads an FXML page, creates a new stage for it, and shows it modally, closing the previous stage.private void
Sets the visibility of a `FlowPane` and its child elements to true, with the `opacity` of one of the child elements set to 0.2.private void
ajouterAuShoppingCart
(long produitId, int quantity) Adds a product to the shopping cart based on available stock, retrieves product details and user information, creates a new shoppingcart object, and displays the updated shoppingcart.(package private) void
cinemaclient
(javafx.event.ActionEvent event) Loads a new UI scene (`CommentaireProduct.fxml`) into an existing stage when an action event is triggered, replacing the current scene and closing the previous stage.(package private) void
commentaire
(javafx.scene.input.MouseEvent event) Loads a new user interface using an FXML loader, creates a new scene, and attaches it to a new stage when an event is triggered.private javafx.scene.layout.HBox
createProductCard
(Product produit) Creates a scene containing a card for a product, with an image, name, description, price, rating, and a "Add to Cart" button.private javafx.scene.layout.HBox
createShoppingCartCard
(Product produit) Creates a `Card` object that displays the cart contents, includes a "Continue Shopping" button and an icon for closing the card.javafx.scene.layout.VBox
createtopthree
(Product produit) Generates a `VBox` container that displays a product's name, price, and image.(package private) void
eventClient
(javafx.event.ActionEvent event) Loads a new FXML file, creates a new scene and stage, and replaces the current stage with the new one.private void
fermerShoppingCartCard
(javafx.scene.layout.HBox shoppingcartContainer) Renders the cart card invisible, makes the `shoppingcartFlowPane` and `detailFlowPane` visible and sets their opacity to 1.int
Returns the value of the `quantiteSelectionnee` field.private void
Retrieves a product from a service using its ID, verifies if the product is found, and adds a card for the product to a `FlowPane` if it exists, and also adds a card for the product's cart to another `FlowPane`.void
initialize
(URL location, ResourceBundle resources) Loads a list of top-3 accepted products and attaches an event handler to the icon's mouse click, which displays the product when clicked.void
Retrieves and displays a list of the top 3 best-selling products based on their quantity and status, using a ProductService instance to retrieve the data and create card containers for each product.(package private) void
MovieClient
(javafx.event.ActionEvent event) Loads a new user interface (`filmuser.fxml`) using the `FXMLLoader`, creates a new scene with it, and attaches it to a new stage.private double
prixProduct
(Long idProduct, int quantity) Calculates the total price of a product based on its ID and quantity.(package private) void
produitClient
(javafx.event.ActionEvent event) Loads a new FXML file, creates a new scene, and attaches it to a new stage, replacing the current stage.(package private) void
profilclient
(javafx.event.ActionEvent event) Appears to be a Java method that handles an `ActionEvent`.(package private) void
SerieClient
(javafx.event.ActionEvent event) Loads a new FXML file, creates a new scene and attaches it to a new stage, replacing the current stage.void
setProductId
(Long produitId) Sets the `produitId` field to a given value, then initializes details of the product based on the set ID.(package private) void
shoppingcart
(javafx.scene.input.MouseEvent event) Loads a new FXML interface, creates a new scene and attaches it to a new stage, replacing the current stage, and closes the original stage.
-
Field Details
-
LOGGER
-
quantiteSelectionnee
private final int quantiteSelectionnee- See Also:
-
detailFlowPane
public javafx.scene.layout.FlowPane detailFlowPane -
shoppingcartFlowPane
public javafx.scene.layout.FlowPane shoppingcartFlowPane -
SearchBar
public javafx.scene.control.TextField SearchBar -
shoppingcartService
ShoppingCartService shoppingcartService -
shoppingcart
ShoppingCart shoppingcart -
anchordetail
private javafx.scene.layout.AnchorPane anchordetail -
shoppingcartAnchorPane
private javafx.scene.layout.AnchorPane shoppingcartAnchorPane -
retour
private org.kordamp.ikonli.javafx.FontIcon retour -
produitId
-
addToCartButton
private javafx.scene.control.Button addToCartButton -
top3anchorpane
private javafx.scene.layout.AnchorPane top3anchorpane -
topthreeVbox
private javafx.scene.layout.FlowPane topthreeVbox
-
-
Constructor Details
-
DetailsProductClientController
public DetailsProductClientController()
-
-
Method Details
-
setProductId
Sets the `produitId` field to a given value, then initializes details of the product based on the set ID.- Parameters:
produitId
- ID of the product to which the method is being called, and it is used to store the value in the field `this.produitId`.- Throws:
IOException
-
initialize
Loads a list of top-3 accepted products and attaches an event handler to the icon's mouse click, which displays the product when clicked.- Specified by:
initialize
in interfacejavafx.fxml.Initializable
- Parameters:
location
- URL of the resource to be initialized, which is used to load the accepted top-3 products when the function is called.Location refers to an URL that provides the root resource of the application. It represents the base URL of the application and is used in loading accepted top 3.
resources
- ResourceBundle containing keys for localized strings, which are used to display product information when the user clicks on the icon.- `location`: A URL object representing the location of the application. - `resources`: A ResourceBundle object providing key-value pairs of resource strings in different languages.
-
getQuantiteSelectionnee
public int getQuantiteSelectionnee()Returns the value of the `quantiteSelectionnee` field. -
initDetailsProduct
private void initDetailsProduct()Retrieves a product from a service using its ID, verifies if the product is found, and adds a card for the product to a `FlowPane` if it exists, and also adds a card for the product's cart to another `FlowPane`. -
createProductCard
Creates a scene containing a card for a product, with an image, name, description, price, rating, and a "Add to Cart" button. The rating is calculated based on the average rating of the product and displayed as a number of stars out of 5. When the "Add to Cart" button is clicked, the function deletes any existing rating for the product and creates a new rating with the current rating value.- Parameters:
produit
- Product object that is being displayed in the detail view, and it is used to retrieve the product's ID, name, image URL, price, and rating for display in the corresponding Card element.- `id_produit`: an integer representing the product ID - `nom`: a string representing the product name - `description`: a string representing the product description - `prix`: a double representing the product price - `imagePath`: a string representing the path to the product image
Note: These properties are not explained in detail as they are already defined in the function.
-
ajouterAuShoppingCart
private void ajouterAuShoppingCart(long produitId, int quantity) Adds a product to the shopping cart based on available stock, retrieves product details and user information, creates a new shoppingcart object, and displays the updated shoppingcart.- Parameters:
produitId
- ID of the product to be added to the cart.quantity
- quantity of the product that the user wants to add to the cart.
-
afficherProduct
public void afficherProduct()Loads an FXML page, creates a new stage for it, and shows it modally, closing the previous stage. -
affichershoppingcart
private void affichershoppingcart()Sets the visibility of a `FlowPane` and its child elements to true, with the `opacity` of one of the child elements set to 0.2. -
createShoppingCartCard
Creates a `Card` object that displays the cart contents, includes a "Continue Shopping" button and an icon for closing the card. It also sets up event handlers for closing the card and the "Continue Shopping" button.- Parameters:
produit
- product to be displayed in the shopping cart card, which is used to set the corresponding labels and images for each product in the shoppingcart.- `name`: The name of the product. - `imageUrl`: The URL of the product image. - `price`: The price of the product in euros. - `quantite`: The quantity of the product in stock. - `sommeTotale`: The total cost of the product in euros, calculated by multiplying the quantity by the price.
-
prixProduct
Calculates the total price of a product based on its ID and quantity. It retrieves the unitarian price of the product from the `ProductService` class and multiplies it by the input quantity to obtain the total price.- Parameters:
idProduct
- ID of the product for which the price is being calculated.quantity
- number of products to be priced, and is multiplied by the unit price returned by the `getPriceProduct()` method to calculate the total price for the specified quantity of products.
-
fermerShoppingCartCard
private void fermerShoppingCartCard(javafx.scene.layout.HBox shoppingcartContainer) Renders the cart card invisible, makes the `shoppingcartFlowPane` and `detailFlowPane` visible and sets their opacity to 1. Additionally, it makes the `anchordetail` and `top3anchorpane` visible and sets their opacity to 1.- Parameters:
shoppingcartContainer
- `HBox` container that holds the `FlowPane` representing the shopping cart, which is rendered invisible when the function is called.- `shoppingcartContainer` is an instance of `HBox`. - It contains a `FlowPane` and other components.
-
shoppingcart
void shoppingcart(javafx.scene.input.MouseEvent event) Loads a new FXML interface, creates a new scene and attaches it to a new stage, replacing the current stage, and closes the original stage.- Parameters:
event
- MouseEvent object that triggered the function execution, providing information about the mouse click or other event that occurred.- Event source: The element that triggered the event (not shown) - Type: The type of event (not shown) - X and Y coordinates: The position of the event relative to the element (not shown)
-
commentaire
void commentaire(javafx.scene.input.MouseEvent event) Loads a new user interface using an FXML loader, creates a new scene, and attaches it to a new stage when an event is triggered. It also closes the current stage upon execution.- Parameters:
event
- MouseEvent that triggered the function execution, providing information about the mouse click or other event that occurred in the FXML document.- It is a `MouseEvent` object representing a mouse event that triggered the function's execution. - The source of the event is the element that was clicked or hovered over, which is not explicitly stated in the code snippet provided.
-
cinemaclient
void cinemaclient(javafx.event.ActionEvent event) Loads a new UI scene (`CommentaireProduct.fxml`) into an existing stage when an action event is triggered, replacing the current scene and closing the previous stage.- Parameters:
event
- ActionEvent object that triggered the function execution, providing the source of the event and allowing the code to access its related information.- `event`: an ActionEvent object representing the event triggered by the user's action, such as clicking on a button or entering text in a field.
-
eventClient
void eventClient(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
- EventObject that triggered the method, providing access to information about the event, such as its source and details, which can be used to handle the event appropriately.- Event object contains information about the event that triggered the function, such as the source element and the type of event.
-
produitClient
void produitClient(javafx.event.ActionEvent event) Loads a new FXML file, creates a new scene, and attaches it to a new stage, replacing the current stage. It also closes the current stage.- Parameters:
event
- ActionEvent object that triggered the function execution, providing the source of the action and allowing the code to access the event details.- Event source: The object that triggered the event (in this case, a button press) - Type of event: The type of event that was triggered (in this case, an action event)
-
profilclient
void profilclient(javafx.event.ActionEvent event) Appears to be a Java method that handles an `ActionEvent`. It does not provide any information about the code author or licensing, and its purpose is not explicitly stated in the provided code snippet.- Parameters:
event
- client profile data that triggered the execution of the `profilclient` method.
-
MovieClient
void MovieClient(javafx.event.ActionEvent event) Loads a new user interface (`filmuser.fxml`) using the `FXMLLoader`, creates a new scene with it, and attaches it to a new stage. It also closes the current stage and displays the new one.- Parameters:
event
- ActionEvent object that triggered the function execution, providing information about the source of the event and the type of action performed.- Event source: The object that generated the event, which is typically a button or other user interface element.
-
SerieClient
void SerieClient(javafx.event.ActionEvent event) Loads a new FXML file, creates a new scene and attaches it to a new stage, replacing the current stage.- Parameters:
event
- ActionEvent object that triggered the `SeriesClient()` method, providing information about the source of the event and allowing the method to determine the appropriate action to take.- Event source: The origin of the event, which is an instance of the `ActionEvent` class. - Parameter: An optional parameter associated with the event, which can be of any type.
-
loadAcceptedTop3
public void loadAcceptedTop3()Retrieves and displays a list of the top 3 best-selling products based on their quantity and status, using a ProductService instance to retrieve the data and create card containers for each product. -
createtopthree
Generates a `VBox` container that displays a product's name, price, and image. The image is loaded from an URL or a default image if null, and the name and price are displayed with font style and size. When the product name is clicked, a new stage displaying details of the product is opened.- Parameters:
produit
- Product object that contains information about the product, including its name, image, and price, which are used to create the UI elements and display them in the card container.- `id_produit`: an integer representing the product ID. - `nom`: the product name. - `prix`: the product price. - `image`: a Blob object containing the image of the product (optional).
-