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

Made recurringBox contain a boolean instead of a yes/no string, in order to...

Made recurringBox contain a boolean instead of a yes/no string, in order to bind it together with the recurring attribute
parent 08c8d146
Branches fix/navbar-type
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
package no.ntnu.idatt1002.demo.controller;
import java.io.IOException;
import java.text.NumberFormat;
import java.util.Optional;
import javafx.beans.property.DoubleProperty;
import javafx.beans.property.SimpleDoubleProperty;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Node;
import javafx.scene.control.Button;
import javafx.scene.control.ButtonType;
import javafx.scene.control.ComboBox;
import javafx.scene.control.Dialog;
import javafx.scene.control.DialogPane;
import javafx.scene.control.TextField;
import javafx.stage.Stage;
import no.ntnu.idatt1002.demo.data.Economics.Expense;
import no.ntnu.idatt1002.demo.data.Economics.ExpenseCategory;
import no.ntnu.idatt1002.demo.view.ExpenseRepository;
public class AddExpenseController {
Expense newExpense = null; //the expense that is chosen when editing or the expense that is created when adding
......@@ -70,7 +57,7 @@ public class AddExpenseController {
}
public boolean isRecurring() {
return recurringBox.getValue().equals("Yes");
return recurringBox.getValue();//.equals("Yes");
}
public void setExpense(Expense expense) { //TODO NEED CANCEL BUTTON TO REMOVE THE CHANGES IF CANCEL IS PRESSED
......@@ -80,6 +67,8 @@ public class AddExpenseController {
//categoryBox.valueProperty().bindBidirectional(expense.getCategory());
recurringBox.valueProperty().bindBidirectional(expense.recurringProperty());
}
@FXML
public void pressOkBtn(ActionEvent event) {
String date = dateField.getText();
double amount = Double.parseDouble(amountField.getText());
......@@ -93,6 +82,7 @@ public class AddExpenseController {
((Stage) source.getScene().getWindow()).close();
}
@FXML
public void pressCancelBtn(ActionEvent event) {
final Node source = (Node) event.getSource();
final Stage stage = (Stage) source.getScene().getWindow();
......
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