Class CommentProductController

java.lang.Object
com.esprit.controllers.products.CommentProductController
All Implemented Interfaces:
javafx.fxml.Initializable

public class CommentProductController extends Object implements javafx.fxml.Initializable
Is responsible for handling user actions related to the "Comment Product" section of the application. It contains methods that handle the creation of new stages and scenes, as well as the closing of existing stages. The controller also handles events related to the "Event", "ProductClient", "MovieClient", and "SerieClient" sections.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final Chat
     
    private javafx.scene.layout.FlowPane
     
    private static final Logger
     
    private javafx.scene.control.TextArea
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    (package private) void
    addchat(javafx.event.ActionEvent actionEvent)
    Takes a user message as input and processes it by detecting if it contains any bad words, and if so, displays an alert message.
    (package private) void
    cinemaclient(javafx.event.ActionEvent event)
    Loads a new user interface (`CommentProduct.fxml`) when the `ActionEvent` is triggered, creates a new stage with the loaded scene, and replaces the current stage with the new one.
    javafx.scene.layout.HBox
    Creates a `HBox` containing the commentary and the author's name, using a `CommentService` to retrieve the comments and a `FlowPane` to display the `HBox`.
    (package private) void
    eventClient(javafx.event.ActionEvent event)
    Loads a new FXML interface when an event is triggered, creates a new scene with the loaded interface, and attaches it to a new stage, replacing the current stage.
    void
    initialize(URL location, ResourceBundle resources)
    Initializes the application by loading a accepted comment resource.
    private void
    Retrieves comments from a service, creates a card for each comment, and adds them to a `FlowPane`.
    (package private) void
    MovieClient(javafx.event.ActionEvent event)
    Creates a new scene with an FXML file, loads it, and displays it as a new stage.
    (package private) void
    produitClient(javafx.event.ActionEvent event)
    Loads a new FXML interface, creates a new scene, and attaches it to a new stage, replacing the current stage.
    (package private) void
    profilclient(javafx.event.ActionEvent event)
    Likely profiles client-side code execution, possibly monitoring performance or memory usage for optimization purposes.
    (package private) void
    SerieClient(javafx.event.ActionEvent event)
    Loads a new FXML interface, creates a new scene, and attaches it to a new stage.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • LOGGER

      private static final Logger LOGGER
    • chat

      private final Chat chat
    • CommentFlowPane

      private javafx.scene.layout.FlowPane CommentFlowPane
    • monCommentaitreText

      private javafx.scene.control.TextArea monCommentaitreText
  • Constructor Details

    • CommentProductController

      public CommentProductController()
  • Method Details

    • addchat

      void addchat(javafx.event.ActionEvent actionEvent)
      Takes a user message as input and processes it by detecting if it contains any bad words, and if so, displays an alert message. If the message is clean, it creates a new comment object and saves it to the database.
      Parameters:
      actionEvent - event that triggers the execution of the `addChat()` method, which in this case is a user pressing the "Enter" key while focused on the chat field.

      - Type: ActionEvent - Target: FXML - Origin: User interface element (not specified)

    • initialize

      public void initialize(URL location, ResourceBundle resources)
      Initializes the application by loading a accepted comment resource.
      Specified by:
      initialize in interface javafx.fxml.Initializable
      Parameters:
      location - URL of the initial resource to be loaded and is used to set the starting point for the loading process.
      resources - ResourceBundle containing localized messages and values for the application, which is used by the `loadAcceptedComment()` method to access translated strings and other resources.
    • loadAcceptedComment

      private void loadAcceptedComment()
      Retrieves comments from a service, creates a card for each comment, and adds them to a `FlowPane`.
    • createcommentcard

      public javafx.scene.layout.HBox createcommentcard(Comment comm)
      Creates a `HBox` containing the commentary and the author's name, using a `CommentService` to retrieve the comments and a `FlowPane` to display the `HBox`.
      Parameters:
      comm - `Comment` object that contains information about a particular comment, which is to be displayed on a card.

      - `comm` is an instance of `Comment`, representing a comment made by a user on a website. - `comm.getClient()` returns a `Client` object, containing information about the user who made the comment. - `comm.getComment()` returns the actual comment text made by the user.

    • cinemaclient

      void cinemaclient(javafx.event.ActionEvent event)
      Loads a new user interface (`CommentProduct.fxml`) when the `ActionEvent` is triggered, creates a new stage with the loaded scene, and replaces the current stage with the new one.
      Parameters:
      event - ActionEvent object that triggered the function execution, providing the source of the event and allowing for proper handling of the corresponding action.

      - `event`: An ActionEvent object representing a user event, such as clicking a button or pressing a key.

    • eventClient

      void eventClient(javafx.event.ActionEvent event)
      Loads a new FXML interface when an event is triggered, creates a new scene with the loaded interface, and attaches it to a new stage, replacing the current stage.
      Parameters:
      event - ActionEvent object that triggered the event handler method, providing information about the source of the event and any associated data.

      - It is an instance of `ActionEvent`, which represents an action event that occurred in the application. - It has various properties related to the event, such as the source of the event (e.g., a button click), the event type (e.g., "click"), and any additional data associated with the event.

    • produitClient

      void produitClient(javafx.event.ActionEvent event)
      Loads a new FXML interface, creates a new scene, and attaches it to a new stage, replacing the current stage.
      Parameters:
      event - ActionEvent object that triggered the function execution, providing information about the action that was performed, such as the source of the event and the ID of the action.

      - Type: ActionEvent - Source: Node (the object that triggered the event)

    • profilclient

      void profilclient(javafx.event.ActionEvent event)
      Likely profiles client-side code execution, possibly monitoring performance or memory usage for optimization purposes.
      Parameters:
      event - occurrence of an action event that triggered the execution of the `profilclient` function.
    • MovieClient

      void MovieClient(javafx.event.ActionEvent event)
      Creates a new scene with an FXML file, loads it, and displays it as a new stage. It also closes the current stage.
      Parameters:
      event - ActionEvent that triggered the function execution, providing the necessary information to load and display the new FXML interface.

      - `event`: An ActionEvent object representing a user action that triggered the function to run. - `source`: The source of the event, which is typically a button or other UI element.

    • SerieClient

      void SerieClient(javafx.event.ActionEvent event)
      Loads a new FXML interface, creates a new scene, and attaches it to a new stage. It then closes the current stage and displays the new one.
      Parameters:
      event - EventObject that triggered the `SeriesClient` method to be called, providing access to information about the event such as the source of the event.

      - It is an instance of `ActionEvent`, which represents an action event occurring in the JavaFX application. - The source of the event is a `Node` object, which represents the element that triggered the event.