Class OfficerRegUIHelper
This class provides reusable UI components for displaying and managing officer registration data, including: - Displaying lists of officer registrations - Showing detailed information about specific registrations - Formatting registration data for user-friendly display
The helper follows a composition pattern, working with a BaseUI instance for common UI operations and a ProjectController for retrieving project information related to registrations.
-
Constructor Summary
ConstructorsConstructorDescriptionOfficerRegUIHelper
(BaseUI baseUI, ProjectController projectController, UserController userController) Constructs a new OfficerRegUIHelper with the specified dependencies. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Displays detailed information about a specific officer registration.displayOfficerRegList
(List<OfficerRegistration> regs, String title) Displays a formatted list of officer registrations and provides a mapping for selection.void
displayOfficerRegListForViewing
(List<OfficerRegistration> regs, String title) Displays a formatted list of officer registrations for viewing purposes only.
-
Constructor Details
-
OfficerRegUIHelper
public OfficerRegUIHelper(BaseUI baseUI, ProjectController projectController, UserController userController) Constructs a new OfficerRegUIHelper with the specified dependencies.- Parameters:
baseUI
- An instance of BaseUI for console I/O operationsprojectController
- Controller to fetch project detailsuserController
- Controller to fetch user details- Throws:
NullPointerException
- if either parameter is null
-
-
Method Details
-
displayOfficerRegList
public Map<Integer,OfficerRegistration> displayOfficerRegList(List<OfficerRegistration> regs, String title) Displays a formatted list of officer registrations and provides a mapping for selection.This method displays each registration with its key details including ID, officer, project name, status, and date, and returns a map that associates the display index with the corresponding registration object for easy selection.
- Parameters:
regs
- List of registrations to displaytitle
- Title for the list header- Returns:
- Map where key is the displayed number, value is the OfficerRegistration; empty map if list is null/empty
-
displayOfficerRegistrationDetails
Displays detailed information about a specific officer registration.Shows comprehensive information about a single registration, including its ID, associated officer, project details, request date, and current status.
- Parameters:
reg
- The registration object to display details for
-
displayOfficerRegListForViewing
Displays a formatted list of officer registrations for viewing purposes only.Unlike displayOfficerRegList, this method is designed for view-only scenarios where user selection is not required. It displays registrations in a tabular format with columns for key details.
- Parameters:
regs
- List of registrations to displaytitle
- Title for the list header
-