java.lang.Object
com.atmbanksimulator.View
ATM Simulator - View: User Interface (UI)
The View class represents the user interface of the ATM system.
It is responsible for constructing and displaying all JavaFX UI components including
the numpad, menus, transaction history, account details, and settings screens.
It accepts user input via button clicks and forwards these actions to the Controller.
The display is updated by the UIModel through the update() method.
- Version:
- 3.0
- Author:
- D'Souza, C. J.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected javafx.scene.layout.VBoxaccountDetailCategory(String heading, ArrayList<String> headings, ArrayList<String> values, int start, int stop) Constructs and returns a collapsible category section for the account details view, displaying a heading row and an expandable grid of label-value pairs.protected javafx.scene.control.ScrollPaneConstructs and returns a scrollable account details view, displaying personal and account information retrieved from theController.protected voidbottom()Builds the bottom status bar used as a visual effect.protected voidcenter()Builds the center content region and displays the home screen on startup.protected javafx.scene.layout.PaneConstructs and returns the Change Plan screen, allowing the user to select a new account type and tier via radio buttons, with the corresponding withdrawal limit displayed and a save button to confirm.protected javafx.scene.layout.PaneConstructs and returns the deposit menu with predefined amount buttons (£5, £10, £20, £50, £100, £200).protected javafx.scene.layout.PaneConstructs and returns the home screen pane containing the welcome message and START button.protected voidleft()Builds the left border strip used as a visual effect.protected javafx.scene.layout.GridPanenumPad()Constructs and returns the numpad GridPane containing all input buttons.protected voidright()Builds the right numpad panel containing digit buttons, decimal point, CLEAR, ENTER, BACKSPACE, and EXIT, and adds it to the right side.protected javafx.scene.layout.Panescreen()Constructs and returns the main ATM screen pane, including the heading bar with home and settings buttons, a separator, the message label, the input text field, and the content box.protected javafx.scene.layout.PaneConstructs and returns the settings menu with buttons for Account Details, Change Password, Change Plan, and Change Withdrawal Limit.protected voidDisplays the account details view inside the content box.protected voidClears the content box, showing a blank area.protected voidDisplays the change plan menu inside the content box.protected voidDisplays the deposit predefined amounts menu inside the content box.protected voidClears the center region and displays the home screen with the START button.protected voidClears and rebuilds the numpad in the right region.protected voidClears the center region and displays the main ATM interaction screen containing the heading, separator, label, text field, and content box.protected voidDisplays the settings menu inside the content box.protected voidDisplays the transaction history menu inside the content box.protected voidDisplays the user main menu inside the content box.voidstart(javafx.stage.Stage stage) Initialises and launches the JavaFX stage, constructing all UI regions and applying the stylesheet.protected voidtop()Builds the top navigation bar containing the ATM title label.protected javafx.scene.control.ScrollPaneConstructs and returns a scrollable transaction history view, displaying all records retrieved from theController.protected javafx.scene.layout.GridPanetransactionRecord(ArrayList<String> record) Constructs and returns a single row in the transaction history table.voidUpdates the display based on the current ATM state.protected javafx.scene.layout.PaneuserMenu()Constructs and returns the user main menu with buttons for Deposit, Withdraw, Balance, Transfer, and History.
-
Constructor Details
-
View
public View()
-
-
Method Details
-
start
public void start(javafx.stage.Stage stage) Initialises and launches the JavaFX stage, constructing all UI regions and applying the stylesheet.- Parameters:
stage- the primary JavaFX stage provided by the application framework
-
top
protected void top()Builds the top navigation bar containing the ATM title label. -
left
protected void left()Builds the left border strip used as a visual effect. -
center
protected void center()Builds the center content region and displays the home screen on startup. -
showHomeScreen
protected void showHomeScreen()Clears the center region and displays the home screen with the START button. -
showScreen
protected void showScreen()Clears the center region and displays the main ATM interaction screen containing the heading, separator, label, text field, and content box. -
homeScreen
protected javafx.scene.layout.Pane homeScreen()Constructs and returns the home screen pane containing the welcome message and START button.- Returns:
- a
Panerepresenting the home screen
-
screen
protected javafx.scene.layout.Pane screen()Constructs and returns the main ATM screen pane, including the heading bar with home and settings buttons, a separator, the message label, the input text field, and the content box.- Returns:
- a
Panerepresenting the main ATM screen
-
userMenu
protected javafx.scene.layout.Pane userMenu()Constructs and returns the user main menu with buttons for Deposit, Withdraw, Balance, Transfer, and History.- Returns:
- a
Panecontaining the main menu buttons
-
depositMenu
protected javafx.scene.layout.Pane depositMenu()Constructs and returns the deposit menu with predefined amount buttons (£5, £10, £20, £50, £100, £200).- Returns:
- a
Panecontaining the deposit amount buttons
-
transactionHistoryMenu
protected javafx.scene.control.ScrollPane transactionHistoryMenu()Constructs and returns a scrollable transaction history view, displaying all records retrieved from theController.- Returns:
- a
ScrollPanecontaining the formatted transaction history
-
transactionRecord
Constructs and returns a single row in the transaction history table.- Parameters:
record- a list of strings containing transactionID, datetime, type, and amount- Returns:
- a
GridPanerow representing one transaction record
-
settingsMenu
protected javafx.scene.layout.Pane settingsMenu()Constructs and returns the settings menu with buttons for Account Details, Change Password, Change Plan, and Change Withdrawal Limit.- Returns:
- a
Panecontaining the settings menu buttons
-
accountDetailsMenu
protected javafx.scene.control.ScrollPane accountDetailsMenu()Constructs and returns a scrollable account details view, displaying personal and account information retrieved from theController.- Returns:
- a
ScrollPanecontaining the formatted account details
-
accountDetailCategory
protected javafx.scene.layout.VBox accountDetailCategory(String heading, ArrayList<String> headings, ArrayList<String> values, int start, int stop) Constructs and returns a collapsible category section for the account details view, displaying a heading row and an expandable grid of label-value pairs.- Parameters:
heading- the category heading textheadings- the list of all field label stringsvalues- the list of all corresponding value stringsstart- the inclusive start index into headings/valuesstop- the inclusive stop index into headings/values- Returns:
- a
VBoxcontaining the collapsible category section
-
changePlanMenu
protected javafx.scene.layout.Pane changePlanMenu()Constructs and returns the Change Plan screen, allowing the user to select a new account type and tier via radio buttons, with the corresponding withdrawal limit displayed and a save button to confirm.- Returns:
- a
Panecontaining the plan selection controls
-
showBlankBox
protected void showBlankBox()Clears the content box, showing a blank area. -
showUserMenu
protected void showUserMenu()Displays the user main menu inside the content box. -
showDepositMenu
protected void showDepositMenu()Displays the deposit predefined amounts menu inside the content box. -
showTransactionMenu
protected void showTransactionMenu()Displays the transaction history menu inside the content box. -
showSettingsMenu
protected void showSettingsMenu()Displays the settings menu inside the content box. -
showAccountDetails
protected void showAccountDetails()Displays the account details view inside the content box. -
showChangePlanMenu
protected void showChangePlanMenu()Displays the change plan menu inside the content box. -
right
protected void right()Builds the right numpad panel containing digit buttons, decimal point, CLEAR, ENTER, BACKSPACE, and EXIT, and adds it to the right side. -
numPad
protected javafx.scene.layout.GridPane numPad()Constructs and returns the numpad GridPane containing all input buttons.- Returns:
- a
GridPanerepresenting the full numpad
-
showNumPad
protected void showNumPad()Clears and rebuilds the numpad in the right region. -
bottom
protected void bottom()Builds the bottom status bar used as a visual effect. -
update
Updates the display based on the current ATM state. Controls visibility of the home and settings buttons, the text field, and the content box. Called byUIModelwhenever state or data changes.- Parameters:
title- the heading text to displaymessage- the message label text to displaynumPadInput- the current numpad input string to show in the text fieldresult- the current state string used to determine which screen to show
-