mirror of
https://github.com/cryptomator/cryptomator.git
synced 2026-05-17 02:01:27 +00:00
minor changes
* removing unused imports * exchanging addListener() by Easybind.subscribe()
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
package org.cryptomator.ui.addvaultwizard;
|
package org.cryptomator.ui.addvaultwizard;
|
||||||
|
|
||||||
|
import com.tobiasdiez.easybind.EasyBind;
|
||||||
import dagger.Lazy;
|
import dagger.Lazy;
|
||||||
import javafx.beans.binding.Bindings;
|
import javafx.beans.binding.Bindings;
|
||||||
import javafx.beans.binding.BooleanBinding;
|
import javafx.beans.binding.BooleanBinding;
|
||||||
@@ -83,11 +84,11 @@ public class CreateNewVaultLocationController implements FxController {
|
|||||||
public void initialize() {
|
public void initialize() {
|
||||||
predefinedLocationToggler.selectedToggleProperty().addListener(this::togglePredefinedLocation);
|
predefinedLocationToggler.selectedToggleProperty().addListener(this::togglePredefinedLocation);
|
||||||
usePresetPath.bind(predefinedLocationToggler.selectedToggleProperty().isNotEqualTo(customRadioButton));
|
usePresetPath.bind(predefinedLocationToggler.selectedToggleProperty().isNotEqualTo(customRadioButton));
|
||||||
vaultPath.addListener(this::vaultPathDidChange);
|
EasyBind.subscribe(vaultPath, this::vaultPathDidChange);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void vaultPathDidChange(@SuppressWarnings("unused") ObservableValue<? extends Path> observable, @SuppressWarnings("unused") Path oldValue, Path newValue) {
|
private void vaultPathDidChange(Path newValue) {
|
||||||
if (!Files.notExists(newValue)) {
|
if ( newValue != null && !Files.notExists(newValue)) {
|
||||||
warningText.set(resourceBundle.getString("addvaultwizard.new.fileAlreadyExists"));
|
warningText.set(resourceBundle.getString("addvaultwizard.new.fileAlreadyExists"));
|
||||||
} else {
|
} else {
|
||||||
warningText.set(null);
|
warningText.set(null);
|
||||||
|
|||||||
@@ -32,7 +32,6 @@ import javax.inject.Named;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.UncheckedIOException;
|
import java.io.UncheckedIOException;
|
||||||
import java.nio.channels.WritableByteChannel;
|
import java.nio.channels.WritableByteChannel;
|
||||||
import java.nio.file.FileAlreadyExistsException;
|
|
||||||
import java.nio.file.FileSystem;
|
import java.nio.file.FileSystem;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.NoSuchFileException;
|
import java.nio.file.NoSuchFileException;
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package org.cryptomator.ui.fxapp;
|
package org.cryptomator.ui.fxapp;
|
||||||
|
|
||||||
|
import com.tobiasdiez.easybind.EasyBind;
|
||||||
import dagger.Lazy;
|
import dagger.Lazy;
|
||||||
import javafx.application.Application;
|
import javafx.application.Application;
|
||||||
import javafx.application.Platform;
|
import javafx.application.Platform;
|
||||||
@@ -64,7 +65,7 @@ public class FxApplication extends Application {
|
|||||||
LOG.trace("FxApplication.start()");
|
LOG.trace("FxApplication.start()");
|
||||||
Platform.setImplicitExit(false);
|
Platform.setImplicitExit(false);
|
||||||
|
|
||||||
hasVisibleStages.addListener(this::hasVisibleStagesChanged);
|
EasyBind.subscribe(hasVisibleStages, this::hasVisibleStagesChanged);
|
||||||
|
|
||||||
settings.theme().addListener(this::themeChanged);
|
settings.theme().addListener(this::themeChanged);
|
||||||
loadSelectedStyleSheet(settings.theme().get());
|
loadSelectedStyleSheet(settings.theme().get());
|
||||||
@@ -75,7 +76,7 @@ public class FxApplication extends Application {
|
|||||||
throw new UnsupportedOperationException("Use start() instead.");
|
throw new UnsupportedOperationException("Use start() instead.");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void hasVisibleStagesChanged(@SuppressWarnings("unused") ObservableValue<? extends Boolean> observableValue, @SuppressWarnings("unused") boolean oldValue, boolean newValue) {
|
private void hasVisibleStagesChanged(boolean newValue) {
|
||||||
if (newValue) {
|
if (newValue) {
|
||||||
macFunctions.map(MacFunctions::uiState).ifPresent(MacApplicationUiState::transformToForegroundApplication);
|
macFunctions.map(MacFunctions::uiState).ifPresent(MacApplicationUiState::transformToForegroundApplication);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -1,16 +1,15 @@
|
|||||||
package org.cryptomator.ui.mainwindow;
|
package org.cryptomator.ui.mainwindow;
|
||||||
|
|
||||||
|
import com.tobiasdiez.easybind.EasyBind;
|
||||||
import javafx.beans.binding.Bindings;
|
import javafx.beans.binding.Bindings;
|
||||||
import javafx.beans.binding.BooleanBinding;
|
import javafx.beans.binding.BooleanBinding;
|
||||||
import javafx.beans.property.ObjectProperty;
|
import javafx.beans.property.ObjectProperty;
|
||||||
import javafx.beans.value.ObservableValue;
|
|
||||||
import javafx.collections.ListChangeListener;
|
import javafx.collections.ListChangeListener;
|
||||||
import javafx.collections.ObservableList;
|
import javafx.collections.ObservableList;
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
import javafx.scene.control.ListView;
|
import javafx.scene.control.ListView;
|
||||||
import org.cryptomator.common.vaults.Vault;
|
import org.cryptomator.common.vaults.Vault;
|
||||||
import org.cryptomator.common.vaults.VaultListManager;
|
import org.cryptomator.common.vaults.VaultListManager;
|
||||||
import org.cryptomator.common.vaults.VaultState;
|
|
||||||
import org.cryptomator.ui.addvaultwizard.AddVaultWizardComponent;
|
import org.cryptomator.ui.addvaultwizard.AddVaultWizardComponent;
|
||||||
import org.cryptomator.ui.common.FxController;
|
import org.cryptomator.ui.common.FxController;
|
||||||
import org.cryptomator.ui.removevault.RemoveVaultComponent;
|
import org.cryptomator.ui.removevault.RemoveVaultComponent;
|
||||||
@@ -18,7 +17,6 @@ import org.slf4j.Logger;
|
|||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
@MainWindowScoped
|
@MainWindowScoped
|
||||||
public class VaultListController implements FxController {
|
public class VaultListController implements FxController {
|
||||||
@@ -43,7 +41,7 @@ public class VaultListController implements FxController {
|
|||||||
this.removeVault = removeVault;
|
this.removeVault = removeVault;
|
||||||
this.noVaultSelected = selectedVault.isNull();
|
this.noVaultSelected = selectedVault.isNull();
|
||||||
this.emptyVaultList = Bindings.isEmpty(vaults);
|
this.emptyVaultList = Bindings.isEmpty(vaults);
|
||||||
selectedVault.addListener(this::selectedVaultDidChange);
|
EasyBind.subscribe(selectedVault, this::selectedVaultDidChange);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void initialize() {
|
public void initialize() {
|
||||||
@@ -60,11 +58,10 @@ public class VaultListController implements FxController {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void selectedVaultDidChange(@SuppressWarnings("unused") ObservableValue<? extends Vault> observableValue, @SuppressWarnings("unused") Vault oldValue, Vault newValue) {
|
private void selectedVaultDidChange(Vault newValue) {
|
||||||
if (newValue == null) {
|
if (newValue != null) {
|
||||||
return;
|
VaultListManager.redetermineVaultState(newValue);
|
||||||
}
|
}
|
||||||
VaultListManager.redetermineVaultState(newValue);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
|
|||||||
Reference in New Issue
Block a user