diff --git a/ShareDatabaseApp.iml b/ShareDatabaseApp.iml
index c90834f..109adcc 100644
--- a/ShareDatabaseApp.iml
+++ b/ShareDatabaseApp.iml
@@ -7,5 +7,6 @@
+
\ No newline at end of file
diff --git a/src/com/atden04/java/share_database_app/enums/StockStatus.java b/src/com/atden04/java/share_database_app/enums/StockStatus.java
new file mode 100644
index 0000000..1ab4d10
--- /dev/null
+++ b/src/com/atden04/java/share_database_app/enums/StockStatus.java
@@ -0,0 +1,11 @@
+package com.atden04.java.share_database_app.enums;
+
+/**
+ * Enumeration for the status of the Stock
+ */
+public enum StockStatus {
+ DEFAULT,
+ BOUGHT,
+ SOLD,
+ LIQUIDATED
+}
diff --git a/src/com/atden04/java/share_database_app/models/Dividend.java b/src/com/atden04/java/share_database_app/models/Dividend.java
new file mode 100644
index 0000000..b5f41dd
--- /dev/null
+++ b/src/com/atden04/java/share_database_app/models/Dividend.java
@@ -0,0 +1,61 @@
+package com.atden04.java.share_database_app.models;
+
+import javafx.beans.property.SimpleFloatProperty;
+import javafx.beans.property.SimpleStringProperty;
+
+/**
+ * Class to store all data regarding the dividends of a stock.
+ */
+public class Dividend {
+ /**
+ * Date of the dividend being paid
+ */
+ private SimpleStringProperty date;
+
+ /**
+ * Quantity of shares held on the Ex-dividend date.
+ */
+ private SimpleFloatProperty quantity;
+
+ /**
+ * The amount paid to shareholders per share of the dividend
+ */
+ private SimpleFloatProperty paymentRate;
+
+ /**
+ * The value of the dividend as a whole.
+ */
+ private SimpleFloatProperty value;
+
+ /**
+ * Base constructor for the Dividend class
+ */
+ public Dividend(){
+ this.date = new SimpleStringProperty();
+ this.quantity = new SimpleFloatProperty();
+ this.value = new SimpleFloatProperty();
+ this.paymentRate = new SimpleFloatProperty();
+ }
+
+ /**
+ * Overloaded constructor for the Dividend class
+ * @param date Date Dividend occurred
+ * @param quantity Quantity of shares held
+ * @param value Value of Dividend payment
+ */
+ public Dividend(String date, float quantity, float value){
+ this.date = new SimpleStringProperty(date);
+ this.quantity = new SimpleFloatProperty(quantity);
+ this.value = new SimpleFloatProperty(value);
+ this.paymentRate = new SimpleFloatProperty(this.value.get()/this.quantity.get());
+ }
+
+ /**
+ * Overridden method to output the object as a string
+ * @return string output
+ */
+ @Override
+ public String toString(){
+ return "Date : " + this.date + ", Quantity : " + this.quantity + ", Payment Rate : £" + this.paymentRate + ", Value : £" + this.value;
+ }
+}
diff --git a/src/com/atden04/java/share_database_app/models/Liquidation.java b/src/com/atden04/java/share_database_app/models/Liquidation.java
new file mode 100644
index 0000000..dd6fc62
--- /dev/null
+++ b/src/com/atden04/java/share_database_app/models/Liquidation.java
@@ -0,0 +1,54 @@
+package com.atden04.java.share_database_app.models;
+
+import javafx.beans.property.SimpleFloatProperty;
+import javafx.beans.property.SimpleStringProperty;
+
+/**
+ * Class to store all data regarding the liquidations of a stock.
+ */
+public class Liquidation {
+ /**
+ * Date of the liquidation payment being paid
+ */
+ private SimpleStringProperty date;
+
+ /**
+ * Quantity of shares held at the point of liquidation
+ */
+ private SimpleFloatProperty quantity;
+
+ /**
+ * The value of the liquidation payment
+ */
+ private SimpleFloatProperty value;
+
+ /**
+ * Base constructor for the Liquidation class
+ */
+ public Liquidation() {
+ this.date = new SimpleStringProperty();
+ this.quantity = new SimpleFloatProperty();
+ this.value = new SimpleFloatProperty();
+ }
+
+ /**
+ * Overloaded constructor for the Liquidation class
+ * @param date Date Liquidation payment received
+ * @param quantity Quantity of shares held
+ * @param value Value of Liquidation payment
+ */
+ public Liquidation(String date, float quantity, float value){
+ this.date = new SimpleStringProperty(date);
+ this.quantity = new SimpleFloatProperty(quantity);
+ this.value = new SimpleFloatProperty(value);
+ }
+
+ /**
+ * Overridden method to output the object as a string
+ * @return string output
+ */
+ @Override
+ public String toString(){
+ return "Date : "+this.date+", Quantity : "+this.quantity+", Payment : £"+this.value;
+ }
+}
diff --git a/src/com/atden04/java/share_database_app/models/Purchase.java b/src/com/atden04/java/share_database_app/models/Purchase.java
new file mode 100644
index 0000000..3a44eef
--- /dev/null
+++ b/src/com/atden04/java/share_database_app/models/Purchase.java
@@ -0,0 +1,61 @@
+package com.atden04.java.share_database_app.models;
+
+import javafx.beans.property.SimpleFloatProperty;
+import javafx.beans.property.SimpleStringProperty;
+
+/**
+ * Class to store all data regarding the purchases of a stock
+ */
+public class Purchase {
+ /**
+ * Date of the purchase of stock
+ */
+ private SimpleStringProperty date;
+
+ /**
+ * Quantity of stock bought
+ */
+ private SimpleFloatProperty quantity;
+
+ /**
+ * Cost of the stock bought
+ */
+ private SimpleFloatProperty cost;
+
+ /**
+ * Average (mean) cost of each share
+ */
+ private SimpleFloatProperty costPerShare;
+
+ /**
+ * Base constructor for the Purchase class
+ */
+ public Purchase() {
+ this.date = new SimpleStringProperty();
+ this.quantity = new SimpleFloatProperty();
+ this.cost = new SimpleFloatProperty();
+ this.costPerShare = new SimpleFloatProperty();
+ }
+
+ /**
+ * Overloaded constructor for the Purchase class
+ * @param date Date of Purchase
+ * @param quantity Quantity of shares purchased
+ * @param cost Cost of shares purchased
+ */
+ public Purchase(String date, float quantity, float cost){
+ this.date = new SimpleStringProperty(date);
+ this.quantity = new SimpleFloatProperty(quantity);
+ this.cost = new SimpleFloatProperty(cost);
+ this.costPerShare = new SimpleFloatProperty(this.cost.get()/this.quantity.get());
+ }
+
+ /**
+ * Overridden method to output the object as a string
+ * @return string output
+ */
+ @Override
+ public String toString(){
+ return "Date : "+this.date+", Quantity : "+this.quantity+", Cost : £"+this.cost+", Cost per Share : £"+this.costPerShare;
+ }
+}
diff --git a/src/com/atden04/java/share_database_app/models/Sale.java b/src/com/atden04/java/share_database_app/models/Sale.java
new file mode 100644
index 0000000..4274651
--- /dev/null
+++ b/src/com/atden04/java/share_database_app/models/Sale.java
@@ -0,0 +1,62 @@
+package com.atden04.java.share_database_app.models;
+
+import javafx.beans.property.SimpleFloatProperty;
+import javafx.beans.property.SimpleStringProperty;
+
+/**
+ * Class to store all data regarding the sale of a stock
+ */
+public class Sale {
+ /**
+ * Date of the sale of stock
+ */
+ private SimpleStringProperty date;
+
+ /**
+ * Quantity of stock sold
+ */
+ private SimpleFloatProperty quantity;
+
+ /**
+ * Value of the sale
+ */
+ private SimpleFloatProperty value;
+
+ /**
+ * Profit made from the sale
+ */
+ private SimpleFloatProperty profit;
+
+ /**
+ * Base constructor for the Sale class
+ */
+ public Sale() {
+ this.date = new SimpleStringProperty();
+ this.quantity = new SimpleFloatProperty();
+ this.value = new SimpleFloatProperty();
+ this.profit = new SimpleFloatProperty();
+ }
+
+ /**
+ * Overloaded constructor for the Sale class
+ * @param date Date of Sale
+ * @param quantity Quantity of stock sold
+ * @param value Value of the sale
+ * @param cost Cost to buy the stock sold
+ */
+ public Sale(String date, float quantity, float value, float cost){
+ this.date = new SimpleStringProperty(date);
+ this.quantity = new SimpleFloatProperty(quantity);
+ this.value = new SimpleFloatProperty(value);
+ this.profit = new SimpleFloatProperty(this.value.get()-cost);
+ }
+
+ /**
+ * Overridden method to output the object as a string
+ * @return string output
+ */
+ @Override
+ public String toString(){
+ return "Date : "+this.date+", Quantity : "+this.quantity+", Sale : £"+this.value+", Profit : £"+this.profit;
+ }
+}
diff --git a/src/com/atden04/java/share_database_app/models/Stock.java b/src/com/atden04/java/share_database_app/models/Stock.java
new file mode 100644
index 0000000..01647d5
--- /dev/null
+++ b/src/com/atden04/java/share_database_app/models/Stock.java
@@ -0,0 +1,109 @@
+package com.atden04.java.share_database_app.models;
+
+import com.atden04.java.share_database_app.enums.StockStatus;
+import javafx.beans.property.SimpleStringProperty;
+import javafx.collections.ObservableList;
+
+import static javafx.collections.FXCollections.observableArrayList;
+
+public class Stock {
+ private SimpleStringProperty name;
+ private StockStatus status;
+ private ObservableList purchases;
+ private ObservableList dividends;
+ private ObservableList sales;
+ private ObservableList liquidations;
+ private float totalCost;
+ private float totalQuantity;
+ private float totalReturn;
+
+ public Stock() {
+ this.name = new SimpleStringProperty();
+ this.status = StockStatus.BOUGHT;
+ this.purchases = observableArrayList();
+ this.dividends = observableArrayList();
+ this.sales = observableArrayList();
+ this.liquidations = observableArrayList();
+ }
+
+ public Stock(String name, String status) {
+ this.name = new SimpleStringProperty(name);
+ if (status.equalsIgnoreCase("bought"))
+ this.status = StockStatus.BOUGHT;
+ else if (status.equalsIgnoreCase("sold"))
+ this.status = StockStatus.SOLD;
+ else if (status.equalsIgnoreCase("liquidated"))
+ this.status = StockStatus.LIQUIDATED;
+ this.purchases = observableArrayList();
+ this.dividends = observableArrayList();
+ this.sales = observableArrayList();
+ this.liquidations = observableArrayList();
+ }
+
+ public Stock(String name, String date, float quantity, float cost) {
+ this.name = new SimpleStringProperty(name);
+ this.status = StockStatus.BOUGHT;
+ this.purchases = observableArrayList();
+ this.dividends = observableArrayList();
+ this.purchases.add(new Purchase(date, quantity, cost));
+ this.sales = observableArrayList();
+ this.liquidations = observableArrayList();
+ this.totalCost+=cost;
+ this.totalQuantity+=quantity;
+ }
+
+ public void addPurchase(String date, float quantity, float cost) {
+ this.purchases.add(new Purchase(date, quantity, cost));
+ if (this.status != StockStatus.BOUGHT)
+ {
+ this.status = StockStatus.BOUGHT;
+ }
+ this.totalCost+=cost;
+ this.totalQuantity+=quantity;
+ }
+
+ public void addDividend(String date, float quantity, float value) {
+ this.dividends.add(new Dividend(date, quantity, value));
+ this.totalReturn+=value;
+ }
+
+ public void addSale(String date, float value) {
+ this.sales.add(new Sale(date, this.totalQuantity, value, this.totalCost));
+ this.status = StockStatus.SOLD;
+ this.totalReturn = value-this.totalCost;
+ this.totalQuantity = 0;
+ this.totalCost = 0;
+ }
+
+ public void addLiquidation(String date, float value) {
+ this.liquidations.add(new Liquidation(date, this.totalQuantity, value));
+ this.status = StockStatus.LIQUIDATED;
+ this.totalReturn+=value;
+ this.totalQuantity = 0;
+ }
+
+ public String toString() {
+ return "\nStock Name : "+this.getName()+", Status : "+this.getStatus()+", Quantity : "+this.totalQuantity + ", Cost : "+this.totalCost+", Return : "+this.totalReturn;
+ }
+
+ public String getName() {
+ return this.name.get();
+ }
+
+ public void setName(String newName) {
+ this.name.set(newName);
+ }
+
+ public StockStatus getStatus() {
+ return this.status;
+ }
+
+ public void setStatus(StockStatus newStatus) {
+ this.status = newStatus;
+ }
+
+ public ObservableList getPurchases(){return this.purchases;}
+
+ public ObservableList getDividends(){return this.dividends;}
+
+}
diff --git a/src/com/atden04/java/share_database_app/mvc/Controller.java b/src/com/atden04/java/share_database_app/mvc/Controller.java
new file mode 100644
index 0000000..f2426b7
--- /dev/null
+++ b/src/com/atden04/java/share_database_app/mvc/Controller.java
@@ -0,0 +1,208 @@
+package com.atden04.java.share_database_app.mvc;
+
+import com.atden04.java.share_database_app.models.Stock;
+import javafx.beans.property.SimpleStringProperty;
+import javafx.collections.ObservableList;
+import javafx.event.ActionEvent;
+import javafx.event.EventHandler;
+import javafx.fxml.FXML;
+import javafx.geometry.Pos;
+import javafx.scene.Scene;
+import javafx.scene.control.*;
+import javafx.scene.layout.HBox;
+import javafx.stage.Stage;
+import javafx.stage.WindowEvent;
+
+import java.util.Objects;
+
+public class Controller {
+
+ @FXML
+ public MenuItem addStockMenu;
+ @FXML
+ public MenuItem deleteRowMenu;
+ @FXML
+ public TabPane tabPane;
+ @FXML
+ public MenuItem outputData;
+ Model model;
+ Stage stage;
+
+ public Controller() {
+ System.out.println("Controller constructed");
+ }
+
+ public void initialise(Model model, Stage stage) {
+ this.model = model;
+ this.stage = stage;
+ }
+
+ public void handleAddStock(ActionEvent actionEvent) {
+ Stage addRowStage = new Stage();
+ addRowStage.initOwner(stage);
+
+ ObservableList options = this.model.getStockNames();
+ options.add(0, "New Stock");
+ ComboBox selectionBox = new ComboBox<>(options);
+ TextField addName = new TextField();
+ addName.setPromptText("Name");
+ addName.setVisible(false);
+ TextField addDate = new TextField();
+ addDate.setPromptText("Date Bought");
+ TextField addQuantity = new TextField();
+ addQuantity.setPromptText("Quantity");
+ TextField addCost = new TextField();
+ addCost.setPromptText("Cost");
+
+ final Button addButton = new Button("Add");
+
+ selectionBox.setOnAction(new EventHandler() {
+ @Override
+ public void handle(ActionEvent actionEvent) {
+ String choice = selectionBox.getValue();
+ addName.setVisible(Objects.equals(choice, "New Stock"));
+ }
+ });
+ addButton.setOnAction(new EventHandler() {
+ @Override public void handle(ActionEvent e) {
+ String newName = addName.getText();
+ String choice = selectionBox.getValue();
+ String date = addDate.getText();
+ float quantity = Float.parseFloat(addQuantity.getText());
+ float cost = Float.parseFloat(addCost.getText());
+
+ if (Objects.equals(choice, "New Stock")) {
+ model.addStock(newName, date, quantity,cost);
+ }
+ else {
+ model.addPurchase(choice, date, quantity, cost);
+ }
+ addName.clear();
+ addDate.clear();
+ addQuantity.clear();
+ addCost.clear();
+ }
+ });
+
+ HBox hBox = new HBox(selectionBox, addName, addDate, addQuantity, addCost, addButton);
+ hBox.alignmentProperty().set(Pos.CENTER);
+ hBox.setSpacing(10);
+
+ Scene addRowScene = new Scene(hBox, 900, 100);
+ addRowStage.setScene(addRowScene);
+ addRowStage.show();
+ addRowStage.setOnCloseRequest(new EventHandler() {
+ @Override
+ public void handle(WindowEvent windowEvent) {
+ options.remove(0); //options is only a reference, and we don't want this option elsewhere in the code
+ }
+ });
+ }
+
+ public void handleAddDividend(ActionEvent actionEvent) {
+ Stage addRowStage = new Stage();
+ addRowStage.initOwner(stage);
+
+ ComboBox selectionBox = new ComboBox<>(this.model.getStockNames());
+ TextField addDate = new TextField();
+ addDate.setPromptText("Pay Date");
+ TextField addQuantity = new TextField();
+ addQuantity.setPromptText("Holding");
+ TextField addValue = new TextField();
+ addValue.setPromptText("Payment");
+
+ final Button addButton = new Button("Add");
+ addButton.setOnAction(new EventHandler() {
+ @Override public void handle(ActionEvent e) {
+ String choice = selectionBox.getValue();
+ String date = addDate.getText();
+ float quantity = Float.parseFloat(addQuantity.getText());
+ float value = Float.parseFloat(addValue.getText());
+ model.addDividend(choice, date, quantity, value);
+ addDate.clear();
+ addQuantity.clear();
+ addValue.clear();
+ }
+ });
+
+ HBox hBox = new HBox(selectionBox, addDate, addQuantity, addValue, addButton);
+ hBox.alignmentProperty().set(Pos.CENTER);
+ hBox.setSpacing(10);
+
+ Scene addRowScene = new Scene(hBox, 900, 100);
+ addRowStage.setScene(addRowScene);
+ addRowStage.show();
+ }
+
+ public void handleAddSale(ActionEvent actionEvent) {
+ Stage addRowStage = new Stage();
+ addRowStage.initOwner(stage);
+
+ ComboBox selectionBox = new ComboBox<>(this.model.getStockNames());
+ TextField addDate = new TextField();
+ addDate.setPromptText("Date Sold");
+ TextField addValue = new TextField();
+ addValue.setPromptText("Value");
+
+ final Button addButton = new Button("Add");
+ addButton.setOnAction(new EventHandler() {
+ @Override public void handle(ActionEvent e) {
+ String choice = selectionBox.getValue();
+ String date = addDate.getText();
+ float value = Float.parseFloat(addValue.getText());
+ model.addSale(choice, date, value);
+ addDate.clear();
+ addValue.clear();
+ }
+ });
+
+ HBox hBox = new HBox(selectionBox, addDate, addValue, addButton);
+ hBox.alignmentProperty().set(Pos.CENTER);
+ hBox.setSpacing(10);
+
+ Scene addRowScene = new Scene(hBox, 900, 100);
+ addRowStage.setScene(addRowScene);
+ addRowStage.show();
+ }
+
+ public void handleAddLiquidation(ActionEvent actionEvent) {
+ Stage addRowStage = new Stage();
+ addRowStage.initOwner(stage);
+
+ ComboBox selectionBox = new ComboBox<>(this.model.getStockNames());
+ TextField addDate = new TextField();
+ addDate.setPromptText("Date Liquidated");
+ TextField addValue = new TextField();
+ addValue.setPromptText("Value");
+
+ final Button addButton = new Button("Add");
+ addButton.setOnAction(new EventHandler() {
+ @Override public void handle(ActionEvent e) {
+ String choice = selectionBox.getValue();
+ String date = addDate.getText();
+ float value = Float.parseFloat(addValue.getText());
+ model.addLiquidation(choice, date, value);
+ addDate.clear();
+ addValue.clear();
+ }
+ });
+
+ HBox hBox = new HBox(selectionBox, addDate, addValue, addButton);
+ hBox.alignmentProperty().set(Pos.CENTER);
+ hBox.setSpacing(10);
+
+ Scene addRowScene = new Scene(hBox, 900, 100);
+ addRowStage.setScene(addRowScene);
+ addRowStage.show();
+ }
+
+ public void handleDeleteRow(ActionEvent actionEvent) {
+ }
+
+ public void handleOutputData(ActionEvent actionEvent) {
+ System.out.println(this.model.getAllStock());
+ }
+
+
+
+}
diff --git a/src/com/atden04/java_test/user_interface/Main.java b/src/com/atden04/java/share_database_app/mvc/Main.java
similarity index 57%
rename from src/com/atden04/java_test/user_interface/Main.java
rename to src/com/atden04/java/share_database_app/mvc/Main.java
index c979e7f..50c626c 100644
--- a/src/com/atden04/java_test/user_interface/Main.java
+++ b/src/com/atden04/java/share_database_app/mvc/Main.java
@@ -1,37 +1,48 @@
-package com.atden04.java_test.user_interface;
+package com.atden04.java.share_database_app.mvc;
-import com.atden04.java_test.res.ResourceManager;
+import com.atden04.java.share_database_app.res.ResourceManager;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
-import java.net.URL;
-
// Press Shift twice to open the Search Everywhere dialog and type `show whitespaces`,
// then press Enter. You can now see whitespace characters in your code.
public class Main extends Application {
+ Model model;
Controller controller;
@Override
public void start(Stage stage) throws Exception {
- //Parent root = FXMLLoader.load(getClass().getResource("scene.fxml"));
- FXMLLoader loader = new FXMLLoader(ResourceManager.getFxml("scene.fxml"));
+ // Create the controller and model
this.controller = new Controller();
+ this.model = new Model();
+
+ //Create FXML Loader and set the controller
+ FXMLLoader loader = new FXMLLoader(ResourceManager.getFxml("scene.fxml"));
loader.setControllerFactory((Klass) -> this.controller);
+ //Load the root of the scene and create the scene itself
Parent root = loader.load();
Scene scene = new Scene(root);
scene.getStylesheets().add(ResourceManager.getCss("style.css").toExternalForm());
- stage.setTitle("JavaFX");
- stage.setScene(scene);
+ this.controller.initialise(this.model, stage);
+ this.model.initialise(this.controller);
+
+ stage.setTitle("Share Database App v0.1"); //set title of stage (window)
+ stage.setScene(scene); //set the scene of the stage
stage.show();
}
+ @Override
+ public void stop() {
+ System.out.println("Closing the App...");
+ }
+
public static void main(String[] args) {
launch(args);
}
diff --git a/src/com/atden04/java/share_database_app/mvc/Model.java b/src/com/atden04/java/share_database_app/mvc/Model.java
new file mode 100644
index 0000000..2cdf514
--- /dev/null
+++ b/src/com/atden04/java/share_database_app/mvc/Model.java
@@ -0,0 +1,67 @@
+package com.atden04.java.share_database_app.mvc;
+
+import com.atden04.java.share_database_app.models.Stock;
+import javafx.beans.property.SimpleStringProperty;
+import javafx.collections.FXCollections;
+import javafx.collections.ObservableList;
+
+import java.util.Objects;
+
+public class Model {
+ Controller controller;
+ private ObservableList stock;
+ private ObservableList stockNames;
+
+ public void initialise(Controller controller) {
+ this.controller = controller;
+ this.createStock();
+ //this.controller.createTable(this.stock, this.selectedStock);
+ }
+
+ private void createStock() {
+ this.stock = FXCollections.observableArrayList(
+ new Stock("StockA", "08/12/2023", 5, 10)
+ );
+ this.stockNames = FXCollections.observableArrayList("StockA");
+ }
+
+ private Stock getStock(String name) {
+ Stock returnValue = null;
+ for (Stock s: this.stock) {
+ if (Objects.equals(name, s.getName()))
+ returnValue = s;
+ }
+ return returnValue;
+ }
+
+ public ObservableList getAllStock(){
+ return this.stock;
+ }
+
+ public ObservableList getStockNames() {
+ return this.stockNames;
+ }
+
+ public void addStock(String newName, String date, float quantity, float cost)
+ {
+ this.stock.add(new Stock(newName, date, quantity, cost));
+ this.stockNames.add(newName);
+ }
+
+ public void addPurchase(String name, String date, float quantity, float cost)
+ {
+ this.getStock(name).addPurchase(date, quantity, cost);
+ }
+
+ public void addDividend(String choice, String date, float quantity, float value) {
+ this.getStock(choice).addDividend(date, quantity, value);
+ }
+
+ public void addSale(String choice, String date, float value) {
+ this.getStock(choice).addSale(date, value);
+ }
+
+ public void addLiquidation(String choice, String date, float value) {
+ this.getStock(choice).addLiquidation(date, value);
+ }
+}
diff --git a/src/com/atden04/java_test/res/ResourceManager.java b/src/com/atden04/java/share_database_app/res/ResourceManager.java
similarity index 75%
rename from src/com/atden04/java_test/res/ResourceManager.java
rename to src/com/atden04/java/share_database_app/res/ResourceManager.java
index 7f6e8c9..2a40993 100644
--- a/src/com/atden04/java_test/res/ResourceManager.java
+++ b/src/com/atden04/java/share_database_app/res/ResourceManager.java
@@ -1,4 +1,4 @@
-package com.atden04.java_test.res;
+package com.atden04.java.share_database_app.res;
import java.net.URL;
@@ -14,8 +14,8 @@ public static URL getFxml(String name) {
public static URL getCss(String name) {
var url = ResourceManager.class.getResource(name);
- if(url == null) {
- throw new RuntimeException("Resource not found: "+name);
+ if(url==null){
+ throw new RuntimeException("Resource not found: " + name);
}
return url;
}
diff --git a/src/com/atden04/java/share_database_app/res/purchase.csv b/src/com/atden04/java/share_database_app/res/purchase.csv
new file mode 100644
index 0000000..44f71d8
--- /dev/null
+++ b/src/com/atden04/java/share_database_app/res/purchase.csv
@@ -0,0 +1 @@
+stockA,28/10/2023,5,5.00
diff --git a/src/com/atden04/java/share_database_app/res/scene.fxml b/src/com/atden04/java/share_database_app/res/scene.fxml
new file mode 100644
index 0000000..48297b6
--- /dev/null
+++ b/src/com/atden04/java/share_database_app/res/scene.fxml
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/com/atden04/java/share_database_app/res/stock.csv b/src/com/atden04/java/share_database_app/res/stock.csv
new file mode 100644
index 0000000..c558c25
--- /dev/null
+++ b/src/com/atden04/java/share_database_app/res/stock.csv
@@ -0,0 +1,3 @@
+stockA, Bought
+stockB, Bought
+stockC, Bought
\ No newline at end of file
diff --git a/src/com/atden04/java/share_database_app/res/style.css b/src/com/atden04/java/share_database_app/res/style.css
new file mode 100644
index 0000000..4f840bc
--- /dev/null
+++ b/src/com/atden04/java/share_database_app/res/style.css
@@ -0,0 +1,3 @@
+.label {
+ -fx-test-fill: black;
+}
\ No newline at end of file
diff --git a/src/com/atden04/java_test/res/scene.fxml b/src/com/atden04/java_test/res/scene.fxml
deleted file mode 100644
index 5efadc3..0000000
--- a/src/com/atden04/java_test/res/scene.fxml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/com/atden04/java_test/res/style.css b/src/com/atden04/java_test/res/style.css
deleted file mode 100644
index ec1d16e..0000000
--- a/src/com/atden04/java_test/res/style.css
+++ /dev/null
@@ -1,3 +0,0 @@
-.label {
- -fx-text-fill: blue;
-}
\ No newline at end of file
diff --git a/src/com/atden04/java_test/user_interface/Controller.java b/src/com/atden04/java_test/user_interface/Controller.java
deleted file mode 100644
index 2355843..0000000
--- a/src/com/atden04/java_test/user_interface/Controller.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package com.atden04.java_test.user_interface;
-
-import javafx.fxml.FXML;
-import javafx.scene.control.Label;
-
-public class Controller {
-
- @FXML
- private Label label;
-
- public Controller() {
- System.out.println("Controller constructed");
- }
-
- @FXML
- public void initialize() {
- String javaVersion = System.getProperty("java.version");
- String javafxVersion = System.getProperty("javafx.version");
- System.out.println("Hello, JavaFX " + javafxVersion + "\nRunning on Java " + javaVersion+ ".");
- this.label.setText("Hello, JavaFX " + javafxVersion + "\nRunning on Java " + javaVersion+ ".");
- }
-}
diff --git a/src/module-info.java b/src/module-info.java
index c06742c..8f3a17d 100644
--- a/src/module-info.java
+++ b/src/module-info.java
@@ -1,10 +1,12 @@
-module Test.Java {
+module ShareDatabaseApp {
requires javafx.fxml;
requires javafx.controls;
requires javafx.graphics;
- opens com.atden04.java_test.user_interface to javafx.fxml;
- exports com.atden04.java_test.user_interface;
- exports com.atden04.java_test.res;
- opens com.atden04.java_test.res to javafx.fxml;
+ exports com.atden04.java.share_database_app.mvc;
+ exports com.atden04.java.share_database_app.res;
+ exports com.atden04.java.share_database_app.models;
+ opens com.atden04.java.share_database_app.mvc to javafx.fxml;
+ opens com.atden04.java.share_database_app.res to javafx.fxml;
+ exports com.atden04.java.share_database_app.enums;
}
\ No newline at end of file