Browse Source

fixed empty vaultList contextMenu

Jan-Peter Klein 1 month ago
parent
commit
118a1411d8

+ 4 - 0
src/main/java/org/cryptomator/ui/mainwindow/VaultListController.java

@@ -112,6 +112,10 @@ public class VaultListController implements FxController {
 		vaultList.setItems(vaults);
 		vaultList.setCellFactory(cellFactory);
 
+		vaultList.prefHeightProperty().bind(
+				vaultList.fixedCellSizeProperty().multiply(Bindings.size(vaultList.getItems()))
+		);
+
 		selectedVault.bind(vaultList.getSelectionModel().selectedItemProperty());
 		vaults.addListener((ListChangeListener.Change<? extends Vault> c) -> {
 			while (c.next()) {

+ 8 - 5
src/main/resources/fxml/vault_list.fxml

@@ -18,11 +18,14 @@
 		   minWidth="206">
 	<VBox>
 		<StackPane VBox.vgrow="ALWAYS">
-			<ListView fx:id="vaultList" editable="true" fixedCellSize="${controller.cellSize}">
-				<contextMenu>
-					<fx:include source="vault_list_contextmenu.fxml"/>
-				</contextMenu>
-			</ListView>
+			<VBox>
+				<ListView fx:id="vaultList" editable="true" fixedCellSize="${controller.cellSize}">
+					<contextMenu>
+						<fx:include source="vault_list_contextmenu.fxml"/>
+					</contextMenu>
+				</ListView>
+				<Region VBox.vgrow="ALWAYS" styleClass="list-view"/>
+			</VBox>
 			<VBox visible="${controller.emptyVaultList}" spacing="6" alignment="CENTER">
 				<Region VBox.vgrow="ALWAYS"/>
 				<Label VBox.vgrow="NEVER" text="%main.vaultlist.emptyList.onboardingInstruction" textAlignment="CENTER" wrapText="true"/>