From: Robin Cheney Date: Fri, 21 Nov 2025 12:44:47 +0000 (+0100) Subject: Feature: When selecting a Station type/size in NewFuelStationTab it will change the... X-Git-Url: https://git.eternal.ddnss.de/?a=commitdiff_plain;h=58b26c51b76664dfe18f67d48c29fcf1bcc31403;p=tankstelle.git Feature: When selecting a Station type/size in NewFuelStationTab it will change the attribute display to match the desired attribute type --- diff --git a/pom.xml b/pom.xml index f1179cb..c6fd485 100644 --- a/pom.xml +++ b/pom.xml @@ -16,11 +16,9 @@ - ${mainClass} - + ${main.Class} - ${project.build.directory}/modules @@ -91,7 +89,7 @@ UTF-8 25 25 - 20 + 25 23.0.2 de.diejungsvondertanke.tankstelle.ui.JFX diff --git a/src/main/java/de/diejungsvondertanke/tankstelle/Main.java b/src/main/java/de/diejungsvondertanke/tankstelle/Main.java index ed8c8bc..ff433b2 100644 --- a/src/main/java/de/diejungsvondertanke/tankstelle/Main.java +++ b/src/main/java/de/diejungsvondertanke/tankstelle/Main.java @@ -344,4 +344,12 @@ public class Main { return sum; } + + public static double get_cumulative_retail_price() { + double sum = 0; + for (FuelStation station : fuelStations) { + sum += station.get_cumulative_retail_price(); + } + return sum; + } } \ No newline at end of file diff --git a/src/main/java/de/diejungsvondertanke/tankstelle/controllers/NewStationTabController.java b/src/main/java/de/diejungsvondertanke/tankstelle/controllers/NewStationTabController.java index d709f9a..b945304 100644 --- a/src/main/java/de/diejungsvondertanke/tankstelle/controllers/NewStationTabController.java +++ b/src/main/java/de/diejungsvondertanke/tankstelle/controllers/NewStationTabController.java @@ -2,6 +2,7 @@ package de.diejungsvondertanke.tankstelle.controllers; import de.diejungsvondertanke.tankstelle.Main; import javafx.fxml.FXML; +import javafx.scene.control.Label; import javafx.scene.control.RadioButton; import javafx.scene.control.TextField; @@ -12,6 +13,9 @@ public class NewStationTabController { @FXML private TextField txtAttr; + @FXML + private Label attrLabel; + private FuelStationUIController parentController; // Called by parent after full initialization @@ -19,6 +23,21 @@ public class NewStationTabController { this.parentController = parent; } + @FXML + private void setAttributeTypeFromSmallStation() { + attrLabel.setText("Number of drink vending machines:"); + } + + @FXML + private void setAttributeTypeFromMediumStation() { + attrLabel.setText("m² of retail space:"); + } + + @FXML + private void setAttributeTypeFromLargeStation() { + attrLabel.setText("Company running the integrated supermarket:"); + } + @FXML private void add() { try { diff --git a/src/main/java/de/diejungsvondertanke/tankstelle/controllers/ResultTabController.java b/src/main/java/de/diejungsvondertanke/tankstelle/controllers/ResultTabController.java index 194fe68..58166cc 100644 --- a/src/main/java/de/diejungsvondertanke/tankstelle/controllers/ResultTabController.java +++ b/src/main/java/de/diejungsvondertanke/tankstelle/controllers/ResultTabController.java @@ -33,7 +33,8 @@ public class ResultTabController { @FXML private void handleTotalPrice() { if (parentController != null) { - parentController.appendOutput("Total price calculation here..."); + parentController.appendOutput("Total revenue if all fuel was sold at the set prices: %s€" + .formatted(Main.get_cumulative_retail_price())); } } diff --git a/src/main/java/module-info.java b/src/main/java/module-info.java index e850031..a5e6182 100644 --- a/src/main/java/module-info.java +++ b/src/main/java/module-info.java @@ -5,6 +5,8 @@ module tankstelle { requires javafx.base; opens de.diejungsvondertanke.tankstelle.ui to javafx.fxml, javafx.graphics; - opens de.diejungsvondertanke.tankstelle.controllers to javafx.fxml, javafx.graphics; - // exports de.diejungsvondertanke.tankstelle; + opens de.diejungsvondertanke.tankstelle.controllers to javafx.fxml, + javafx.graphics; + + exports de.diejungsvondertanke.tankstelle; } diff --git a/src/main/resources/ui/NewStationTab.fxml b/src/main/resources/ui/NewStationTab.fxml index b89ca72..911d8b6 100644 --- a/src/main/resources/ui/NewStationTab.fxml +++ b/src/main/resources/ui/NewStationTab.fxml @@ -10,22 +10,25 @@ -