diff --git a/main/ui/src/main/java/org/cryptomator/ui/fxapp/FxApplication.java b/main/ui/src/main/java/org/cryptomator/ui/fxapp/FxApplication.java index 18c9a499c..005d35154 100644 --- a/main/ui/src/main/java/org/cryptomator/ui/fxapp/FxApplication.java +++ b/main/ui/src/main/java/org/cryptomator/ui/fxapp/FxApplication.java @@ -113,7 +113,7 @@ public class FxApplication extends Application { public void startLockWorkflow(Vault vault, Optional owner) { Platform.runLater(() -> { lockWindowBuilderProvider.get().vault(vault).owner(owner).build().startLockWorkflow(); - LOG.debug("Locking vault {}", vault.getDisplayName()); + LOG.debug("Start lock workflow for {}", vault.getDisplayName()); }); } diff --git a/main/ui/src/main/java/org/cryptomator/ui/lock/LockComponent.java b/main/ui/src/main/java/org/cryptomator/ui/lock/LockComponent.java index 972ebc5f9..9796c88c7 100644 --- a/main/ui/src/main/java/org/cryptomator/ui/lock/LockComponent.java +++ b/main/ui/src/main/java/org/cryptomator/ui/lock/LockComponent.java @@ -19,7 +19,7 @@ public interface LockComponent { LockWorkflow lockWorkflow(); - default Future startLockWorkflow() { + default Future startLockWorkflow() { LockWorkflow workflow = lockWorkflow(); defaultExecutorService().submit(workflow); return workflow; diff --git a/main/ui/src/main/java/org/cryptomator/ui/lock/LockForcedController.java b/main/ui/src/main/java/org/cryptomator/ui/lock/LockForcedController.java index a66af9902..7e5075a35 100644 --- a/main/ui/src/main/java/org/cryptomator/ui/lock/LockForcedController.java +++ b/main/ui/src/main/java/org/cryptomator/ui/lock/LockForcedController.java @@ -45,4 +45,10 @@ public class LockForcedController implements FxController { } } + // ----- Getter & Setter ----- + + public String getVaultName() { + return vault.getDisplayName(); + } + } diff --git a/main/ui/src/main/java/org/cryptomator/ui/lock/LockWorkflow.java b/main/ui/src/main/java/org/cryptomator/ui/lock/LockWorkflow.java index d63661e02..01084839b 100644 --- a/main/ui/src/main/java/org/cryptomator/ui/lock/LockWorkflow.java +++ b/main/ui/src/main/java/org/cryptomator/ui/lock/LockWorkflow.java @@ -17,7 +17,15 @@ import javafx.scene.Scene; import javafx.stage.Stage; import javafx.stage.Window; -public class LockWorkflow extends Task { +/** + * The sequence of actions performed and checked during lock of a vault. + *

+ * This class implements the Task interface, sucht that it can run in the background with some possible forground operations/requests to the ui, without blocking the main app. + * If the task succeeded, the vault was successfully locked. + * If the task is canceled, the lock was canceled. + * If the task failed, the lock failed due to an exception. + */ +public class LockWorkflow extends Task { private static final Logger LOG = LoggerFactory.getLogger(LockWorkflow.class); @@ -37,15 +45,11 @@ public class LockWorkflow extends Task { } @Override - protected Boolean call() throws Volume.VolumeException, InterruptedException { - // change vault state to processing -- done by overriding scheduled method of Task - if (attemptLock() || attemptForcedLock()) { - handleSuccess(); - return true; - } else { - //canceled -- for error the overriden failed() method is responsible - return false; + protected Void call() throws Volume.VolumeException, InterruptedException { + if (!attemptLock()) { + attemptForcedLock(); } + return null; } private boolean attemptLock() { @@ -53,7 +57,7 @@ public class LockWorkflow extends Task { vault.lock(false); return true; } catch (Volume.VolumeException e) { - e.printStackTrace(); + LOG.debug("Regular lock of {} failed.", vault.getDisplayName(), e); return false; } } @@ -77,17 +81,13 @@ public class LockWorkflow extends Task { vault.lock(true); return true; case CANCEL: - // if lock was performed over main window, show it again + this.cancel(false); return false; default: return false; } } - private void handleSuccess() { - LOG.info("Lock of {} succeeded.", vault.getDisplayName()); - } - @Override protected void scheduled() { vault.setState(VaultState.PROCESSING); @@ -95,17 +95,19 @@ public class LockWorkflow extends Task { @Override protected void succeeded() { + LOG.info("Lock of {} succeeded.", vault.getDisplayName()); vault.setState(VaultState.LOCKED); } @Override protected void failed() { - LOG.info("Failed to lock {}.", vault.getDisplayName()); + LOG.warn("Failed to lock {}.", vault.getDisplayName()); vault.setState(VaultState.UNLOCKED); } @Override protected void cancelled() { + LOG.debug("Lock of {} canceled.", vault.getDisplayName()); vault.setState(VaultState.UNLOCKED); } diff --git a/main/ui/src/main/resources/css/dark_theme.css b/main/ui/src/main/resources/css/dark_theme.css index 8d20ad9be..f5aeb0695 100644 --- a/main/ui/src/main/resources/css/dark_theme.css +++ b/main/ui/src/main/resources/css/dark_theme.css @@ -105,6 +105,11 @@ -fx-font-size: 1.5em; } +.label-medium { + -fx-font-family: 'Open Sans SemiBold'; + -fx-font-size: 1.2em; +} + .label-small { -fx-font-size: 0.8em; } diff --git a/main/ui/src/main/resources/css/light_theme.css b/main/ui/src/main/resources/css/light_theme.css index b0ba8ac8c..23a2b4f5e 100644 --- a/main/ui/src/main/resources/css/light_theme.css +++ b/main/ui/src/main/resources/css/light_theme.css @@ -105,6 +105,11 @@ -fx-font-size: 1.5em; } +.label-medium { + -fx-font-family: 'Open Sans SemiBold'; + -fx-font-size: 1.2em; +} + .label-small { -fx-font-size: 0.8em; } diff --git a/main/ui/src/main/resources/fxml/lock_forced.fxml b/main/ui/src/main/resources/fxml/lock_forced.fxml index be311261d..6b29cd527 100644 --- a/main/ui/src/main/resources/fxml/lock_forced.fxml +++ b/main/ui/src/main/resources/fxml/lock_forced.fxml @@ -1,6 +1,7 @@ + @@ -25,14 +26,18 @@ -