Class SerieController

java.lang.Object
com.esprit.controllers.series.SerieController

public class SerieController extends Object
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

    Fields
    Modifier and Type
    Field
    Description
    private javafx.scene.control.Label
     
    private javafx.scene.control.ComboBox<String>
     
    private List<Category>
     
    private javafx.scene.control.Label
     
    private javafx.scene.control.TextField
     
    private javafx.scene.control.Label
     
    (package private) String
     
    private static final Logger
     
    private javafx.scene.control.Label
     
    private javafx.scene.control.TextField
     
    private javafx.scene.control.Label
     
    private javafx.scene.control.TextField
     
    private javafx.scene.control.Label
     
    private javafx.scene.control.TextField
     
    javafx.scene.image.ImageView
     
    private javafx.scene.control.TableView<Series>
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    (package private) void
    addimg(javafx.event.ActionEvent event)
    Enables users to choose an image from their local computer and stores its path in a variable called `imgpath`.
    (package private) void
    ajouterSerie(javafx.event.ActionEvent event)
    Allows users to create a new serie by inputting necessary information such as name, category, director, pay, and resume.
    (package private) boolean
    Verifies if a category has been selected and returns `true` if it has, otherwise it displays an error message and returns `false`.
    (package private) boolean
    Verifies if a director's name is provided and returns `true` if it is valid, else it sets an error message and returns `false`.
    private void
    exportPdf(javafx.event.ActionEvent event)
    /** Generates a PDF document containing a table with columns for description, date, and episode number, based on feedback data.
    Retrieves the image path.
    (package private) boolean
    Checks if an input image path is provided, returning `true` if valid and "Please select a Picture" otherwise.
    (package private) void
    importImage(javafx.event.ActionEvent event)
    Allows the user to select an image file, then saves it in two different locations and sets the image as the `serieImageView` field.
    private void
    References a code resource denoted by `ref()`.
    private boolean
    Takes a `File` object as input and returns a `Boolean` value indicating whether the file is an image file or not.
    private void
    /** Modifies a serie's information by displaying a dialog box to enter and validate the values of name, summary, director, country, add image, and categories, and then updating the serie with the new information.
    (package private) boolean
    Checks if the user's entered name is empty, and returns `true` otherwise it sets the text to "Please enter a valid Name" and returns `false`.
    (package private) void
    Oepisode(javafx.event.ActionEvent event)
    Loads an FXML file, creates a scene from it, and displays the scene on the primary Stage.
    (package private) void
    Oepisodes(javafx.event.ActionEvent event)
    Loads an FXML file, creates a scene, and displays it on a Stage.
    (package private) void
    Oseries(javafx.event.ActionEvent event)
    Loads a FXML file named `"/ui/series/Serie-view.fxml"` and displays it on a Stage, creating a new Scene and setting it as the scene of the Stage.
    (package private) boolean
    Checks if the user has entered a valid country by comparing the inputted string to an empty string.
    private void
    ref()
    1/ Clears the content of `tableView`, `categorieF`, and other fields.
    (package private) boolean
    Verifies if the user has entered a non-empty string in the `resumeF` field.
    void
    sendEmail(String recipientEmail, String subject, String message)
    Sends an HTML-formatted email to a recipient via Gmail's SMTP service, using authentication and STARTTLS protocol for encryption.
    private void
    showAlert(String title, String message)
    Creates an alert box with a title and message and displays it using the `showAndWait()` method.
    void
    showcinema(javafx.event.ActionEvent actionEvent)
    Is called when the `ActionEvent` occurs, and it does not provide any information about what it does beyond the fact that it exists.
    void
    showevent(javafx.event.ActionEvent actionEvent)
    Handles an `ActionEvent`.
    void
    showmovies(javafx.event.ActionEvent actionEvent)
    Displays a list of movies to the user.
    void
    showproducts(javafx.event.ActionEvent actionEvent)
    Likely displays a list or inventory of products.
    void
    showseries(javafx.event.ActionEvent actionEvent)
    Likely displays a series of data or elements in a graphical interface.

    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
    • serieImageView

      public javafx.scene.image.ImageView serieImageView
    • imgpath

      String imgpath
    • categoriecheck

      private javafx.scene.control.Label categoriecheck
    • directeurcheck

      private javafx.scene.control.Label directeurcheck
    • imagechek

      private javafx.scene.control.Label imagechek
    • nomcheck

      private javafx.scene.control.Label nomcheck
    • payscheck

      private javafx.scene.control.Label payscheck
    • resumecheck

      private javafx.scene.control.Label resumecheck
    • nomF

      private javafx.scene.control.TextField nomF
    • resumeF

      private javafx.scene.control.TextField resumeF
    • directeurF

      private javafx.scene.control.TextField directeurF
    • paysF

      private javafx.scene.control.TextField paysF
    • categorieF

      private javafx.scene.control.ComboBox<String> categorieF
    • categorieList

      private List<Category> categorieList
    • tableView

      private javafx.scene.control.TableView<Series> tableView
  • Constructor Details

    • SerieController

      public SerieController()
  • Method Details

    • ref

      private void ref()
      1/ Clears the content of `tableView`, `categorieF`, and other fields. 2/ Recovers categories and series from a database using `IServiceCategorieImpl` and `IServiceSerieImpl`. 3/ Adds recovered categories to `tableView` and sets their cells. 4/ Creates new columns for editing and deleting series. 5/ Initializes buttons for editing and deleting series. 6/ Updates the graphic of each cell based on its state (empty or not).
    • exportPdf

      private void exportPdf(javafx.event.ActionEvent event)
      /** Generates a PDF document containing a table with columns for description, date, and episode number, based on feedback data.
      Parameters:
      event - An action event that triggers the function execution, providing the user's feedback selection.
    • modifierSerie

      private void modifierSerie(Series serieDto)
      /** Modifies a serie's information by displaying a dialog box to enter and validate the values of name, summary, director, country, add image, and categories, and then updating the serie with the new information.
      Parameters:
      serieDto - data for a serie that is being modified, which includes the serie's ID, name, summary, director, country, and image, as well as its category(ies).
    • initialize

      private void initialize()
      References a code resource denoted by `ref()`.
    • showAlert

      private void showAlert(String title, String message)
      Creates an alert box with a title and message and displays it using the `showAndWait()` method.
      Parameters:
      title - title of an alert message shown by the `showAlert` method, which is displayed in a title bar at the top of the window.
      message - message to be displayed in the Alert dialog box.
    • addimg

      void addimg(javafx.event.ActionEvent event)
      Enables users to choose an image from their local computer and stores its path in a variable called `imgpath`. If an invalid file is selected, an error message is displayed.
      Parameters:
      event - selection event triggered by the user selecting an image file using the FileChooser, and it provides the path of the selected file to the `addimg` method for processing.
    • importImage

      void importImage(javafx.event.ActionEvent event)
      Allows the user to select an image file, then saves it in two different locations and sets the image as the `serieImageView` field.
      Parameters:
      event - open file dialog event that triggers the function to execute.
    • getFilePath

      public String getFilePath()
      Retrieves the image path.
    • isImageFile

      private boolean isImageFile(File file)
      Takes a `File` object as input and returns a `Boolean` value indicating whether the file is an image file or not. It does so by attempting to create an `Image` object from the file's URI string, and returning `true` if the creation was successful and `false` otherwise.
      Parameters:
      file - File to be tested for being an image file.
    • nomcheck

      boolean nomcheck()
      Checks if the user's entered name is empty, and returns `true` otherwise it sets the text to "Please enter a valid Name" and returns `false`.
    • categoriecheck

      boolean categoriecheck()
      Verifies if a category has been selected and returns `true` if it has, otherwise it displays an error message and returns `false`.
    • directeurcheck

      boolean directeurcheck()
      Verifies if a director's name is provided and returns `true` if it is valid, else it sets an error message and returns `false`.
    • payscheck

      boolean payscheck()
      Checks if the user has entered a valid country by comparing the inputted string to an empty string. If it is not empty, the function returns true, otherwise it displays an error message and returns false.
    • resumecheck

      boolean resumecheck()
      Verifies if the user has entered a non-empty string in the `resumeF` field. If the field is not empty, it returns `true`. Otherwise, it sets the text of the `resumecheck` label to "Please enter a valid Summary" and returns `false`.
    • imagechek

      boolean imagechek()
      Checks if an input image path is provided, returning `true` if valid and "Please select a Picture" otherwise.
    • sendEmail

      public void sendEmail(String recipientEmail, String subject, String message)
      Sends an HTML-formatted email to a recipient via Gmail's SMTP service, using authentication and STARTTLS protocol for encryption.
      Parameters:
      recipientEmail - email address of the intended recipient of the email message being sent.
      subject - subject of the email to be sent, which is used as the email's title in the recipient's inbox.
      message - message that will be sent through the email, and it is passed as a string to the `setMsg()` method of the `Email` class.
    • ajouterSerie

      void ajouterSerie(javafx.event.ActionEvent event)
      Allows users to create a new serie by inputting necessary information such as name, category, director, pay, and resume. The function then checks if all fields are filled in correctly, and if so, adds the series to a list of saved series and sends an email notification to a predefined recipient with details about the newly added serie.
      Parameters:
      event - ClickEvent that triggers the execution of the `ajouterSerie()` method and provides information about the event, such as the button or component that was clicked.
    • Oepisodes

      void Oepisodes(javafx.event.ActionEvent event) throws IOException
      Loads an FXML file, creates a scene, and displays it on a Stage.
      Parameters:
      event - action event that triggered the execution of the `Oepisodes()` method, providing the source of the event as an object that can be referenced and used within the method.
      Throws:
      IOException
    • Oseries

      void Oseries(javafx.event.ActionEvent event) throws IOException
      Loads a FXML file named `"/ui/series/Serie-view.fxml"` and displays it on a Stage, creating a new Scene and setting it as the scene of the Stage.
      Parameters:
      event - An action event object that triggers the `Oseries` method and provides information about the event, such as the source of the event and the state of the stage.
      Throws:
      IOException
    • Oepisode

      void Oepisode(javafx.event.ActionEvent event) throws IOException
      Loads an FXML file, creates a scene from it, and displays the scene on the primary Stage.
      Parameters:
      event - ActionEvent object that triggers the function, providing information about the source of the event and any related data.
      Throws:
      IOException
    • showmovies

      public void showmovies(javafx.event.ActionEvent actionEvent)
      Displays a list of movies to the user.
      Parameters:
      actionEvent - occurrence of an event that triggered the function call.
    • showproducts

      public void showproducts(javafx.event.ActionEvent actionEvent)
      Likely displays a list or inventory of products.
      Parameters:
      actionEvent - occurrence of an event that triggers the execution of the `showProducts` method.
    • showcinema

      public void showcinema(javafx.event.ActionEvent actionEvent)
      Is called when the `ActionEvent` occurs, and it does not provide any information about what it does beyond the fact that it exists.
      Parameters:
      actionEvent - event that triggered the execution of the `show cinema` function.
    • showevent

      public void showevent(javafx.event.ActionEvent actionEvent)
      Handles an `ActionEvent`.
      Parameters:
      actionEvent - event that triggered the function call.
    • showseries

      public void showseries(javafx.event.ActionEvent actionEvent)
      Likely displays a series of data or elements in a graphical interface.
      Parameters:
      actionEvent - event that triggered the call to the `showSeries` function.