Class ProjectUIHelper

java.lang.Object
com.ntu.fdae.group1.bto.views.ProjectUIHelper

public class ProjectUIHelper extends Object
Helper class for project-related UI operations in the BTO Management System.

This class provides reusable UI components for displaying and managing project information, including: - Displaying lists of projects with filtering options - Showing detailed project information tailored to different user roles - Visualizing flat type availability and administrative details

The helper follows a composition pattern, working with a BaseUI instance for common UI operations and controllers for retrieving user and project information. It is designed to be used by role-specific UI classes (ApplicantUI, HDBManagerUI, HDBOfficerUI) to maintain separation of concerns and reduce code duplication.

  • Constructor Details

    • ProjectUIHelper

      public ProjectUIHelper(BaseUI baseUI, UserController userCtrl, ProjectController projCtrl)
      Constructs a new ProjectUIHelper with necessary UI and controllers.
      Parameters:
      baseUI - The base UI for common display operations
      userCtrl - Controller for user-related operations
      projCtrl - Controller for project-related operations
  • Method Details

    • selectProjectFromList

      public Project selectProjectFromList(List<Project> projects, String listTitle)
      Displays a numbered list of projects with basic information and prompts the user to select one.
      Parameters:
      projects - The list of Project objects to display.
      listTitle - The title to display above the list (e.g., "Available Projects").
      Returns:
      The selected Project object, or null if the user chooses to go back or the list is empty.
    • displayApplicantProjectDetails

      public void displayApplicantProjectDetails(Project project)
      Displays project details relevant to an Applicant. Shows core info and available flat types/units.
      Parameters:
      project - The Project object whose details are to be displayed.
    • displayStaffProjectDetails

      public void displayStaffProjectDetails(Project project, int pendingCount)
      Displays comprehensive project details relevant to HDB Staff (Officers/Managers). Shows core info, flat types/units, and administrative details.
      Parameters:
      project - The Project object whose details are to be displayed
      pendingCount - The number of pending officer registrations for the project
    • promptForProjectFilters

      public Map<String,Object> promptForProjectFilters(boolean allowStaffFilters, boolean isSingleApplicant)
      Prompts the user for project filtering criteria (Neighbourhood, Flat Type, Visibility). Allows users to skip criteria by pressing Enter. Restricts Flat Type options for single applicants (cannot filter by THREE_ROOM).
      Parameters:
      allowStaffFilters - Set to true if staff-specific filters (like visibility) should be offered.
      isSingleApplicant - Set to true if the user is a single applicant.
      Returns:
      A Map containing the filter keys and selected values. Empty map if no filters applied.
    • displayFlatAvailability

      public void displayFlatAvailability(Project project)
      Displays the availability of different flat types for a given project.
      Parameters:
      project - The project whose flat availability should be displayed.