Prepare strucutre and classes for lock workflow

This commit is contained in:
Armin Schrenk
2020-11-18 17:16:58 +01:00
parent bcf2a3d20c
commit c44911dcac
7 changed files with 97 additions and 0 deletions

View File

@@ -107,6 +107,13 @@ public class FxApplication extends Application {
});
}
public void startLockWorkflow(Vault vault, Optional<Stage> owner) {
Platform.runLater(() -> {
//TODO
LOG.debug("Locking vault {}", vault.getDisplayName());
});
}
public void showQuitWindow(QuitResponse response) {
Platform.runLater(() -> {
quitWindowBuilderProvider.get().quitResponse(response).build().showQuitWindow();

View File

@@ -0,0 +1,39 @@
package org.cryptomator.ui.lock;
import dagger.BindsInstance;
import dagger.Subcomponent;
import org.cryptomator.common.vaults.Vault;
import javax.inject.Named;
import javafx.stage.Stage;
import java.util.Optional;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Future;
@LockScoped
@Subcomponent(modules = {LockModule.class})
public interface LockComponent {
ExecutorService defaultExecutorService();
LockWorkflow lockWorkflow();
default Future<Boolean> startUnlockWorkflow() {
LockWorkflow workflow = lockWorkflow();
defaultExecutorService().submit(workflow);
return workflow;
}
@Subcomponent.Builder
interface Builder {
@BindsInstance
LockComponent.Builder vault(@LockWindow Vault vault);
@BindsInstance
LockComponent.Builder owner(@Named("lockWindowOwner") Optional<Stage> owner);
LockComponent build();
}
}

View File

@@ -0,0 +1,5 @@
package org.cryptomator.ui.lock;
public class LockForcedController {
}

View File

@@ -0,0 +1,8 @@
package org.cryptomator.ui.lock;
import dagger.Module;
@Module
public class LockModule {
}

View File

@@ -0,0 +1,13 @@
package org.cryptomator.ui.lock;
import javax.inject.Scope;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@Scope
@Documented
@Retention(RetentionPolicy.RUNTIME)
@interface LockScoped {
}

View File

@@ -0,0 +1,14 @@
package org.cryptomator.ui.lock;
import javax.inject.Qualifier;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
@Qualifier
@Documented
@Retention(RUNTIME)
@interface LockWindow {
}

View File

@@ -0,0 +1,11 @@
package org.cryptomator.ui.lock;
import javafx.concurrent.Task;
public class LockWorkflow extends Task<Boolean> {
@Override
protected Boolean call() throws Exception {
return true;
}
}