From a461b9e807686fb34cdc98a2bbed6ab3923df823 Mon Sep 17 00:00:00 2001
From: Andreas Weninger <e01526989@student.tuwien.ac.at>
Date: Mon, 11 Jun 2018 20:52:34 +0200
Subject: [#27381] UI Changes

---
 .../controller/RegistrationWindowController.java              | 11 +++++++++++
 src/main/resources/fxml/RegistrationWindow.fxml               |  6 +++---
 src/main/resources/styles/main.css                            |  4 ++++
 3 files changed, 18 insertions(+), 3 deletions(-)

(limited to 'src/main')

diff --git a/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/controller/RegistrationWindowController.java b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/controller/RegistrationWindowController.java
index b8abf91..1a4a4e9 100644
--- a/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/controller/RegistrationWindowController.java
+++ b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/controller/RegistrationWindowController.java
@@ -163,10 +163,14 @@ public class RegistrationWindowController {
         try {
             Set<Vehicle> vehicles = vehicleService.list(EnumSet.of(Status.ABGEMELDET));
 
+            boolean anyMatch = false;
+
             for (Vehicle vehicle : vehicles) {
                 if (!vehicle.name().toLowerCase().contains(tfVehicleSearch.getText().toLowerCase()))
                     continue;
 
+                anyMatch = true;
+
                 VehiclePaneController vp = VehiclePaneController.createVehiclePane();
                 vp.setData(vehicle, false);
                 vbVehicles.getChildren().add(vp.getRootElement());
@@ -183,6 +187,13 @@ public class RegistrationWindowController {
                 if (chosenVehicle != null && chosenVehicle.id() == vehicle.id())
                     vp.setSelected(true);
             }
+
+            if (!anyMatch) {
+                // Kind of ugly, but best way to get the size of a VehiclePane
+                VehiclePaneController vp = VehiclePaneController.createVehiclePane();
+                vp.getRootElement().setVisible(false);
+                vbVehicles.getChildren().add(vp.getRootElement());
+            }
         } catch (ServiceException e) {
             LOG.warn(
                     "Caught ServiceException while getting vehicles. Showing it to user. Error message: {}",
diff --git a/src/main/resources/fxml/RegistrationWindow.fxml b/src/main/resources/fxml/RegistrationWindow.fxml
index 7f3d391..1524462 100644
--- a/src/main/resources/fxml/RegistrationWindow.fxml
+++ b/src/main/resources/fxml/RegistrationWindow.fxml
@@ -68,7 +68,7 @@
 
   <ScrollPane GridPane.rowIndex="5">
     <GridPane.margin>
-      <Insets left="-6" right="-6"/>
+      <Insets left="-6" right="-6" bottom="-12"/>
     </GridPane.margin>
     <VBox fx:id="vbVehicles" spacing="6">
       <padding>
@@ -78,7 +78,7 @@
   </ScrollPane>
   <ScrollPane fx:id="listEmployee" hbarPolicy="NEVER" GridPane.rowIndex="5" GridPane.columnIndex="2">
     <GridPane.margin>
-      <Insets left="-7" right="-20"/>
+      <Insets left="-7" right="-20" bottom="-12"/>
     </GridPane.margin>
   </ScrollPane>
   <VBox GridPane.rowIndex="4" spacing="6" styleClass="bg-white, shadowed">
@@ -86,7 +86,7 @@
       <Insets topRightBottomLeft="6"/>
     </padding>
     <Label text="Fahrzeugsuche" styleClass="text-medium"/>
-    <TextField fx:id="tfVehicleSearch" onKeyTyped="#tfVehicleSearch_TextChanged" styleClass="text-big, text-bold"/>
+    <TextField fx:id="tfVehicleSearch" prefWidth="0" onKeyTyped="#tfVehicleSearch_TextChanged" styleClass="text-big, text-bold"/>
   </VBox>
   <VBox GridPane.rowIndex="4" spacing="6" GridPane.columnIndex="2" styleClass="bg-white, shadowed">
     <padding>
diff --git a/src/main/resources/styles/main.css b/src/main/resources/styles/main.css
index b567666..db8076a 100644
--- a/src/main/resources/styles/main.css
+++ b/src/main/resources/styles/main.css
@@ -122,6 +122,10 @@
   -fx-background-color:transparent;
 }
 
+.scroll-pane .viewport {
+    -fx-background-color: transparent;
+}
+
 .scroll-pane .scroll-bar:vertical {
     -fx-opacity: 0;
 }
-- 
cgit v1.2.3-70-g09d2