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

"Fixed recursive function bug in refreshPieChart. Extracted refresh methods....

"Fixed recursive function bug in refreshPieChart. Extracted refresh methods. Implemented delete in SceneBuilder"
parent 351a92a8
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
Pipeline #214031 failed
......@@ -183,9 +183,9 @@ public class IncomeExpenseController implements FinanceController {
private ObservableList<PieChart.Data> createIncomePieChart() {
return FXCollections.observableArrayList(
new Data("Loans", incomeRegister.getIncomeByCategory(IncomeCategory.GIFT).getTotalSum()),
new Data("Gift", incomeRegister.getIncomeByCategory(IncomeCategory.GIFT).getTotalSum()),
new Data("Salary", incomeRegister.getIncomeByCategory(IncomeCategory.SALARY).getTotalSum()),
new Data("Salary", incomeRegister.getIncomeByCategory(IncomeCategory.STUDENT_LOAN).getTotalSum())
new Data("Loans", incomeRegister.getIncomeByCategory(IncomeCategory.STUDENT_LOAN).getTotalSum())
);
}
......@@ -200,6 +200,8 @@ public class IncomeExpenseController implements FinanceController {
} else if (event.getSource() == addExpense){
handleAddExpense();
}
refreshTableView();
refreshPieCharts();
}
/**
......@@ -217,6 +219,9 @@ public class IncomeExpenseController implements FinanceController {
} else if (chosenExpense != null) {
handleEditExpense(chosenExpense);
}
//Updates the tableview and pie chart using the register
refreshTableView();
refreshPieCharts();
}
/**
......@@ -235,6 +240,9 @@ public class IncomeExpenseController implements FinanceController {
} else if (chosenExpense != null) {
handleDeleteExpense(chosenExpense);
}
//Updates the tableview and pie chart using the register
refreshTableView();
refreshPieCharts();
}
/**
......@@ -252,8 +260,8 @@ public class IncomeExpenseController implements FinanceController {
}
private void refreshPieCharts() {
this.refreshPieCharts();
this.refreshPieCharts();
this.incomePieChart.setData(createIncomePieChart());
this.expensePieChart.setData(createExpensePieChart());
}
@FXML
......@@ -288,9 +296,6 @@ public class IncomeExpenseController implements FinanceController {
if (newIncome != null) {
incomeRegister.addItem(newIncome);
}
//Updates the tableview using the register
refreshTableView();
refreshPieCharts();
}
@FXML
......@@ -326,9 +331,6 @@ public class IncomeExpenseController implements FinanceController {
if (newExpense != null) {
expenseRegister.addItem(newExpense);
}
//Updates the tableview using the register
refreshTableView();
refreshPieCharts();
}
@FXML
......@@ -357,9 +359,6 @@ public class IncomeExpenseController implements FinanceController {
dialog.setTitle(dialogTitle);
// Show the Dialog and wait for the user to close it
dialog.showAndWait();
//Updates the tableview using the register
refreshTableView();
refreshPieCharts();
}
@FXML
......@@ -387,9 +386,6 @@ public class IncomeExpenseController implements FinanceController {
dialog.setTitle(dialogTitle);
// Show the Dialog and wait for the user to close it
dialog.showAndWait();
//Updates the tableview using the register
refreshTableView();
refreshPieCharts();
}
@FXML
......@@ -397,8 +393,6 @@ public class IncomeExpenseController implements FinanceController {
Optional<ButtonType> isConfirmed = showConfirmationDialog();
if (isConfirmed.isPresent() && isConfirmed.get() == ButtonType.OK) {
incomeRegister.removeItem(chosenIncome);
refreshTableView();
}
}
......@@ -407,7 +401,6 @@ public class IncomeExpenseController implements FinanceController {
Optional<ButtonType> isConfirmed = showConfirmationDialog();
if (isConfirmed.isPresent() && isConfirmed.get() == ButtonType.OK) {
expenseRegister.removeItem(chosenExpense);
refreshTableView();
}
}
......
......@@ -102,7 +102,7 @@
</ImageView>
</graphic>
</Button>
<Button fx:id="deleteBtn" mnemonicParsing="false" prefHeight="25.0" prefWidth="60.0">
<Button fx:id="deleteBtn" mnemonicParsing="false" onAction="#handleDeleteBtn" prefHeight="25.0" prefWidth="60.0">
<font>
<Font name="Lucida Console" size="12.0" />
</font>
......
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