Skip to content
Snippets Groups Projects
Commit c4072799 authored by Harry Linrui XU's avatar Harry Linrui XU
Browse files

"Refactored method name. Made showIllegalBudgetItemDialog account for both illegal cases"

parent b5139123
No related branches found
No related tags found
8 merge requests!43Merging frontend-testing into master,!38"Made progressbar dynamic in accordance to spending. Added balance field....,!37Made the sub progress bars respond to changes in expense,!32Added input validation to add dialog boxes.,!30Redesigned scenes,!29Redesigned scenes,!28Redesigned scenes,!26Redesigned Main menu and expense/income windows
...@@ -87,7 +87,7 @@ public class BudgetController { ...@@ -87,7 +87,7 @@ public class BudgetController {
descriptionColumn.setCellValueFactory(new PropertyValueFactory<BudgetItem, String>("budgetDescription")); descriptionColumn.setCellValueFactory(new PropertyValueFactory<BudgetItem, String>("budgetDescription"));
//Initialize registers and tableview //Initialize registers and tableview
general = loadIncomeDataFromFile("Budget"); general = loadBudgetDataFromFile("Budget");
budgetList = FXCollections.observableArrayList(general.getBudgetItems()); budgetList = FXCollections.observableArrayList(general.getBudgetItems());
budgetTableView.setItems(budgetList); budgetTableView.setItems(budgetList);
...@@ -188,7 +188,7 @@ public class BudgetController { ...@@ -188,7 +188,7 @@ public class BudgetController {
* Returns an optional, which is a popup alert box, asking for confirmation for deleting an entry. * Returns an optional, which is a popup alert box, asking for confirmation for deleting an entry.
* @return An alertbox, asking for confirmation for deleting the selected entry of the tableview. * @return An alertbox, asking for confirmation for deleting the selected entry of the tableview.
*/ */
private Optional<ButtonType> showConfirmationDialog() { //TODO REWRITE private Optional<ButtonType> showConfirmationDialog() {
Alert alert = new Alert(Alert.AlertType.CONFIRMATION); Alert alert = new Alert(Alert.AlertType.CONFIRMATION);
alert.setTitle("Confirm Delete"); alert.setTitle("Confirm Delete");
alert.setHeaderText("Delete Confirmation"); alert.setHeaderText("Delete Confirmation");
...@@ -203,9 +203,9 @@ public class BudgetController { ...@@ -203,9 +203,9 @@ public class BudgetController {
*/ */
private void showIllegalBudgetItemDialog() { private void showIllegalBudgetItemDialog() {
Alert alert = new Alert(AlertType.ERROR); Alert alert = new Alert(AlertType.ERROR);
alert.setTitle("Budget amount exceeded"); alert.setTitle("Budget amount exceeded/Category already exists");
alert.setHeaderText("Your budget exceeds the max limit"); alert.setHeaderText("Your budget exceeds the max limit OR a budget item of the same category already exists in the table");
alert.setContentText("The total budget sum must be below " + general.getMaxAmount()); alert.setContentText("The total budget sum must be below " + general.getMaxAmount() + " OR Each category can only have one entry in the budget table");
alert.showAndWait(); alert.showAndWait();
} }
...@@ -215,7 +215,7 @@ public class BudgetController { ...@@ -215,7 +215,7 @@ public class BudgetController {
* @return An object of type GeneralBudget. * @return An object of type GeneralBudget.
* @throws IOException If an error occurs while reading from the file. * @throws IOException If an error occurs while reading from the file.
*/ */
public GeneralBudget loadIncomeDataFromFile(String fileName) throws IOException { //TODO REFACTOR public GeneralBudget loadBudgetDataFromFile(String fileName) throws IOException {
FileHandlingBudget fileHandlingBudget = new FileHandlingBudget(); FileHandlingBudget fileHandlingBudget = new FileHandlingBudget();
//Instantiate new budget //Instantiate new budget
if (fileHandlingBudget.isEmpty(fileName)) { if (fileHandlingBudget.isEmpty(fileName)) {
......
...@@ -3,5 +3,5 @@ maxAmount=1000.0 ...@@ -3,5 +3,5 @@ maxAmount=1000.0
budgetAmount=500.0 budgetAmount=500.0
budgetCategory=FOOD budgetCategory=FOOD
budgetDescription=dd budgetDescription=
date=2023-03-01 date=2023-03-27
description=twelve amount=100.0
amount=12.0
isRecurring=Not recurring isRecurring=Not recurring
category=CLOTHES category=FOOD
date=2023-03-11 date=2023-03-27
description=1111 amount=100.0
amount=121.0 isRecurring=Recurring
isRecurring=Not recurring
category=OTHER category=OTHER
date=2023-03-26 date=2023-03-27
amount=10.0 amount=10000.0
isRecurring=Not recurring isRecurring=Not recurring
category=FOOD category=FOOD
date=2023-03-24 date=2023-03-27
description=studie amount=950.0
amount=1000.0
isRecurring=Recurring isRecurring=Recurring
category=STUDENT_LOAN category=SALARY
date=2023-03-25
amount=100.0
isRecurring=Not recurring
category=GIFT
date=2023-03-25
description=airbnb
amount=1000.0
isRecurring=Not recurring
category=GIFT
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment