Class UIController

java.lang.Object
utils.UIController

public class UIController extends Object
Utility class providing static methods for controlling common console-based User Interface (UI) behaviors within the application. Includes functionality for clearing the console screen, defining standard UI elements like separators, looping back to main menus for different user roles, and exiting the application.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    A constant string used as a visual separator in console output, typically for separating different sections or headers.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    Attempts to clear the console screen.
    static void
    Clears the console screen and terminates the Java Virtual Machine, effectively exiting the application.
    static void
    Pauses execution, prompts the user to press Enter, and then navigates back to the main Applicant menu by calling ApplicantPage.allOptions().
    static void
    Pauses execution, prompts the user to press Enter, and then navigates back to the main Manager menu by calling ManagerPage.allOptions().
    static void
    Pauses execution, prompts the user to press Enter, and then navigates back to the main Officer menu by calling OfficerPage.allOptions().

    Methods inherited from class java.lang.Object

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

    • LINE_SEPARATOR

      public static final String LINE_SEPARATOR
      A constant string used as a visual separator in console output, typically for separating different sections or headers.
      See Also:
  • Constructor Details

    • UIController

      public UIController()
  • Method Details

    • clearPage

      public static void clearPage()
      Attempts to clear the console screen. Uses different methods based on the detected operating system: - Windows: Executes the 'cls' command via ProcessBuilder. - Unix/Linux/macOS: Prints ANSI escape codes to clear the screen and move the cursor. Catches and prints potential exceptions if screen clearing fails.
    • loopApplicant

      public static void loopApplicant()
      Pauses execution, prompts the user to press Enter, and then navigates back to the main Applicant menu by calling ApplicantPage.allOptions(). Typically called after an applicant action is completed.
    • loopOfficer

      public static void loopOfficer()
      Pauses execution, prompts the user to press Enter, and then navigates back to the main Officer menu by calling OfficerPage.allOptions(). Typically called after an officer action is completed.
    • loopManager

      public static void loopManager()
      Pauses execution, prompts the user to press Enter, and then navigates back to the main Manager menu by calling ManagerPage.allOptions(). Typically called after a manager action is completed.
    • exit

      public static void exit()
      Clears the console screen and terminates the Java Virtual Machine, effectively exiting the application. Uses an exit code of 0, indicating normal termination.