Package com.ntu.fdae.group1.bto.views
Class ProjectUIHelper
java.lang.Object
com.ntu.fdae.group1.bto.views.ProjectUIHelper
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 Summary
ConstructorsConstructorDescriptionProjectUIHelper
(BaseUI baseUI, UserController userCtrl, ProjectController projCtrl) Constructs a new ProjectUIHelper with necessary UI and controllers. -
Method Summary
Modifier and TypeMethodDescriptionvoid
displayApplicantProjectDetails
(Project project) Displays project details relevant to an Applicant.void
displayFlatAvailability
(Project project) Displays the availability of different flat types for a given project.void
displayStaffProjectDetails
(Project project, int pendingCount) Displays comprehensive project details relevant to HDB Staff (Officers/Managers).promptForProjectFilters
(boolean allowStaffFilters, boolean isSingleApplicant) Prompts the user for project filtering criteria (Neighbourhood, Flat Type, Visibility).selectProjectFromList
(List<Project> projects, String listTitle) Displays a numbered list of projects with basic information and prompts the user to select one.
-
Constructor Details
-
ProjectUIHelper
Constructs a new ProjectUIHelper with necessary UI and controllers.- Parameters:
baseUI
- The base UI for common display operationsuserCtrl
- Controller for user-related operationsprojCtrl
- Controller for project-related operations
-
-
Method Details
-
selectProjectFromList
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
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
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 displayedpendingCount
- 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
Displays the availability of different flat types for a given project.- Parameters:
project
- The project whose flat availability should be displayed.
-