mirror of
https://github.com/cryptomator/cryptomator.git
synced 2026-04-20 17:46:52 -04:00
if vault is added (new or existing), it is selected in the vault list
This commit is contained in:
@@ -2,6 +2,7 @@ package org.cryptomator.ui.mainwindow;
|
||||
|
||||
import javafx.beans.binding.Bindings;
|
||||
import javafx.beans.property.ObjectProperty;
|
||||
import javafx.collections.ListChangeListener;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.scene.control.ListView;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
@@ -41,6 +42,13 @@ public class VaultListController implements FxController {
|
||||
vaultList.setItems(vaults);
|
||||
vaultList.setCellFactory(cellFactory);
|
||||
selectedVault.bind(vaultList.getSelectionModel().selectedItemProperty());
|
||||
vaults.addListener((ListChangeListener.Change<? extends Vault> c) -> { // not threadsafe, but we can only add one vault at a time
|
||||
while (c.next()) {
|
||||
if (c.wasAdded()) {
|
||||
vaultList.getSelectionModel().selectLast();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void didClickAddVault() {
|
||||
|
||||
Reference in New Issue
Block a user