Class UIController
java.lang.Object
utils.UIController
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
FieldsModifier and TypeFieldDescriptionstatic final StringA constant string used as a visual separator in console output, typically for separating different sections or headers. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidAttempts to clear the console screen.static voidexit()Clears the console screen and terminates the Java Virtual Machine, effectively exiting the application.static voidPauses execution, prompts the user to press Enter, and then navigates back to the main Applicant menu by callingApplicantPage.allOptions().static voidPauses execution, prompts the user to press Enter, and then navigates back to the main Manager menu by callingManagerPage.allOptions().static voidPauses execution, prompts the user to press Enter, and then navigates back to the main Officer menu by callingOfficerPage.allOptions().
-
Field Details
-
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 callingApplicantPage.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 callingOfficerPage.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 callingManagerPage.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.
-