Class IncomeExpenseController
java.lang.Object
no.ntnu.idatt1002.demo.controller.FinanceController
no.ntnu.idatt1002.demo.controller.IncomeExpenseController
Class for representing an overview of the income and expenses of the users budget. Displays
information in tables and pie charts. It is possible to add, edit and delete income and expenses.
The difference of the expense and income sum contribute to the monthly budget progress.
- Since:
- 30.03.2023
- Author:
- Harry Linrui Xu
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Method for disabling the date picker, yet having its opacity at max.void
handleAddBtn
(javafx.event.ActionEvent event) Method for handling the adding of new entries in the tableview.void
handleDeleteBtn
(javafx.event.ActionEvent event) Deletes an entry from the tableview, if an entry has been selected.void
handleEditBtn
(javafx.event.ActionEvent event) Method for handling the editing of a chosen entry in the tableview.void
Initializes the window that is controlled by the controller.void
Method for synching the pie charts to the registers.void
Method for synching the register with the tableview.void
Saves the changes made to the tableview by writing the information to a file.void
switchScene
(javafx.event.ActionEvent event) Switches scenes back to main menu, by loading a new FXML file and setting the scene to this location.Methods inherited from class no.ntnu.idatt1002.demo.controller.FinanceController
loadBudgetDataFromFile, loadExpenseDataFromFile, loadIncomeDataFromFile, showConfirmationDialog, showErrorDialogBox
-
Constructor Details
-
IncomeExpenseController
public IncomeExpenseController()
-
-
Method Details
-
initialize
public void initialize()Initializes the window that is controlled by the controller. Instantiates the income and expense registers and set them to table views. -
formatDatePicker
public void formatDatePicker()Method for disabling the date picker, yet having its opacity at max. -
handleAddBtn
public void handleAddBtn(javafx.event.ActionEvent event) Method for handling the adding of new entries in the tableview.- Parameters:
event
- A button click on the add button.
-
handleEditBtn
public void handleEditBtn(javafx.event.ActionEvent event) Method for handling the editing of a chosen entry in the tableview.- Parameters:
event
- A button click on the edit button.
-
handleDeleteBtn
public void handleDeleteBtn(javafx.event.ActionEvent event) Deletes an entry from the tableview, if an entry has been selected. The method brings up a popup window, asking for confirmation for deleting the entry.- Parameters:
event
- A button click on the delete button
-
refreshTableView
public void refreshTableView()Method for synching the register with the tableview. The observable list to which the tableview is set, is being refilled with all the entries in the register, keeping it updated with new changes. -
refreshPieChart
public void refreshPieChart()Method for synching the pie charts to the registers. -
saveDataToFile
Saves the changes made to the tableview by writing the information to a file.- Throws:
IOException
- If an error occurs while writing to the file.
-
switchScene
public void switchScene(javafx.event.ActionEvent event) Switches scenes back to main menu, by loading a new FXML file and setting the scene to this location.- Parameters:
event
- A button click on the return to main menu button
-