From: Robin Cheney Date: Wed, 10 Dec 2025 08:02:19 +0000 (+0100) Subject: I actually forgot to add the special attribute to the overview, so I added it X-Git-Url: https://git.eternal.ddnss.de/?a=commitdiff_plain;h=c076ce717b11c7b72ab74089b96cbb96e47b3311;p=tankstelle.git I actually forgot to add the special attribute to the overview, so I added it --- diff --git a/src/main/java/de/diejungsvondertanke/tankstelle/controllers/OverviewTabController.java b/src/main/java/de/diejungsvondertanke/tankstelle/controllers/OverviewTabController.java index 0d47488..af7419f 100644 --- a/src/main/java/de/diejungsvondertanke/tankstelle/controllers/OverviewTabController.java +++ b/src/main/java/de/diejungsvondertanke/tankstelle/controllers/OverviewTabController.java @@ -36,6 +36,8 @@ public class OverviewTabController { private TableColumn colCapacity; @FXML private TableColumn colPrice; + @FXML + private TableColumn 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())); } } } diff --git a/src/main/java/de/diejungsvondertanke/tankstelle/core/FuelStation.java b/src/main/java/de/diejungsvondertanke/tankstelle/core/FuelStation.java index 6bdccf5..b05316c 100644 --- a/src/main/java/de/diejungsvondertanke/tankstelle/core/FuelStation.java +++ b/src/main/java/de/diejungsvondertanke/tankstelle/core/FuelStation.java @@ -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 diff --git a/src/main/java/de/diejungsvondertanke/tankstelle/core/LargeFuelStation.java b/src/main/java/de/diejungsvondertanke/tankstelle/core/LargeFuelStation.java index 76199c6..60cc5c8 100644 --- a/src/main/java/de/diejungsvondertanke/tankstelle/core/LargeFuelStation.java +++ b/src/main/java/de/diejungsvondertanke/tankstelle/core/LargeFuelStation.java @@ -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; + } } diff --git a/src/main/java/de/diejungsvondertanke/tankstelle/core/Main.java b/src/main/java/de/diejungsvondertanke/tankstelle/core/Main.java index c02ad3f..b3a8b85 100644 --- a/src/main/java/de/diejungsvondertanke/tankstelle/core/Main.java +++ b/src/main/java/de/diejungsvondertanke/tankstelle/core/Main.java @@ -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 diff --git a/src/main/java/de/diejungsvondertanke/tankstelle/core/MediumFuelStation.java b/src/main/java/de/diejungsvondertanke/tankstelle/core/MediumFuelStation.java index c4fe99f..e6d0fb5 100644 --- a/src/main/java/de/diejungsvondertanke/tankstelle/core/MediumFuelStation.java +++ b/src/main/java/de/diejungsvondertanke/tankstelle/core/MediumFuelStation.java @@ -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); + } } diff --git a/src/main/java/de/diejungsvondertanke/tankstelle/core/SmallFuelStation.java b/src/main/java/de/diejungsvondertanke/tankstelle/core/SmallFuelStation.java index d48a71c..fe824a6 100644 --- a/src/main/java/de/diejungsvondertanke/tankstelle/core/SmallFuelStation.java +++ b/src/main/java/de/diejungsvondertanke/tankstelle/core/SmallFuelStation.java @@ -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); + } } diff --git a/src/main/java/de/diejungsvondertanke/tankstelle/ui/FuelRow.java b/src/main/java/de/diejungsvondertanke/tankstelle/ui/FuelRow.java index 3187477..b805428 100644 --- a/src/main/java/de/diejungsvondertanke/tankstelle/ui/FuelRow.java +++ b/src/main/java/de/diejungsvondertanke/tankstelle/ui/FuelRow.java @@ -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 diff --git a/src/main/resources/ui/OverviewTab.fxml b/src/main/resources/ui/OverviewTab.fxml index 174f1ce..340cd8e 100644 --- a/src/main/resources/ui/OverviewTab.fxml +++ b/src/main/resources/ui/OverviewTab.fxml @@ -29,6 +29,7 @@ +