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
Loading
......@@ -87,7 +87,7 @@ public class BudgetController {
descriptionColumn.setCellValueFactory(new PropertyValueFactory<BudgetItem, String>("budgetDescription"));
//Initialize registers and tableview
general = loadIncomeDataFromFile("Budget");
general = loadBudgetDataFromFile("Budget");
budgetList = FXCollections.observableArrayList(general.getBudgetItems());
budgetTableView.setItems(budgetList);
......@@ -188,7 +188,7 @@ public class BudgetController {
* 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.
*/
private Optional<ButtonType> showConfirmationDialog() { //TODO REWRITE
private Optional<ButtonType> showConfirmationDialog() {
Alert alert = new Alert(Alert.AlertType.CONFIRMATION);
alert.setTitle("Confirm Delete");
alert.setHeaderText("Delete Confirmation");
......@@ -203,9 +203,9 @@ public class BudgetController {
*/
private void showIllegalBudgetItemDialog() {
Alert alert = new Alert(AlertType.ERROR);
alert.setTitle("Budget amount exceeded");
alert.setHeaderText("Your budget exceeds the max limit");
alert.setContentText("The total budget sum must be below " + general.getMaxAmount());
alert.setTitle("Budget amount exceeded/Category already exists");
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() + " OR Each category can only have one entry in the budget table");
alert.showAndWait();
}
......@@ -215,7 +215,7 @@ public class BudgetController {
* @return An object of type GeneralBudget.
* @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();
//Instantiate new budget
if (fileHandlingBudget.isEmpty(fileName)) {
......
......@@ -3,5 +3,5 @@ maxAmount=1000.0
budgetAmount=500.0
budgetCategory=FOOD
budgetDescription=dd
budgetDescription=
date=2023-03-01
description=twelve
amount=12.0
date=2023-03-27
amount=100.0
isRecurring=Not recurring
category=CLOTHES
category=FOOD
date=2023-03-11
description=1111
amount=121.0
isRecurring=Not recurring
date=2023-03-27
amount=100.0
isRecurring=Recurring
category=OTHER
date=2023-03-26
amount=10.0
date=2023-03-27
amount=10000.0
isRecurring=Not recurring
category=FOOD
date=2023-03-24
description=studie
amount=1000.0
date=2023-03-27
amount=950.0
isRecurring=Recurring
category=STUDENT_LOAN
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
category=SALARY
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