mirror of
https://github.com/cryptomator/cryptomator.git
synced 2024-11-23 12:09:45 +00:00
simplified bindings
This commit is contained in:
parent
7771181e15
commit
ce82593fc6
@ -21,7 +21,7 @@ public class VaultListCellController implements FxController {
|
|||||||
|
|
||||||
private final ObjectProperty<Vault> vault = new SimpleObjectProperty<>();
|
private final ObjectProperty<Vault> vault = new SimpleObjectProperty<>();
|
||||||
private final ObservableValue<FontAwesome5Icon> glyph;
|
private final ObservableValue<FontAwesome5Icon> glyph;
|
||||||
private final BooleanBinding compactMode;
|
private final ObservableValue<Boolean> compactMode;
|
||||||
|
|
||||||
private AutoAnimator spinAnimation;
|
private AutoAnimator spinAnimation;
|
||||||
|
|
||||||
@ -31,7 +31,7 @@ public class VaultListCellController implements FxController {
|
|||||||
@Inject
|
@Inject
|
||||||
VaultListCellController(Settings settings) {
|
VaultListCellController(Settings settings) {
|
||||||
this.glyph = vault.flatMap(Vault::stateProperty).map(this::getGlyphForVaultState);
|
this.glyph = vault.flatMap(Vault::stateProperty).map(this::getGlyphForVaultState);
|
||||||
this.compactMode = Bindings.createBooleanBinding(settings.compactMode::get, settings.compactMode);
|
this.compactMode = settings.compactMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void initialize() {
|
public void initialize() {
|
||||||
@ -73,11 +73,12 @@ public class VaultListCellController implements FxController {
|
|||||||
return vault.get();
|
return vault.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public BooleanBinding compactModeProperty() {
|
public ObservableValue<Boolean> compactModeProperty() {
|
||||||
return compactMode;
|
return compactMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getCompactMode() {
|
public boolean getCompactMode() {
|
||||||
return compactMode.get();
|
return compactMode.getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setVault(Vault value) {
|
public void setVault(Vault value) {
|
||||||
|
@ -71,7 +71,7 @@ public class VaultListController implements FxController {
|
|||||||
private final BooleanProperty draggingVaultOver = new SimpleBooleanProperty();
|
private final BooleanProperty draggingVaultOver = new SimpleBooleanProperty();
|
||||||
private final ResourceBundle resourceBundle;
|
private final ResourceBundle resourceBundle;
|
||||||
private final FxApplicationWindows appWindows;
|
private final FxApplicationWindows appWindows;
|
||||||
private final BooleanBinding compactMode;
|
private final Settings settings;
|
||||||
|
|
||||||
public ListView<Vault> vaultList;
|
public ListView<Vault> vaultList;
|
||||||
public StackPane root;
|
public StackPane root;
|
||||||
@ -102,9 +102,9 @@ public class VaultListController implements FxController {
|
|||||||
this.vaultListManager = vaultListManager;
|
this.vaultListManager = vaultListManager;
|
||||||
this.resourceBundle = resourceBundle;
|
this.resourceBundle = resourceBundle;
|
||||||
this.appWindows = appWindows;
|
this.appWindows = appWindows;
|
||||||
|
this.settings = settings;
|
||||||
|
|
||||||
this.emptyVaultList = Bindings.isEmpty(vaults);
|
this.emptyVaultList = Bindings.isEmpty(vaults);
|
||||||
this.compactMode = Bindings.createBooleanBinding(settings.compactMode::get, settings.compactMode);
|
|
||||||
|
|
||||||
selectedVault.addListener(this::selectedVaultDidChange);
|
selectedVault.addListener(this::selectedVaultDidChange);
|
||||||
}
|
}
|
||||||
@ -114,7 +114,7 @@ public class VaultListController implements FxController {
|
|||||||
vaultList.setCellFactory(cellFactory);
|
vaultList.setCellFactory(cellFactory);
|
||||||
|
|
||||||
vaultList.fixedCellSizeProperty().bind(Bindings.createDoubleBinding(() ->
|
vaultList.fixedCellSizeProperty().bind(Bindings.createDoubleBinding(() ->
|
||||||
compactMode.get() ? 30.0 : 60.0, compactMode));
|
settings.compactMode.get() ? 30.0 : 60.0, settings.compactMode));
|
||||||
|
|
||||||
selectedVault.bind(vaultList.getSelectionModel().selectedItemProperty());
|
selectedVault.bind(vaultList.getSelectionModel().selectedItemProperty());
|
||||||
vaults.addListener((ListChangeListener.Change<? extends Vault> c) -> {
|
vaults.addListener((ListChangeListener.Change<? extends Vault> c) -> {
|
||||||
|
Loading…
Reference in New Issue
Block a user