Class DashboardAdminController

java.lang.Object
com.esprit.controllers.cinemas.DashboardAdminController

public class DashboardAdminController extends Object
Is responsible for handling user interactions related to admin dashboards for various applications. It provides functionality to filter and display data from the Cinema, Addresses, Statuses, Events, Movies, and Series modules based on user selections. The controller also handles button clicks to display different views for each module.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final List<javafx.scene.control.CheckBox>
     
    private javafx.scene.layout.AnchorPane
     
    private javafx.scene.control.TableColumn<Cinema,Void>
     
    private javafx.scene.control.TableColumn<Cinema,String>
     
    private javafx.scene.control.TableColumn<Cinema,String>
     
    private javafx.scene.control.TableColumn<Cinema,javafx.scene.image.ImageView>
     
    private javafx.scene.control.TableColumn<Cinema,String>
     
    private javafx.scene.control.TableColumn<Cinema,String>
     
    private javafx.scene.layout.AnchorPane
     
    private javafx.scene.control.TableView<Cinema>
     
    private final List<javafx.scene.control.CheckBox>
     
    private javafx.scene.control.TextField
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    (package private) void
    Configures a table to display cinemas, including their name, address, and responsible person.
    (package private) void
    afficherEventsAdmin(javafx.event.ActionEvent event)
    Loads an fxml file and displays a stage with a scene, changing the current stage to the new one.
    (package private) void
    afficherMovieAdmin(javafx.event.ActionEvent event)
    Loads an FXML file, creates a stage and window for film management, and replaces the current stage with the new one.
    (package private) void
    AfficherProductAdmin(javafx.event.ActionEvent event)
    Loads an fxml file, creates a scene and stage, and replaces the current stage with the new one.
    (package private) void
    afficherserieAdmin(javafx.event.ActionEvent event)
    Loads a FXML file, creates a stage and window for a series management interface, and replaces the current stage with the new one.
    private javafx.scene.layout.AnchorPane
     
    private void
    filterCinemas(String searchText)
    Filters a list of cinemas based on a search query, updating the displayed list in a TableView.
    (package private) void
    filtrer(javafx.event.ActionEvent event)
    Updates the opacity of a container and makes a filter anchor visible, then clears the lists of check boxes for addresses and statuses, retrieves unique addresses and statuses from the database, creates VBoxes for each address and status, adds them to the filter anchor, and sets the filter anchor's visibility to true.
    (package private) void
    filtrercinema(javafx.event.ActionEvent event)
    Filters a list of cinemas based on selected addresses and/or statuses, and updates the TableView with the filtered list.
    private List<Cinema>
    Retrieves a list of cinemas through the use of the `CinemaService`.
    Retrieves a list of cinema addresses from a database and extracts unique addresses from the list of cinemas using Stream API.
    Creates a list of predefined cinema statuses, including "Pending" and "Accepted", and returns it.
    private List<String>
    Streamlines the selected addresses from an `AnchorPane` of filtering, applies a filter to only include selected checkboxes, and collects the results into a list of strings.
    private List<String>
    Retrieves the selected statuses from an `AnchorPane` of filtering by streaming the checked checkboxes, filtering the non-checked ones, and collecting the selected statuses as a list.
    void
    Adds a listener to the `tfSearch` text field to filter and update the list of cinemas when the user types in it, loads all cinemas initially, and displays them.
    private void
    Creates an observable list of cinemas by reading them from a service and setting it as the items of a `ListBox`.
    private void
     

    Methods inherited from class java.lang.Object

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

    • addressCheckBoxes

      private final List<javafx.scene.control.CheckBox> addressCheckBoxes
    • statusCheckBoxes

      private final List<javafx.scene.control.CheckBox> statusCheckBoxes
    • cinemasList

      private javafx.scene.layout.AnchorPane cinemasList
    • colAction

      private javafx.scene.control.TableColumn<Cinema,Void> colAction
    • colAdresse

      private javafx.scene.control.TableColumn<Cinema,String> colAdresse
    • colCinema

      private javafx.scene.control.TableColumn<Cinema,String> colCinema
    • colResponsable

      private javafx.scene.control.TableColumn<Cinema,String> colResponsable
    • colStatut

      private javafx.scene.control.TableColumn<Cinema,String> colStatut
    • listCinema

      private javafx.scene.control.TableView<Cinema> listCinema
    • tfSearch

      private javafx.scene.control.TextField tfSearch
    • filterAnchor

      private javafx.scene.layout.AnchorPane filterAnchor
  • Constructor Details

    • DashboardAdminController

      public DashboardAdminController()
  • Method Details

    • afficherCinemas

      void afficherCinemas()
      Configures a table to display cinemas, including their name, address, and responsible person. It also sets up buttons for accepting or refusing cinemas, and a button to show movies.
    • showFilmsInModal

      private void showFilmsInModal(Cinema cinema)
    • createFilmCard

      private javafx.scene.layout.AnchorPane createFilmCard(Film film)
    • loadCinemas

      private void loadCinemas()
      Creates an observable list of cinemas by reading them from a service and setting it as the items of a `ListBox`.
    • getAllCinemas

      private List<Cinema> getAllCinemas()
      Retrieves a list of cinemas through the use of the `CinemaService`. The list is then returned.
    • initialize

      public void initialize()
      Adds a listener to the `tfSearch` text field to filter and update the list of cinemas when the user types in it, loads all cinemas initially, and displays them.
    • filterCinemas

      private void filterCinemas(String searchText)
      Filters a list of cinemas based on a search query, updating the displayed list in a TableView.
      Parameters:
      searchText - search term used to filter the list of cinemas displayed on the screen.
    • filtrer

      void filtrer(javafx.event.ActionEvent event)
      Updates the opacity of a container and makes a filter anchor visible, then clears the lists of check boxes for addresses and statuses, retrieves unique addresses and statuses from the database, creates VBoxes for each address and status, adds them to the filter anchor, and sets the filter anchor's visibility to true.
      Parameters:
      event - ActionEvent that triggered the filtrer method, providing the necessary information to update the UI components accordingly.

      - `event`: an ActionEvent object representing the user's action that triggered the function execution.

    • getCinemaAddresses

      public List<String> getCinemaAddresses()
      Retrieves a list of cinema addresses from a database and extracts unique addresses from the list of cinemas using Stream API.
    • getCinemaStatuses

      public List<String> getCinemaStatuses()
      Creates a list of predefined cinema statuses, including "Pending" and "Accepted", and returns it.
    • filtrercinema

      void filtrercinema(javafx.event.ActionEvent event)
      Filters a list of cinemas based on selected addresses and/or statuses, and updates the TableView with the filtered list.
      Parameters:
      event - occurrence of an action event, such as a button press or key stroke, that triggers the execution of the `filtrercinema` method.

      - `Event`: This represents an event object that triggered the function to be executed. - `ActionEvent`: This is a specific type of event object that indicates that a button or other control was pressed.

    • getSelectedAddresses

      private List<String> getSelectedAddresses()
      Streamlines the selected addresses from an `AnchorPane` of filtering, applies a filter to only include selected checkboxes, and collects the results into a list of strings.
    • getSelectedStatuses

      private List<String> getSelectedStatuses()
      Retrieves the selected statuses from an `AnchorPane` of filtering by streaming the checked checkboxes, filtering the non-checked ones, and collecting the selected statuses as a list.
    • afficherEventsAdmin

      void afficherEventsAdmin(javafx.event.ActionEvent event) throws IOException
      Loads an fxml file and displays a stage with a scene, changing the current stage to the new one.
      Parameters:
      event - event that triggered the function and provides access to its related data, allowing the code inside the function to interact with it.

      - `event`: An `ActionEvent` object representing an action performed on the application.

      Throws:
      IOException
    • afficherMovieAdmin

      void afficherMovieAdmin(javafx.event.ActionEvent event) throws IOException
      Loads an FXML file, creates a stage and window for film management, and replaces the current stage with the new one.
      Parameters:
      event - event that triggered the function execution, specifically an `ActionEvent` related to the loading of the FXML file.

      Event: An event object that represents a user-initiated action or event, such as a button click or a key press.

      Throws:
      IOException
    • afficherserieAdmin

      void afficherserieAdmin(javafx.event.ActionEvent event) throws IOException
      Loads a FXML file, creates a stage and window for a series management interface, and replaces the current stage with the new one.
      Parameters:
      event - event that triggered the execution of the `afficherserieAdmin()` function, which is an action event generated by a user's click on a button or other element in the FXML file.

      - `event` is an `ActionEvent`, indicating that the method was called as a result of user action.

      Throws:
      IOException
    • AfficherProductAdmin

      void AfficherProductAdmin(javafx.event.ActionEvent event) throws IOException
      Loads an fxml file, creates a scene and stage, and replaces the current stage with the new one.
      Parameters:
      event - ActionEvent object that triggered the execution of the `AfficherProductAdmin()` method.

      - `event`: An `ActionEvent` object representing a user action that triggered the function to execute.

      Throws:
      IOException