<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>
<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>
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
import de.diejungsvondertanke.tankstelle.Main;
import javafx.fxml.FXML;
+import javafx.scene.control.Label;
import javafx.scene.control.RadioButton;
import javafx.scene.control.TextField;
@FXML
private TextField txtAttr;
+ @FXML
+ private Label attrLabel;
+
private FuelStationUIController parentController;
// Called by parent after full initialization
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 {
@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()));
}
}
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;
}
<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" />