Class CreateBudgetController

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

public class CreateBudgetController extends Object
Controller for the create budget scene in the application. This controller manages everything related to creating a new budget, from creating new directories and incomes, to updating the SelectedBudget.current file that stores the current budget.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    javafx.scene.control.Button
    The cancel button in the dialog window.
    javafx.scene.control.Button
    The ok button in the dialog window.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    createNewFiles(String budgetName)
    Method for creating a new directory for the newly created budget, along with three files for storing budget, income and expense data.
    void
    Initializes the window.
    void
    pressCancelBtn(javafx.event.ActionEvent event)
    Handles presses on the cancel button.
    void
    pressOkBtn(javafx.event.ActionEvent event)
    Handles button presses on the OK button.
    void
    updateCurrentFile(String currentMonth, String budgetName)
    Method for updating the currently selected budget in the file that stores which budget is currently selected.

    Methods inherited from class java.lang.Object

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

    • okBtn

      public javafx.scene.control.Button okBtn
      The ok button in the dialog window.
    • cancelBtn

      public javafx.scene.control.Button cancelBtn
      The cancel button in the dialog window.
  • Constructor Details

    • CreateBudgetController

      public CreateBudgetController()
  • Method Details

    • initialize

      public void initialize()
      Initializes the window. Finds the current month, used to make the created budget's name. Adds an event filter to the okBtn.
    • pressOkBtn

      public void pressOkBtn(javafx.event.ActionEvent event)
      Handles button presses on the OK button.
      Parameters:
      event - A button press on the OK button.
    • pressCancelBtn

      public void pressCancelBtn(javafx.event.ActionEvent event)
      Handles presses on the cancel button.
      Parameters:
      event - A button press on the cancel button.
    • createNewFiles

      public boolean createNewFiles(String budgetName)
      Method for creating a new directory for the newly created budget, along with three files for storing budget, income and expense data.
      Parameters:
      budgetName - The name of the budget.
      Returns:
      True, if the directories are successfully created. Else, returns false.
    • updateCurrentFile

      public void updateCurrentFile(String currentMonth, String budgetName)
      Method for updating the currently selected budget in the file that stores which budget is currently selected.
      Parameters:
      currentMonth - The month of the year.
      budgetName - The name of the budget.