From 91566c9a1e80c47ef93f8158df59564d2cdfdfdc Mon Sep 17 00:00:00 2001
From: Andreas Weninger <e01526989@student.tuwien.ac.at>
Date: Tue, 5 Jun 2018 11:33:53 +0200
Subject: Status display is only show if parameter is true.

---
 .../controller/VehiclePaneController.java          | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

(limited to 'src/main/java/at')

diff --git a/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/controller/VehiclePaneController.java b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/controller/VehiclePaneController.java
index 35a4b4a..8a0bba3 100644
--- a/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/controller/VehiclePaneController.java
+++ b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/controller/VehiclePaneController.java
@@ -56,10 +56,10 @@ public class VehiclePaneController {
      * * 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 showStatusInfo If true, the highest qualification of the vehicle's active registration
+     *     and the vehicle's status will be shown.
      */
-    public void setData(Vehicle vehicle, boolean showQualification) {
+    public void setData(Vehicle vehicle, boolean showStatusInfo) {
         txtType.setText(vehicle.type().name());
         String constrType = vehicle.constructionType().name();
         txtRooftype.setText(
@@ -72,7 +72,7 @@ public class VehiclePaneController {
             ivNEF.setImage(new Image("images/NotNEF.png"));
             txtNEF.setText("keine NEF-Halterung");
         }
-        if (showQualification) {
+        if (showStatusInfo) {
 
             Instant now = Instant.now();
             List<Registration> regs = vehicle.registrations();
@@ -92,18 +92,20 @@ public class VehiclePaneController {
             }
 
             txtQualification.setText(edu.get().name());
+
+            txtStatus.setText(vehicle.status().name());
+            if (vehicle.status() == Status.FREI_FUNK || vehicle.status() == Status.FREI_WACHE) {
+                txtStatus.getStyleClass().add("bg-status-green");
+            } else {
+                txtStatus.getStyleClass().add("bg-status-orange");
+            }
         } else {
             txtQualification.setVisible(false);
             txtQualification.setManaged(false);
             ivQualification.setVisible(false);
             ivQualification.setManaged(false);
-        }
 
-        txtStatus.setText(vehicle.status().name());
-        if (vehicle.status() == Status.FREI_FUNK || vehicle.status() == Status.FREI_WACHE) {
-            txtStatus.getStyleClass().add("bg-status-green");
-        } else {
-            txtStatus.getStyleClass().add("bg-status-orange");
+            txtStatus.setVisible(false);
         }
 
         this.data = vehicle;
-- 
cgit v1.2.3-70-g09d2