]> Git Server - tankstelle.git/commitdiff
I actually forgot to add the special attribute to the overview, so I added it
authorRobin Cheney <cheneyr@eternal.ddnss.de>
Wed, 10 Dec 2025 08:02:19 +0000 (09:02 +0100)
committerRobin Cheney <cheneyr@eternal.ddnss.de>
Wed, 10 Dec 2025 08:02:19 +0000 (09:02 +0100)
src/main/java/de/diejungsvondertanke/tankstelle/controllers/OverviewTabController.java
src/main/java/de/diejungsvondertanke/tankstelle/core/FuelStation.java
src/main/java/de/diejungsvondertanke/tankstelle/core/LargeFuelStation.java
src/main/java/de/diejungsvondertanke/tankstelle/core/Main.java
src/main/java/de/diejungsvondertanke/tankstelle/core/MediumFuelStation.java
src/main/java/de/diejungsvondertanke/tankstelle/core/SmallFuelStation.java
src/main/java/de/diejungsvondertanke/tankstelle/ui/FuelRow.java
src/main/resources/ui/OverviewTab.fxml

index 0d47488bd5292e7f0c2d1fc40234ed678925843b..af7419f5af31f132682d7ff57dfd0be46246d9b0 100644 (file)
@@ -36,6 +36,8 @@ public class OverviewTabController {
     private TableColumn<FuelRow, Integer> colCapacity;
     @FXML
     private TableColumn<FuelRow, Float> colPrice;
+    @FXML
+    private TableColumn<FuelRow, String> colSpecial;
 
     private FuelStationUIController parentController;
 
@@ -67,6 +69,7 @@ public class OverviewTabController {
         colAmount.setCellValueFactory(data -> new SimpleDoubleProperty(data.getValue().amount()).asObject());
         colCapacity.setCellValueFactory(data -> new SimpleIntegerProperty(data.getValue().capacity()).asObject());
         colPrice.setCellValueFactory(data -> new SimpleFloatProperty(data.getValue().price()).asObject());
+        colSpecial.setCellValueFactory(data -> new SimpleStringProperty(data.getValue().special()));
     }
 
     /**
@@ -85,7 +88,8 @@ public class OverviewTabController {
                                 f.FUEL_TYPE.toString(),
                                 f.getStored_amount(),
                                 f.CAPACITY,
-                                f.getPrice()));
+                                f.getPrice(),
+                                station.getSpecialAsString()));
             }
         }
     }
index 6bdccf5912e9d56ffb90e59949253718ea841635..b05316c4b2bfd3bc104108c4734c69e3b1e82c9e 100644 (file)
@@ -280,4 +280,12 @@ public abstract class FuelStation {
      * @return a simplified name for the a {@link FuelStation fuel station}
      */
     public abstract String getSimpleName();
+
+    /**
+     * For display reasons, the special attribute must be returned by this function
+     * as a {@link String}
+     * 
+     * @return the special attribute as a {@link String}
+     */
+    public abstract String getSpecialAsString();
 }
\ No newline at end of file
index 76199c63c5eb5c8eb353215e3ba4e9a771826e31..60cc5c8f04bf05f8191b0df99eecad6922dfca60 100644 (file)
@@ -52,4 +52,11 @@ public class LargeFuelStation extends FuelStation {
     public String getSimpleName() {
         return "large fuel station";
     }
+
+    /**
+     * See {@link FuelStation#getSpecialAsString()}
+     */
+    public String getSpecialAsString() {
+        return supermarket_company;
+    }
 }
index c02ad3f9cdaa5e6f828cba0b0df751f29d0da2e5..b3a8b8526744a9f3e28214f09e03a8b8629a3c56 100644 (file)
@@ -24,8 +24,8 @@ public class Main {
      */
     static FuelStation[] initialFuelStations = { new SmallFuelStation((short) 0), new SmallFuelStation((short) 0),
             new MediumFuelStation(0), new MediumFuelStation(0), new MediumFuelStation(0),
-            new LargeFuelStation("PlatzhalterFirma1"), new LargeFuelStation("PlatzhalterFirma2"),
-            new LargeFuelStation("PlatzhalterFirma3") };
+            new LargeFuelStation("PlaceholderCompany1"), new LargeFuelStation("PlaceholderCompany2"),
+            new LargeFuelStation("PlaceholderCompany3") };
 
     /**
      * create an array list to store the fuel stations while the program is running
index c4fe99f3b7ffcee14f68ce935a1cb1e608e3f0f8..e6d0fb500cac1b7f886e7bb2d6b8834371b37ed2 100644 (file)
@@ -52,4 +52,11 @@ public class MediumFuelStation extends FuelStation {
     public String getSimpleName() {
         return "medium fuel station";
     }
+
+    /**
+     * See {@link FuelStation#getSpecialAsString()}
+     */
+    public String getSpecialAsString() {
+        return Float.toString(retail_space);
+    }
 }
index d48a71c5496d1f122099cbc207174cb9cddbf544..fe824a6554d3db0b4a587b2523e9df48e99d63ae 100644 (file)
@@ -50,4 +50,11 @@ public class SmallFuelStation extends FuelStation {
     public String getSimpleName() {
         return "small fuel station";
     }
+
+    /**
+     * See {@link FuelStation#getSpecialAsString()}
+     */
+    public String getSpecialAsString() {
+        return Short.toString(number_of_vending_machines);
+    }
 }
index 3187477694f5c16dae4116e468987681745404a3..b805428971696a8293b9fc5e84ea7c0bc96ccf5a 100644 (file)
@@ -11,5 +11,6 @@ package de.diejungsvondertanke.tankstelle.ui;
  * 
  * @author Robin Cheney
  */
-public record FuelRow(String station, String type, String fuel, double amount, int capacity, float price) {
+public record FuelRow(String station, String type, String fuel, double amount, int capacity, float price,
+        String special) {
 }
\ No newline at end of file
index 174f1cee6028634db1814806ae54ce04fd134b00..340cd8e27d732992198f0d692a2149bdce52ac73 100644 (file)
@@ -29,6 +29,7 @@
                     <TableColumn fx:id="colAmount" text="Amount (L)" />
                     <TableColumn fx:id="colCapacity" text="Capacity (L)" />
                     <TableColumn fx:id="colPrice" text="Price (€/L)" />
+                    <TableColumn fx:id="colSpecial" text="Special Attribute" />
                 </columns>
             </TableView>
         </VBox>