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

"Disabled datepicker. Made screen unresizable when starting from main menu"

parent 2c63e60b
No related branches found
No related tags found
5 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.,!31Added input validation to tableviews
package no.ntnu.idatt1002.demo.controller; package no.ntnu.idatt1002.demo.controller;
import java.time.LocalDate;
import javafx.collections.FXCollections; import javafx.collections.FXCollections;
import javafx.collections.ObservableList; import javafx.collections.ObservableList;
import javafx.event.ActionEvent; import javafx.event.ActionEvent;
...@@ -60,6 +61,9 @@ public class BudgetController implements FinanceController { ...@@ -60,6 +61,9 @@ public class BudgetController implements FinanceController {
@FXML @FXML
private Text sum; private Text sum;
@FXML
private DatePicker date;
@FXML @FXML
private TableColumn<BudgetItem, Double> percentageColumn; private TableColumn<BudgetItem, Double> percentageColumn;
...@@ -85,6 +89,7 @@ public class BudgetController implements FinanceController { ...@@ -85,6 +89,7 @@ public class BudgetController implements FinanceController {
budgetList = FXCollections.observableArrayList(general.getBudgetItems()); budgetList = FXCollections.observableArrayList(general.getBudgetItems());
budgetTableView.setItems(budgetList); budgetTableView.setItems(budgetList);
formatDatePicker();
//createBudgetPieChart(); //createBudgetPieChart();
//Initialize sum field under the tableview //Initialize sum field under the tableview
//sum.setText(String.valueOf(general.totalSum())); //sum.setText(String.valueOf(general.totalSum()));
...@@ -99,6 +104,16 @@ public class BudgetController implements FinanceController { ...@@ -99,6 +104,16 @@ public class BudgetController implements FinanceController {
); );
} }
/**
* Method for disabling the date picker, yet having its opacity at max.
*/
private void formatDatePicker() {
date.setValue(LocalDate.now());
date.setDisable(true);
date.setStyle("-fx-opacity: 1");
date.getEditor().setStyle("-fx-opacity: 1");
}
@Override @Override
public void handleAddBtn(ActionEvent event) { public void handleAddBtn(ActionEvent event) {
handleEditBtn(event); handleEditBtn(event);
...@@ -189,7 +204,7 @@ public class BudgetController implements FinanceController { ...@@ -189,7 +204,7 @@ public class BudgetController implements FinanceController {
public void refreshTableView(){ public void refreshTableView(){
this.budgetList.setAll(general.getBudgetItems()); this.budgetList.setAll(general.getBudgetItems());
//Refreshing the sum of the amounts of the budget //Refreshing the sum of the amounts of the budget
this.sum.setText(String.valueOf(general.totalSum())); //this.sum.setText(String.valueOf(general.totalSum()));
} }
/** /**
......
...@@ -2,6 +2,7 @@ package no.ntnu.idatt1002.demo.controller; ...@@ -2,6 +2,7 @@ package no.ntnu.idatt1002.demo.controller;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.io.IOException; import java.io.IOException;
import java.time.LocalDate;
import java.util.Optional; import java.util.Optional;
import javafx.collections.FXCollections; import javafx.collections.FXCollections;
import javafx.collections.ObservableList; import javafx.collections.ObservableList;
...@@ -156,6 +157,7 @@ public class IncomeExpenseController implements FinanceController { ...@@ -156,6 +157,7 @@ public class IncomeExpenseController implements FinanceController {
refreshProgress(); refreshProgress();
formatDatePicker();
//Initialize sum field under the tableview //Initialize sum field under the tableview
// inSum.setText(String.valueOf(incomeRegister.getTotalSum())); // inSum.setText(String.valueOf(incomeRegister.getTotalSum()));
//expSum.setText(String.valueOf(expenseRegister.getTotalSum())); //expSum.setText(String.valueOf(expenseRegister.getTotalSum()));
...@@ -192,6 +194,15 @@ public class IncomeExpenseController implements FinanceController { ...@@ -192,6 +194,15 @@ public class IncomeExpenseController implements FinanceController {
); );
} }
/**
* Method for disabling the date picker, yet having its opacity at max.
*/
private void formatDatePicker() {
date.setValue(LocalDate.now());
date.setDisable(true);
date.setStyle("-fx-opacity: 1");
date.getEditor().setStyle("-fx-opacity: 1");
}
/** /**
* Method for handling the adding of new entries in the tableview. * Method for handling the adding of new entries in the tableview.
* @param event A button click on the add button. * @param event A button click on the add button.
......
...@@ -163,6 +163,7 @@ public class MainMenu { ...@@ -163,6 +163,7 @@ public class MainMenu {
Stage stage = (Stage) ((Node) event.getSource()).getScene().getWindow(); Stage stage = (Stage) ((Node) event.getSource()).getScene().getWindow();
Scene scene = new Scene(root); Scene scene = new Scene(root);
stage.setScene(scene); stage.setScene(scene);
stage.setResizable(false);
stage.show(); stage.show();
} }
} }
......
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