]> Git Server - tankstelle.git/commitdiff
Feature: When selecting a Station type/size in NewFuelStationTab it will change the...
authorRobin Cheney <cheneyr@eternal.ddnss.de>
Fri, 21 Nov 2025 12:44:47 +0000 (13:44 +0100)
committerRobin Cheney <cheneyr@eternal.ddnss.de>
Fri, 21 Nov 2025 12:44:47 +0000 (13:44 +0100)
pom.xml
src/main/java/de/diejungsvondertanke/tankstelle/Main.java
src/main/java/de/diejungsvondertanke/tankstelle/controllers/NewStationTabController.java
src/main/java/de/diejungsvondertanke/tankstelle/controllers/ResultTabController.java
src/main/java/module-info.java
src/main/resources/ui/NewStationTab.fxml

diff --git a/pom.xml b/pom.xml
index f1179cb1645842006f0ca95fe686c377448cd156..c6fd48592d0025e78de6a84f3666deffd0d4eb93 100644 (file)
--- a/pom.xml
+++ b/pom.xml
                 <configuration>
                     <archive>
                         <manifest>
-                            <mainClass>${mainClass}</mainClass>
-                            <!-- <mainClass>de.diejungsvondertanke.tankstelle.Main</mainClass> -->
+                            <mainClass>${main.Class}</mainClass>
                         </manifest>
                     </archive>
-                    <outputDirectory>${project.build.directory}/modules</outputDirectory>
                 </configuration>
             </plugin>
 
@@ -91,7 +89,7 @@
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
         <maven.compiler.source>25</maven.compiler.source>
         <maven.compiler.target>25</maven.compiler.target>
-        <java.version>20</java.version>
+        <java.version>25</java.version>
         <javafx.version>23.0.2</javafx.version>
         <main.Class>de.diejungsvondertanke.tankstelle.ui.JFX</main.Class>
     </properties>
index ed8c8bcdb104cd8cb5edca3cffa92b8bd6c46e75..ff433b272908aa15fadd7ca307266e85113b96aa 100644 (file)
@@ -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
index d709f9afbc47c51df734cff3fded0ba883cf175b..b9453044c09f89bb5e9c5f37284d5b7f5829e699 100644 (file)
@@ -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 {
index 194fe68d4bee0050e9921c350aa1e69d624183f6..58166ccdec9428e1ec6e86e917963d42db0401b1 100644 (file)
@@ -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()));
         }
     }
 
index e850031857b94a1300cfa7eebd9d75b792a13de6..a5e6182f8541d7728526e08e3a1421cd6acab588 100644 (file)
@@ -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;
 }
index b89ca723252b029d3cf8c0207c2ccb0bab862cb8..911d8b6c9fa177291c416c956f5a0d3d730ede4d 100644 (file)
               <Insets top="15" right="15" bottom="15" left="15" />
        </padding>
 
-       <Label text="Type:" GridPane.rowIndex="0" GridPane.columnIndex="0" />
+       <Label text="Size:" GridPane.rowIndex="0" GridPane.columnIndex="0" />
 
        <fx:define>
               <ToggleGroup fx:id="group" />
        </fx:define>
        <RadioButton fx:id="rbSmall" text="Small" selected="true"
               toggleGroup="$group"
-              GridPane.rowIndex="1" GridPane.columnIndex="0" />
+              GridPane.rowIndex="1" GridPane.columnIndex="0"
+              onAction="#setAttributeTypeFromSmallStation" />
        <RadioButton fx:id="rbMedium" text="Medium"
               toggleGroup="$group"
-              GridPane.rowIndex="1" GridPane.columnIndex="1" />
+              GridPane.rowIndex="1" GridPane.columnIndex="1"
+              onAction="#setAttributeTypeFromMediumStation" />
        <RadioButton fx:id="rbLarge" text="Large"
               toggleGroup="$group"
-              GridPane.rowIndex="1" GridPane.columnIndex="2" />
+              GridPane.rowIndex="1" GridPane.columnIndex="2"
+              onAction="#setAttributeTypeFromLargeStation" />
 
-       <Label text="Attribute:" GridPane.rowIndex="2" GridPane.columnIndex="0" />
+       <Label fx:id="attrLabel" text="Attribute:" GridPane.rowIndex="2" GridPane.columnIndex="0" />
        <TextField fx:id="txtAttr" GridPane.rowIndex="2" GridPane.columnIndex="1"
               GridPane.columnSpan="2" />