Class MainMenuController

java.lang.Object
no.ntnu.idatt1002.demo.controller.MainMenuController

public class MainMenuController extends Object
Controller for the main menu of the application. Handles all inputs related to buttons and actively updates the progress overview.
Since:
29.03.2023
Author:
Harry Linrui Xu
  • Constructor Details

    • MainMenuController

      public MainMenuController()
  • Method Details

    • initialize

      public void initialize()
      Initializes the registers and overviews in addition to all dynamic labels and progress bars.
    • loadIncomeDataFromFile

      public IncomeRegister loadIncomeDataFromFile(String fileDestination) throws IOException
      Method that either reads data from a file with which it fills an income register, if older changes exist, or instantiates an income register if the file is empty.
      Parameters:
      fileDestination - The name of the file that is being read from.
      Returns:
      An object of type IncomeRegister.
      Throws:
      IOException - If an error occurs while reading from the file.
    • loadExpenseDataFromFile

      public ExpenseRegister loadExpenseDataFromFile(String fileDestination) throws IOException
      Method that either reads data from a file with which it fills an expense register, if older changes exist, or instantiates an expense register if the file is empty.
      Parameters:
      fileDestination - The name of the file that is being read from.
      Returns:
      An object of type IncomeRegister.
      Throws:
      IOException - If an error occurs while reading from the file.
    • loadBudgetDataFromFile

      public GeneralBudget loadBudgetDataFromFile(String fileDestination) throws IOException
      Method that either reads data from a file with which it fills a budget register, if this is an old budget, or instantiates a budget register if this is a new budget.
      Parameters:
      fileDestination - The name of the file that is being read from.
      Returns:
      An object of type GeneralBudget.
      Throws:
      IOException - If an error occurs while reading from the file.
    • showErrorDialogBox

      public void showErrorDialogBox(String title, String header, String content)
      Displays an error message dialog box with a customizable title, header and content.
      Parameters:
      title - The dialog title.
      header - The dialog header.
      content - The dialog content.
    • showConfirmationDialog

      public Optional<javafx.scene.control.ButtonType> showConfirmationDialog(String title, String header, String content)
      Returns an optional, which is a popup alert box, asking for confirmation for deleting an entry.
      Parameters:
      title - The dialog box title.
      header - The dialog box header.
      content - The dialog box content.
      Returns:
      An alert box, asking for confirmation for deleting the selected entry of the tableview.