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

Continued working on implementing several budgets

parent 28f63fa0
No related branches found
No related tags found
1 merge request!43Merging frontend-testing into master
Showing
with 88 additions and 28 deletions
...@@ -85,6 +85,9 @@ public class BudgetController extends FinanceController { ...@@ -85,6 +85,9 @@ public class BudgetController extends FinanceController {
@FXML @FXML
private PieChart budgetPieChart; private PieChart budgetPieChart;
@FXML
private Label daysLeftLbl;
/** /**
* Initializes the budget register, the observable budget list and the tableview, along with the values of the dropbox used for filtering the tableview. * Initializes the budget register, the observable budget list and the tableview, along with the values of the dropbox used for filtering the tableview.
...@@ -107,6 +110,7 @@ public class BudgetController extends FinanceController { ...@@ -107,6 +110,7 @@ public class BudgetController extends FinanceController {
if (FileHandlingBudget.isNewBudget("Budget")) { if (FileHandlingBudget.isNewBudget("Budget")) {
returnBtn.setOpacity(0); returnBtn.setOpacity(0);
returnBtn.setDisable(true); returnBtn.setDisable(true);
daysLeftLbl.setOpacity(0);
} else { } else {
refreshPieChart(); refreshPieChart();
//addBtn.setDisable(true); //addBtn.setDisable(true);
...@@ -118,6 +122,7 @@ public class BudgetController extends FinanceController { ...@@ -118,6 +122,7 @@ public class BudgetController extends FinanceController {
continueBtn.setOpacity(0); continueBtn.setOpacity(0);
} }
} catch(IOException ioe) { } catch(IOException ioe) {
ioe.printStackTrace();
showErrorDialogBox("File reading error", "Error in reading file", "Could not" showErrorDialogBox("File reading error", "Error in reading file", "Could not"
+ "read from the Budget file"); + "read from the Budget file");
} }
......
...@@ -206,6 +206,7 @@ public class MainMenu { ...@@ -206,6 +206,7 @@ public class MainMenu {
public GeneralBudget loadBudgetDataFromFile(String fileName) throws IOException { public GeneralBudget loadBudgetDataFromFile(String fileName) throws IOException {
//Instantiate new budget //Instantiate new budget
if (FileHandlingBudget.isEmpty(fileName)) { if (FileHandlingBudget.isEmpty(fileName)) {
System.out.println("hey");
generalBudget = new GeneralBudget(1000); generalBudget = new GeneralBudget(1000);
} else { //Load previous budget } else { //Load previous budget
try { try {
......
...@@ -100,7 +100,7 @@ public class SceneController { ...@@ -100,7 +100,7 @@ public class SceneController {
} }
public void switchMainMenu(ActionEvent event) throws IOException { public void switchMainMenu(ActionEvent event) throws IOException {
FXMLLoader loader = new FXMLLoader(SceneController.class.getResource("/view/dualList.fxml")); FXMLLoader loader = new FXMLLoader(SceneController.class.getResource("/view/MainMenuNew.fxml"));
Parent root = loader.load(); Parent root = loader.load();
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);
......
maxAmount=50.0
\ No newline at end of file
maxAmount=50.0
\ No newline at end of file
maxAmount=50.0
\ No newline at end of file
maxAmount=50.0
\ No newline at end of file
APRIL1
\ No newline at end of file
...@@ -72,11 +72,11 @@ ...@@ -72,11 +72,11 @@
</BorderPane> </BorderPane>
<BorderPane prefHeight="64.0" prefWidth="1100.0"> <BorderPane prefHeight="64.0" prefWidth="1100.0">
<left> <left>
<HBox prefHeight="100.0" prefWidth="200.0" spacing="10.0" BorderPane.alignment="CENTER"> <HBox prefHeight="64.0" prefWidth="326.0" spacing="10.0" BorderPane.alignment="CENTER">
<children> <children>
<Button fx:id="addBtn" mnemonicParsing="false" onAction="#handleAddBtn" prefHeight="25.0" prefWidth="60.0"> <Button fx:id="addBtn" mnemonicParsing="false" onAction="#handleAddBtn" prefHeight="25.0" prefWidth="60.0" text="Add">
<font> <font>
<Font name="Lucida Console" size="12.0" /> <Font name="Lucida Console" size="14.0" />
</font> </font>
<graphic> <graphic>
<ImageView fitHeight="30.0" fitWidth="50.0" pickOnBounds="true" preserveRatio="true"> <ImageView fitHeight="30.0" fitWidth="50.0" pickOnBounds="true" preserveRatio="true">
...@@ -86,9 +86,9 @@ ...@@ -86,9 +86,9 @@
</ImageView> </ImageView>
</graphic> </graphic>
</Button> </Button>
<Button fx:id="editBtn" mnemonicParsing="false" onAction="#handleEditBtn" prefHeight="25.0" prefWidth="60.0"> <Button fx:id="editBtn" mnemonicParsing="false" onAction="#handleEditBtn" prefHeight="39.0" prefWidth="91.0" text="Edit">
<font> <font>
<Font name="Lucida Console" size="12.0" /> <Font name="Lucida Console" size="14.0" />
</font> </font>
<graphic> <graphic>
<ImageView fitHeight="30.0" fitWidth="50.0" pickOnBounds="true" preserveRatio="true"> <ImageView fitHeight="30.0" fitWidth="50.0" pickOnBounds="true" preserveRatio="true">
...@@ -98,9 +98,9 @@ ...@@ -98,9 +98,9 @@
</ImageView> </ImageView>
</graphic> </graphic>
</Button> </Button>
<Button fx:id="deleteBtn" mnemonicParsing="false" onAction="#handleDeleteBtn" prefHeight="25.0" prefWidth="60.0"> <Button fx:id="deleteBtn" mnemonicParsing="false" onAction="#handleDeleteBtn" prefHeight="39.0" prefWidth="119.0" text="Delete">
<font> <font>
<Font name="Lucida Console" size="12.0" /> <Font name="Lucida Console" size="14.0" />
</font> </font>
<graphic> <graphic>
<ImageView fitHeight="30.0" fitWidth="50.0" pickOnBounds="true" preserveRatio="true"> <ImageView fitHeight="30.0" fitWidth="50.0" pickOnBounds="true" preserveRatio="true">
...@@ -177,8 +177,12 @@ ...@@ -177,8 +177,12 @@
<Insets top="10.0" /> <Insets top="10.0" />
</VBox.margin> </VBox.margin>
</TableView> </TableView>
<Button fx:id="backBtn" mnemonicParsing="false" text="back" /> <HBox alignment="TOP_RIGHT">
<Button fx:id="continueBtn" mnemonicParsing="false" text="continue" /> <children>
<Button fx:id="backBtn" mnemonicParsing="false" text="back" />
<Button fx:id="continueBtn" mnemonicParsing="false" text="continue" />
</children>
</HBox>
</children> </children>
<GridPane.margin> <GridPane.margin>
<Insets top="30.0" /> <Insets top="30.0" />
......
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.DialogPane?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.layout.ColumnConstraints?>
<?import javafx.scene.layout.GridPane?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.Pane?>
<?import javafx.scene.layout.RowConstraints?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Text?>
<DialogPane prefHeight="225.0" prefWidth="240.0" xmlns="http://javafx.com/javafx/19" xmlns:fx="http://javafx.com/fxml/1" fx:controller="no.ntnu.idatt1002.demo.controller.CreateBudgetController">
<content>
<VBox>
<children>
<GridPane>
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints />
<RowConstraints maxHeight="20.0" minHeight="10.0" prefHeight="20.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="20.0" minHeight="10.0" prefHeight="20.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<TextField fx:id="nameField" promptText="Name" GridPane.columnIndex="1" GridPane.rowIndex="1" />
<Label text="Name: " GridPane.rowIndex="1" />
</children>
</GridPane>
<Label fx:id="errorMsg" alignment="CENTER_RIGHT" opacity="0.0" text="Please fill in the name" textFill="RED" />
<HBox alignment="CENTER_RIGHT" prefHeight="100.0" prefWidth="200.0" spacing="5.0">
<children>
<Button fx:id="cancelBtn" mnemonicParsing="false" onAction="#pressCancelBtn" prefWidth="70.0" text="Cancel" />
<Button fx:id="okBtn" mnemonicParsing="false" onAction="#pressOkBtn" prefWidth="70.0" text="OK" />
</children>
<VBox.margin>
<Insets top="10.0" />
</VBox.margin>
</HBox>
</children>
</VBox>
</content>
<header>
<Pane prefHeight="40.0">
<children>
<Text layoutX="12.0" layoutY="25.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Please type the name of your budget" />
</children>
</Pane>
</header>
</DialogPane>
...@@ -79,9 +79,9 @@ ...@@ -79,9 +79,9 @@
</BorderPane> </BorderPane>
<BorderPane prefHeight="64.0" prefWidth="1100.0"> <BorderPane prefHeight="64.0" prefWidth="1100.0">
<left> <left>
<HBox alignment="CENTER_LEFT" prefHeight="100.0" prefWidth="200.0" spacing="10.0" BorderPane.alignment="CENTER"> <HBox alignment="CENTER_LEFT" prefHeight="64.0" prefWidth="261.0" spacing="10.0" BorderPane.alignment="CENTER">
<children> <children>
<MenuButton mnemonicParsing="false" prefHeight="25.0" prefWidth="50.0"> <MenuButton mnemonicParsing="false" prefHeight="38.0" prefWidth="101.0" text="ADD">
<items> <items>
<MenuItem fx:id="addIncome" mnemonicParsing="false" onAction="#handleAddBtn" text="Income" /> <MenuItem fx:id="addIncome" mnemonicParsing="false" onAction="#handleAddBtn" text="Income" />
<MenuItem fx:id="addExpense" mnemonicParsing="false" onAction="#handleAddBtn" text="Expense" /> <MenuItem fx:id="addExpense" mnemonicParsing="false" onAction="#handleAddBtn" text="Expense" />
...@@ -93,8 +93,11 @@ ...@@ -93,8 +93,11 @@
</image> </image>
</ImageView> </ImageView>
</graphic> </graphic>
<font>
<Font name="Lucida Console" size="14.0" />
</font>
</MenuButton> </MenuButton>
<Button mnemonicParsing="false" text="popup explaining how to edit/delete" /> <Button mnemonicParsing="false" />
</children> </children>
<BorderPane.margin> <BorderPane.margin>
<Insets left="30.0" /> <Insets left="30.0" />
...@@ -113,7 +116,7 @@ ...@@ -113,7 +116,7 @@
<center> <center>
<Pane BorderPane.alignment="CENTER"> <Pane BorderPane.alignment="CENTER">
<children> <children>
<ComboBox fx:id="filter" layoutX="135.0" layoutY="25.0" prefWidth="150.0" promptText="Show"> <ComboBox fx:id="filter" layoutX="74.0" layoutY="19.0" prefWidth="150.0" promptText="Show">
<opaqueInsets> <opaqueInsets>
<Insets /> <Insets />
</opaqueInsets> </opaqueInsets>
......
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
<?import javafx.scene.layout.VBox?> <?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Font?> <?import javafx.scene.text.Font?>
<AnchorPane fx:id="root" xmlns="http://javafx.com/javafx/19" xmlns:fx="http://javafx.com/fxml/1" fx:controller="no.ntnu.idatt1002.demo.controller.MainMenu"> <AnchorPane fx:id="root" xmlns="http://javafx.com/javafx/19" xmlns:fx="http://javafx.com/fxml/1" fx:controller="no.ntnu.idatt1002.demo.controller.MainMenu">
<children> <children>
<ImageView fitHeight="719.0" fitWidth="1130.0" layoutY="-3.0" pickOnBounds="true" preserveRatio="true"> <ImageView fitHeight="719.0" fitWidth="1130.0" layoutY="-3.0" pickOnBounds="true" preserveRatio="true">
...@@ -201,19 +200,7 @@ ...@@ -201,19 +200,7 @@
<Font name="Lucida Console" size="14.0" /> <Font name="Lucida Console" size="14.0" />
</font> </font>
</Button> </Button>
<Button fx:id="expenseBtn" contentDisplay="TOP" mnemonicParsing="false" onAction="#switchScene" prefHeight="100.0" prefWidth="150.0" text="View expenses"> <Button fx:id="incomeBtn" alignment="TOP_CENTER" contentDisplay="TOP" mnemonicParsing="false" onAction="#switchScene" prefHeight="100.0" prefWidth="150.0" text="Income/expenses">
<graphic>
<ImageView fitHeight="75.0" fitWidth="75.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@../Images/expense.png" />
</image>
</ImageView>
</graphic>
<font>
<Font name="Lucida Console" size="14.0" />
</font>
</Button>
<Button fx:id="incomeBtn" alignment="TOP_CENTER" contentDisplay="TOP" mnemonicParsing="false" onAction="#switchScene" prefHeight="100.0" prefWidth="150.0" text="View income">
<graphic> <graphic>
<ImageView fitHeight="75.0" fitWidth="75.0" pickOnBounds="true" preserveRatio="true"> <ImageView fitHeight="75.0" fitWidth="75.0" pickOnBounds="true" preserveRatio="true">
<image> <image>
......
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