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

Converted parameters in alertbox to local variables. Changed the confirmation...

Converted parameters in alertbox to local variables. Changed the confirmation message to accoutn for both expense and income
parent 8eb43a5e
No related branches found
No related tags found
10 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,!24Merging frontend-testing with master,!23Merging frontend-testing and master
......@@ -28,7 +28,6 @@ import no.ntnu.idatt1002.demo.data.Economics.Expense;
import no.ntnu.idatt1002.demo.data.Economics.ExpenseCategory;
import no.ntnu.idatt1002.demo.data.Economics.ExpenseRegister;
import no.ntnu.idatt1002.demo.data.Economics.FileHandling;
import no.ntnu.idatt1002.demo.view.ExpenseRepository;
enum DialogMode {
ADD, EDIT, DELETE
......@@ -157,19 +156,19 @@ public class ExpensesController {
@FXML
public void handleDeleteBtn(ActionEvent event) {
Optional<ButtonType> isConfirmed = showConfirmationDialog("Confirm Delete", "Delete Confirmation",
"Are you sure you would like to delete the selected expense?");
Optional<ButtonType> isConfirmed = showConfirmationDialog(
);
if (isConfirmed.isPresent() && isConfirmed.get() == ButtonType.OK) {
int selectedIdx = expenseTableView.getSelectionModel().getSelectedIndex();
expenses.remove(selectedIdx);
}
}
private Optional<ButtonType> showConfirmationDialog(String title, String headerText, String contentText) {
private Optional<ButtonType> showConfirmationDialog() {
Alert alert = new Alert(AlertType.CONFIRMATION);
alert.setTitle(title);
alert.setHeaderText(headerText);
alert.setContentText(contentText);
alert.setTitle("Confirm Delete");
alert.setHeaderText("Delete Confirmation");
alert.setContentText("Are you sure you would like to delete the selected entry?");
return alert.showAndWait();
}
......
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