diff options
author | Andreas Weninger <e01526989@student.tuwien.ac.at> | 2018-05-05 16:55:31 +0200 |
---|---|---|
committer | Tharre <tharre3@gmail.com> | 2018-05-08 12:35:33 +0200 |
commit | f0a06739827a2efbf81e20449d92c8312e8832c9 (patch) | |
tree | 3cef0dab7c1736680bf3ae9cdd8772530b094781 /src/main/java | |
parent | 4e9bbe5134b2efd9e3eab277a92366fe0ba38d4e (diff) | |
download | sepm-groupproject-f0a06739827a2efbf81e20449d92c8312e8832c9.tar.gz sepm-groupproject-f0a06739827a2efbf81e20449d92c8312e8832c9.tar.xz sepm-groupproject-f0a06739827a2efbf81e20449d92c8312e8832c9.zip |
VehiclePane Controller
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/ui/vehiclePane/VehiclePaneController.java | 55 |
1 files changed, 40 insertions, 15 deletions
diff --git a/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/ui/vehiclePane/VehiclePaneController.java b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/ui/vehiclePane/VehiclePaneController.java index 903028e..2b0df13 100644 --- a/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/ui/vehiclePane/VehiclePaneController.java +++ b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/ui/vehiclePane/VehiclePaneController.java @@ -2,23 +2,25 @@ package at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.ui.vehiclePane import at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.dto.Vehicle; import java.io.IOException; +import javafx.fxml.FXML; import javafx.fxml.FXMLLoader; import javafx.scene.Node; +import javafx.scene.image.Image; import javafx.scene.image.ImageView; import javafx.scene.text.Text; public class VehiclePaneController { - - private Text txtType; - private Text txtNumber; - private ImageView ivNEF; - private Text txtNEF; - private ImageView ivQualification; - private Text txtQualification; - private Text txtRooftype; + @FXML private Text txtType; + @FXML private Text txtNumber; + @FXML private ImageView ivNEF; + @FXML private Text txtNEF; + @FXML private ImageView ivQualification; + @FXML private Text txtQualification; + @FXML private Text txtRooftype; public static VehiclePaneController createVehiclePane() throws IOException { - FXMLLoader fxmlLoader = new FXMLLoader(VehiclePaneController.class.getResource("/fxml/vehiclePane.fxml")); + FXMLLoader fxmlLoader = + new FXMLLoader(VehiclePaneController.class.getResource("/fxml/vehiclePane.fxml")); Node root = fxmlLoader.load(); VehiclePaneController result = fxmlLoader.getController(); result.rootElement = root; @@ -32,13 +34,36 @@ public class VehiclePaneController { return rootElement; } - /*** - * Set the displayed data of this VehiclePane. + /** + * * Set the displayed data of this VehiclePane. + * * @param vehicle The data to display. - * @param showQualification If true, the most recent registration of vehicle will be searched for the highest qualification. + * @param showQualification If true, the most recent registration of vehicle will be searched + * for the highest qualification. */ - public void setData(Vehicle vehicle, boolean showQualification) - { - + public void setData(Vehicle vehicle, boolean showQualification) { + txtType.setText(vehicle.type().name()); + String constrType = vehicle.constructionType().name(); + txtRooftype.setText( + constrType.substring(0, 1).toUpperCase() + constrType.substring(1).toLowerCase()); + txtNumber.setText("" + vehicle.id()); + if (vehicle.hasNef()) { + ivNEF.setImage(new Image("../images/NEF.png")); + txtNEF.setText("hat NEF-Halterung"); + } else { + ivNEF.setImage(new Image("../images/NotNEF.png")); + txtNEF.setText("keine NEF-Halterung"); + } + if (showQualification) + { + //TODO + } + else + { + txtQualification.setVisible(false); + txtQualification.setManaged(false); + ivQualification.setVisible(false); + ivQualification.setManaged(false); + } } } |