Class EpisodeController

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

public class EpisodeController 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
    static final String
     
    static final String
     
    javafx.scene.image.ImageView
     
    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.Label
     
    private javafx.scene.control.ComboBox<String>
     
    private List<Series>
     
    private javafx.scene.control.TableView<Episode>
     
    private javafx.scene.control.Label
     
    private javafx.scene.control.TextField
     
    private javafx.scene.control.Label
     
    private String
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    (package private) void
    addimg(javafx.event.ActionEvent event)
    Allows users to select an image file using a FileChooser, stores the file path in `imgpath`, and sets the image using `Image`.
    (package private) void
    addVideo(javafx.event.ActionEvent event)
    Enables the user to select a video file from their computer, and if a valid video file is selected, it stores the file path in a variable called `videopath`.
    (package private) void
    ajouterSerie(javafx.event.ActionEvent event)
    Allows user to add a new episode to their chosen serie by filling in relevant information and saving it to a database.
    Retrieves and returns the file path of an image.
    (package private) void
    importImage(javafx.event.ActionEvent event)
    Allows the user to select an image file from a chosen directory, saves it to two different locations, and displays the image in an `ImageView`.
    private void
    References a provided reference.
    private boolean
    Takes a `File` object as input and determines if it represents an image file or not.
    (package private) boolean
    Checks if a given string can be converted to an integer using `Integer.parseInt()`.
    private boolean
    Determines if a given File is a video file based on its file name extension, returning `true` if the extension matches "mp4", "avi", or "mkv", and `false` otherwise.
    private void
    /** Modifies an episode's details through a dialog box, including title, number, season, image, and video, and then updates the episode in the database using an IoC container.
    (package private) boolean
    Checks if the user's input is a non-empty, integer-valued string, and returns `true` if it is, else returns `false`.
    (package private) void
    Ocategories(javafx.event.ActionEvent event)
    Loads a FXML file, creates a scene, and displays it in a Stage, using the given resources.
    (package private) void
    Oepisode(javafx.event.ActionEvent event)
    Loads and displays an FXML file named "/ui/series/Episode-view.fxml" in a JavaFX application.
    (package private) void
    Oseries(javafx.event.ActionEvent event)
    Loads a FXML file, creates a scene, and sets the scene on a stage, displaying the stage in the UI.
    (package private) boolean
    Checks if an image file path is provided and returns `true` if yes, otherwise returns `false`.
    private void
    ref()
    Clears existing data in the `tableView`, then retrieves new data from an API and displays it in the table with buttons for deleting and editing each episode.
    (package private) boolean
    Verifies if the user inputted season value is not empty and it's a numerical string, if both conditions are true, it returns `true`, otherwise it displays an error message and returns `false`.
    private void
    sendSMS(String recipientNumber, String messageBody)
    Creates an SMS message, specifies the sender's and recipient's phone numbers, and sends the message using a carrier service.
    (package private) boolean
    Checks if the value of `serieF` is not null, then returns `true`.
    private void
    showAlert(String title, String message)
    /** Creates an `Alert` object and sets its title, header text, and content text using the input parameters.
    void
    showcinema(javafx.event.ActionEvent actionEvent)
    Likely displays a cinema or movie-related information within an application.
    void
    showevent(javafx.event.ActionEvent actionEvent)
    Handles an event generated by a user's interaction with a graphical user interface (GUI).
    void
    showmovies(javafx.event.ActionEvent actionEvent)
    Is called when the 'ActionEvent' occurs and has no defined functionality as of now.
    void
    showproducts(javafx.event.ActionEvent actionEvent)
    Displays a list of products.
    void
    showseries(javafx.event.ActionEvent actionEvent)
    Is triggered when an action event occurs and has no inherent meaning or purpose beyond its activation.
    (package private) boolean
    Determines whether a title is provided and returns `true` if it is, else it displays an error message and returns `false`.
    (package private) boolean
    Verifies if a video summary is entered by the user, and returns `true` if it is valid, or `false` otherwise, with an appropriate error message displayed on the UI if it's invalid.

    Methods inherited from class java.lang.Object

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

    • ACCOUNT_SID

      public static final String ACCOUNT_SID
    • AUTH_TOKEN

      public static final String AUTH_TOKEN
    • LOGGER

      private static final Logger LOGGER
    • episodeImageView

      public javafx.scene.image.ImageView episodeImageView
    • numbercheck

      private javafx.scene.control.Label numbercheck
    • picturechek

      private javafx.scene.control.Label picturechek
    • seasoncheck

      private javafx.scene.control.Label seasoncheck
    • seriecheck

      private javafx.scene.control.Label seriecheck
    • titrecheck

      private javafx.scene.control.Label titrecheck
    • videocheck

      private javafx.scene.control.Label videocheck
    • titreF

      private javafx.scene.control.TextField titreF
    • numeroepisodeF

      private javafx.scene.control.TextField numeroepisodeF
    • saisonF

      private javafx.scene.control.TextField saisonF
    • serieF

      private javafx.scene.control.ComboBox<String> serieF
    • imgpath

      private String imgpath
    • videopath

      private String videopath
    • serieList

      private List<Series> serieList
    • tableView

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

    • EpisodeController

      public EpisodeController()
  • Method Details

    • ref

      private void ref()
      Clears existing data in the `tableView`, then retrieves new data from an API and displays it in the table with buttons for deleting and editing each episode.
    • modifierEpisode

      private void modifierEpisode(Episode episode)
      /** Modifies an episode's details through a dialog box, including title, number, season, image, and video, and then updates the episode in the database using an IoC container.
      Parameters:
      episodeDto - data of an episode to be edited, containing information such as title, number, season, image, and video path.
    • initialize

      private void initialize()
      References a provided reference.
    • showAlert

      private void showAlert(String title, String message)
      /** Creates an `Alert` object and sets its title, header text, and content text using the input parameters. The `Alert.AlertType.INFORMATION` is set to indicate that the alert should be displayed in a neutral manner. Finally, the `alert.showAndWait()` method displays the alert and waits for the user to close it.
      Parameters:
      title - title of an Alert that will be displayed to the user when the function is called.
      message - content text to be displayed within an alert box when the function is called.
    • addimg

      void addimg(javafx.event.ActionEvent event)
      Allows users to select an image file using a FileChooser, stores the file path in `imgpath`, and sets the image using `Image`.
      Parameters:
      event - action that triggered the function, specifically the opening of a file using the FileChooser.
    • importImage

      void importImage(javafx.event.ActionEvent event)
      Allows the user to select an image file from a chosen directory, saves it to two different locations, and displays the image in an `ImageView`.
      Parameters:
      event - trigger that initiates the action of importing an image when clicked by the user.
    • getFilePath

      public String getFilePath()
      Retrieves and returns the file path of an image.
    • isImageFile

      private boolean isImageFile(File file)
      Takes a `File` object as input and determines if it represents an image file or not. It does this by creating an `Image` object from the file's URI, then checking if the resulting `Image` is not in error. If the image is in error, the function returns `false`.
      Parameters:
      file - file to be checked for being an image file.
    • addVideo

      void addVideo(javafx.event.ActionEvent event)
      Enables the user to select a video file from their computer, and if a valid video file is selected, it stores the file path in a variable called `videopath`.
      Parameters:
      event - occurance of a user clicking on the "Choose a video" button and triggers the execution of the function.
    • isVideoFile

      private boolean isVideoFile(File file)
      Determines if a given File is a video file based on its file name extension, returning `true` if the extension matches "mp4", "avi", or "mkv", and `false` otherwise.
      Parameters:
      file - File that needs to be checked for being a video file.
    • isStringInt

      boolean isStringInt(String s)
      Checks if a given string can be converted to an integer using `Integer.parseInt()`. If it can, it returns `true`, otherwise it returns `false`.
      Parameters:
      s - String to be parsed as an integer.
    • titrecheck

      boolean titrecheck()
      Determines whether a title is provided and returns `true` if it is, else it displays an error message and returns `false`.
    • seasoncheck

      boolean seasoncheck()
      Verifies if the user inputted season value is not empty and it's a numerical string, if both conditions are true, it returns `true`, otherwise it displays an error message and returns `false`.
    • picturechek

      boolean picturechek()
      Checks if an image file path is provided and returns `true` if yes, otherwise returns `false`.
    • numbercheck

      boolean numbercheck()
      Checks if the user's input is a non-empty, integer-valued string, and returns `true` if it is, else returns `false`.
    • videocheck

      boolean videocheck()
      Verifies if a video summary is entered by the user, and returns `true` if it is valid, or `false` otherwise, with an appropriate error message displayed on the UI if it's invalid.
    • seriecheck

      boolean seriecheck()
      Checks if the value of `serieF` is not null, then returns `true`. Otherwise, it sets the text of a text field called `seriecheck` to "Please select a Serie" and returns `false`.
    • sendSMS

      private void sendSMS(String recipientNumber, String messageBody)
      Creates an SMS message, specifies the sender's and recipient's phone numbers, and sends the message using a carrier service.
      Parameters:
      recipientNumber - 10-digit phone number of the recipient for whom the SMS message is being sent.
      messageBody - text content of the SMS message to be sent.
    • ajouterSerie

      void ajouterSerie(javafx.event.ActionEvent event)
      Allows user to add a new episode to their chosen serie by filling in relevant information and saving it to a database. It also sends an SMS to the user's phone with the details of the added episode.
      Parameters:
      event - clicked button event on the user interface that triggered the function execution.
    • Ocategories

      void Ocategories(javafx.event.ActionEvent event) throws IOException
      Loads a FXML file, creates a scene, and displays it in a Stage, using the given resources.
      Parameters:
      event - event that triggered the `Ocategories` function, providing the necessary information for the function to perform its actions.
      Throws:
      IOException
    • Oseries

      void Oseries(javafx.event.ActionEvent event) throws IOException
      Loads a FXML file, creates a scene, and sets the scene on a stage, displaying the stage in the UI.
      Parameters:
      event - Event that triggered the function, and it is used to load the FXML file for display in the stage.
      Throws:
      IOException
    • Oepisode

      void Oepisode(javafx.event.ActionEvent event) throws IOException
      Loads and displays an FXML file named "/ui/series/Episode-view.fxml" in a JavaFX application.
      Parameters:
      event - event that triggered the method execution, providing the necessary information for displaying the appropriate episode view.
      Throws:
      IOException
    • showmovies

      public void showmovies(javafx.event.ActionEvent actionEvent)
      Is called when the 'ActionEvent' occurs and has no defined functionality as of now.
      Parameters:
      actionEvent - event that triggered the execution of the `showMovies()` function.
    • showproducts

      public void showproducts(javafx.event.ActionEvent actionEvent)
      Displays a list of products.
      Parameters:
      actionEvent - event that triggered the execution of the `showProducts` function.
    • showcinema

      public void showcinema(javafx.event.ActionEvent actionEvent)
      Likely displays a cinema or movie-related information within an application.
      Parameters:
      actionEvent - event that triggered the function call.
    • showevent

      public void showevent(javafx.event.ActionEvent actionEvent)
      Handles an event generated by a user's interaction with a graphical user interface (GUI).
      Parameters:
      actionEvent - occurrence of an event that triggers the function's execution.
    • showseries

      public void showseries(javafx.event.ActionEvent actionEvent)
      Is triggered when an action event occurs and has no inherent meaning or purpose beyond its activation.
      Parameters:
      actionEvent - event that triggered the call to the `showSeries()` method.