Class View

java.lang.Object
com.atmbanksimulator.View

public class View extends Object

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
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    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.
    protected javafx.scene.control.ScrollPane
    Constructs and returns a scrollable account details view, displaying personal and account information retrieved from the Controller.
    protected void
    Builds the bottom status bar used as a visual effect.
    protected void
    Builds the center content region and displays the home screen on startup.
    protected javafx.scene.layout.Pane
    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.
    protected javafx.scene.layout.Pane
    Constructs and returns the deposit menu with predefined amount buttons (£5, £10, £20, £50, £100, £200).
    protected javafx.scene.layout.Pane
    Constructs and returns the home screen pane containing the welcome message and START button.
    protected void
    Builds the left border strip used as a visual effect.
    protected javafx.scene.layout.GridPane
    Constructs and returns the numpad GridPane containing all input buttons.
    protected void
    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.Pane
    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.Pane
    Constructs and returns the settings menu with buttons for Account Details, Change Password, Change Plan, and Change Withdrawal Limit.
    protected void
    Displays the account details view inside the content box.
    protected void
    Clears the content box, showing a blank area.
    protected void
    Displays the change plan menu inside the content box.
    protected void
    Displays the deposit predefined amounts menu inside the content box.
    protected void
    Clears the center region and displays the home screen with the START button.
    protected void
    Clears and rebuilds the numpad in the right region.
    protected void
    Clears the center region and displays the main ATM interaction screen containing the heading, separator, label, text field, and content box.
    protected void
    Displays the settings menu inside the content box.
    protected void
    Displays the transaction history menu inside the content box.
    protected void
    Displays the user main menu inside the content box.
    void
    start(javafx.stage.Stage stage)
    Initialises and launches the JavaFX stage, constructing all UI regions and applying the stylesheet.
    protected void
    top()
    Builds the top navigation bar containing the ATM title label.
    protected javafx.scene.control.ScrollPane
    Constructs and returns a scrollable transaction history view, displaying all records retrieved from the Controller.
    protected javafx.scene.layout.GridPane
    Constructs and returns a single row in the transaction history table.
    void
    update(String title, String message, String numPadInput, String result)
    Updates the display based on the current ATM state.
    protected javafx.scene.layout.Pane
    Constructs and returns the user main menu with buttons for Deposit, Withdraw, Balance, Transfer, and History.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 Pane representing 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 Pane representing 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 Pane containing 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 Pane containing the deposit amount buttons
    • transactionHistoryMenu

      protected javafx.scene.control.ScrollPane transactionHistoryMenu()
      Constructs and returns a scrollable transaction history view, displaying all records retrieved from the Controller.
      Returns:
      a ScrollPane containing the formatted transaction history
    • transactionRecord

      protected javafx.scene.layout.GridPane transactionRecord(ArrayList<String> record)
      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 GridPane row 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 Pane containing 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 the Controller.
      Returns:
      a ScrollPane containing 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 text
      headings - the list of all field label strings
      values - the list of all corresponding value strings
      start - the inclusive start index into headings/values
      stop - the inclusive stop index into headings/values
      Returns:
      a VBox containing 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 Pane containing 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 GridPane representing 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

      public void update(String title, String message, String numPadInput, String result)
      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 by UIModel whenever state or data changes.
      Parameters:
      title - the heading text to display
      message - the message label text to display
      numPadInput - the current numpad input string to show in the text field
      result - the current state string used to determine which screen to show