diff options
Diffstat (limited to 'src')
3 files changed, 18 insertions, 3 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: {}", 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; } |