Class BookingUIHelper

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

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

This class provides reusable UI components for displaying and managing booking data, including: - Displaying lists of bookings with applicant information - Facilitating user selection of bookings from a list - Formatting and displaying booking receipt information

The helper follows a composition pattern, working with a BaseUI instance for common UI operations and a UserController for retrieving applicant information.

  • Constructor Details

    • BookingUIHelper

      public BookingUIHelper(BaseUI baseUI, UserController userController)
      Constructs a new BookingUIHelper with the specified dependencies.
      Parameters:
      baseUI - An instance of BaseUI for console I/O operations
      userController - Controller to fetch user information for bookings
      Throws:
      NullPointerException - if either parameter is null
  • Method Details

    • selectBookingFromList

      public Booking selectBookingFromList(List<Booking> bookings, String title)
      Displays a list of bookings and prompts the user to select one.

      This method presents a formatted list of bookings with key information including: - Booking ID - Applicant NRIC and name - Flat type - Booking date

      The method returns the selected booking object or null if the user cancels the selection or if the provided booking list is empty.

      Parameters:
      bookings - List of Booking objects to display
      title - Title for the list header
      Returns:
      The selected Booking object, or null if cancelled or list is empty
    • displayBookingReceipt

      public void displayBookingReceipt(BookingReceiptInfo receiptInfo)
      Displays the formatted details of a booking receipt.

      This method presents a comprehensive receipt for a booking, including: - Booking ID and date - Applicant personal information (name, NRIC, age, marital status) - Project details (name, neighborhood) - Flat type information

      The method handles null receipt information gracefully by displaying an error message instead of attempting to format a null object.

      Parameters:
      receiptInfo - The BookingReceiptInfo object containing receipt data