aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/controller/RegistrationWindowController.java11
1 files changed, 11 insertions, 0 deletions
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: {}",