Class CreateBudgetController
java.lang.Object
no.ntnu.idatt1002.demo.controller.CreateBudgetController
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 -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
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.
-
Field Details
-
okBtn
public javafx.scene.control.Button okBtnThe ok button in the dialog window. -
cancelBtn
public javafx.scene.control.Button cancelBtnThe 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
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
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.
-