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

Commented out sections of code relating to expense overview. Connected all...

Commented out sections of code relating to expense overview. Connected all fxml files to the same controller
parent e754ca68
No related branches found
No related tags found
1 merge request!6Merging the frontend baseline to get up to date with the progress
Pipeline #204349 passed
......@@ -22,73 +22,73 @@ import javafx.stage.Stage;
import no.ntnu.idatt1002.demo.data.Expense;
import no.ntnu.idatt1002.demo.data.ExpenseCategory;
public class SceneController implements Initializable {
private Stage stage;
private Scene scene;
private Parent root;
@FXML
private Button add;
@FXML
private ComboBox<?> show;
@FXML
private TableColumn<Expense, Double> amount;
@FXML
private TableColumn<Expense, ExpenseCategory> category;
@FXML
private TableColumn<Expense, String> date;
@FXML
private TableColumn<Expense, String> description;
@FXML
private TableView<Expense> expenseTableView;
ObservableList<Expense> expenses = FXCollections.observableArrayList(
new Expense("", 1000.00, true, ExpenseCategory.FOOD, "1/1/23")
);
@Override
public void initialize(URL url, ResourceBundle resourceBundle) {
amount.setCellValueFactory(new PropertyValueFactory<Expense, Double>("amount"));
category.setCellValueFactory(new PropertyValueFactory<Expense, ExpenseCategory>("category"));
date.setCellValueFactory(new PropertyValueFactory<Expense, String>("date"));
description.setCellValueFactory(new PropertyValueFactory<Expense, String>("description"));
expenseTableView.setItems(expenses);
}
public void switchStartMenu(ActionEvent event) throws IOException {
FXMLLoader loader = new FXMLLoader(getClass().getResource("/view/FirstMenu.fxml"));
root = loader.load();
stage = (Stage)((Node)event.getSource()).getScene().getWindow();
scene = new Scene(root);
stage.setScene(scene);
stage.show();
}
public void switchNewBudget(ActionEvent event) throws IOException {
FXMLLoader loader = new FXMLLoader(SceneController.class.getResource("/view/NewBudget.fxml"));
Parent root = loader.load();
stage = (Stage)((Node)event.getSource()).getScene().getWindow();
scene = new Scene(root);
stage.setScene(scene);
stage.show();
}
public void switchExpenses(ActionEvent event) throws IOException {
FXMLLoader loader = new FXMLLoader(SceneController.class.getResource("/view/Expenses.fxml"));
Parent root = loader.load();
stage = (Stage)((Node)event.getSource()).getScene().getWindow();
scene = new Scene(root);
stage.setScene(scene);
stage.show();
}
public void addExpense(ActionEvent event) throws IOException {
}
}
\ No newline at end of file
public class SceneController /*implements Initializable*/ {
private Stage stage;
private Scene scene;
private Parent root;
/*@FXML
private Button add;
@FXML
private ComboBox<?> show;
@FXML
private TableColumn<Expense, Double> amount;
@FXML
private TableColumn<Expense, ExpenseCategory> category;
@FXML
private TableColumn<Expense, String> date;
@FXML
private TableColumn<Expense, String> description;
@FXML
private TableView<Expense> expenseTableView;
ObservableList<Expense> expenses = FXCollections.observableArrayList(
new Expense("", 1000.00, true, ExpenseCategory.FOOD, "1/1/23")
);
@Override
public void initialize(URL url, ResourceBundle resourceBundle) {
amount.setCellValueFactory(new PropertyValueFactory<Expense, Double>("amount"));
category.setCellValueFactory(new PropertyValueFactory<Expense, ExpenseCategory>("category"));
date.setCellValueFactory(new PropertyValueFactory<Expense, String>("date"));
description.setCellValueFactory(new PropertyValueFactory<Expense, String>("description"));
expenseTableView.setItems(expenses);
}*/
public void switchStartMenu(ActionEvent event) throws IOException {
FXMLLoader loader = new FXMLLoader(getClass().getResource("/view/FirstMenu.fxml"));
root = loader.load();
stage = (Stage)((Node)event.getSource()).getScene().getWindow();
scene = new Scene(root);
stage.setScene(scene);
stage.show();
}
public void switchNewBudget(ActionEvent event) throws IOException {
FXMLLoader loader = new FXMLLoader(SceneController.class.getResource("/view/NewBudget.fxml"));
Parent root = loader.load();
stage = (Stage)((Node)event.getSource()).getScene().getWindow();
scene = new Scene(root);
stage.setScene(scene);
stage.show();
}
public void switchExpenses(ActionEvent event) throws IOException {
FXMLLoader loader = new FXMLLoader(SceneController.class.getResource("/view/Expenses.fxml"));
Parent root = loader.load();
stage = (Stage)((Node)event.getSource()).getScene().getWindow();
scene = new Scene(root);
stage.setScene(scene);
stage.show();
}
public void addExpense(ActionEvent event) throws IOException {
}
}
package no.ntnu.idatt1002.demo.view;
public class App {
public static void main(String[] args) {
MyApp.main(args);
}
}
public static void main(String[] args) {
MyApp.main(args);
}
}
\ No newline at end of file
......@@ -12,12 +12,13 @@ public class MyApp extends Application {
@Override
public void start(Stage stage) throws IOException {
FXMLLoader loader = new FXMLLoader(getClass().getResource("/view/FirstMenu.fxml"));
Parent root = loader.load();
Scene scene = new Scene(root);
stage.setScene(scene);
stage.show();
FXMLLoader loader = new FXMLLoader(getClass().getResource("/view/FirstMenu.fxml"));
Parent root = loader.load();
Scene scene = new Scene(root);
stage.setScene(scene);
stage.show();
}
public static void main(String[] args) {
launch(args);
}
......
......@@ -10,7 +10,7 @@
<?import javafx.scene.layout.GridPane?>
<?import javafx.scene.layout.RowConstraints?>
<DialogPane prefWidth="480.0" xmlns="http://javafx.com/javafx/19" xmlns:fx="http://javafx.com/fxml/1">
<DialogPane prefWidth="480.0" xmlns="http://javafx.com/javafx/19" xmlns:fx="http://javafx.com/fxml/1" fx:controller="no.ntnu.idatt1002.demo.controller.SceneController">
<content>
<GridPane hgap="10.0" vgap="10.0">
<columnConstraints>
......
......@@ -33,7 +33,7 @@
<top>
<HBox BorderPane.alignment="CENTER">
<children>
<Button mnemonicParsing="false" onAction="#switchStartMenu" text="Return ">
<Button mnemonicParsing="false" text="Return ">
<opaqueInsets>
<Insets left="100.0" />
</opaqueInsets>
......@@ -71,13 +71,11 @@
<RowConstraints maxHeight="298.66665744781494" minHeight="10.0" prefHeight="29.999959309895814" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<HBox alignment="BOTTOM_LEFT" prefWidth="410.0">
<HBox alignment="BOTTOM_LEFT" prefWidth="410.0" spacing="5.0">
<children>
<Button alignment="TOP_CENTER" mnemonicParsing="false" prefHeight="26.0" prefWidth="189.0" text="Add expense" textAlignment="CENTER">
<font>
<Font size="14.0" />
</font>
</Button>
<Button fx:id="add" alignment="TOP_CENTER" mnemonicParsing="false" text="Add" textAlignment="CENTER" />
<Button fx:id="add1" alignment="TOP_CENTER" mnemonicParsing="false" text="Edit" textAlignment="CENTER" />
<Button fx:id="add11" alignment="TOP_CENTER" mnemonicParsing="false" text="Delete" textAlignment="CENTER" />
</children>
<opaqueInsets>
<Insets />
......@@ -88,7 +86,7 @@
</HBox>
<VBox alignment="BOTTOM_LEFT" prefHeight="200.0" prefWidth="100.0" spacing="5.0" GridPane.columnIndex="1">
<children>
<ComboBox prefWidth="150.0" promptText="Show">
<ComboBox fx:id="show" prefWidth="150.0" promptText="Show">
<opaqueInsets>
<Insets />
</opaqueInsets>
......
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