mirror of
https://github.com/cryptomator/cryptomator.git
synced 2026-05-22 04:31:27 +00:00
displayable event view window
This commit is contained in:
@@ -13,6 +13,7 @@ public enum FxmlFile {
|
||||
CONVERTVAULT_HUBTOPASSWORD_CONVERT("/fxml/convertvault_hubtopassword_convert.fxml"), //
|
||||
CONVERTVAULT_HUBTOPASSWORD_SUCCESS("/fxml/convertvault_hubtopassword_success.fxml"), //
|
||||
ERROR("/fxml/error.fxml"), //
|
||||
EVENT_VIEWER("/fxml/eventviewer.fxml"), //
|
||||
FORGET_PASSWORD("/fxml/forget_password.fxml"), //
|
||||
HEALTH_START("/fxml/health_start.fxml"), //
|
||||
HEALTH_CHECK_LIST("/fxml/health_check_list.fxml"), //
|
||||
|
||||
@@ -7,6 +7,7 @@ public enum FontAwesome5Icon {
|
||||
ANCHOR("\uF13D"), //
|
||||
ARROW_UP("\uF062"), //
|
||||
BAN("\uF05E"), //
|
||||
BELL("\uF0F3"), //
|
||||
BUG("\uF188"), //
|
||||
CARET_DOWN("\uF0D7"), //
|
||||
CARET_RIGHT("\uF0Da"), //
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
package org.cryptomator.ui.eventviewer;
|
||||
|
||||
import org.cryptomator.ui.common.FxController;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
@EventViewerScoped
|
||||
public class EventViewController implements FxController {
|
||||
|
||||
@Inject
|
||||
public EventViewController() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,35 @@
|
||||
package org.cryptomator.ui.eventviewer;
|
||||
|
||||
public interface EventViewerComponent {}
|
||||
import dagger.BindsInstance;
|
||||
import dagger.Lazy;
|
||||
import dagger.Subcomponent;
|
||||
import org.cryptomator.ui.common.FxmlFile;
|
||||
import org.cryptomator.ui.common.FxmlScene;
|
||||
|
||||
import javax.inject.Named;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
@EventViewerScoped
|
||||
@Subcomponent(modules = {EventViewerModule.class})
|
||||
public interface EventViewerComponent {
|
||||
|
||||
@EventViewerWindow
|
||||
Stage window();
|
||||
|
||||
@FxmlScene(FxmlFile.EVENT_VIEWER)
|
||||
Lazy<Scene> scene();
|
||||
|
||||
default void showEventViewerWindow() {
|
||||
Stage stage = window();
|
||||
stage.setScene(scene().get());
|
||||
stage.sizeToScene();
|
||||
stage.show();
|
||||
}
|
||||
|
||||
@Subcomponent.Factory
|
||||
interface Factory {
|
||||
|
||||
EventViewerComponent create(@BindsInstance @Named("owner") Stage owner);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
package org.cryptomator.ui.eventviewer;
|
||||
|
||||
import dagger.Binds;
|
||||
import dagger.Module;
|
||||
import dagger.Provides;
|
||||
import dagger.multibindings.IntoMap;
|
||||
import org.cryptomator.ui.common.DefaultSceneFactory;
|
||||
import org.cryptomator.ui.common.FxController;
|
||||
import org.cryptomator.ui.common.FxControllerKey;
|
||||
import org.cryptomator.ui.common.FxmlFile;
|
||||
import org.cryptomator.ui.common.FxmlLoaderFactory;
|
||||
import org.cryptomator.ui.common.FxmlScene;
|
||||
import org.cryptomator.ui.common.StageFactory;
|
||||
|
||||
import javax.inject.Named;
|
||||
import javax.inject.Provider;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.stage.Modality;
|
||||
import javafx.stage.Stage;
|
||||
import java.util.Map;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
@Module
|
||||
abstract class EventViewerModule {
|
||||
|
||||
@Provides
|
||||
@EventViewerScoped
|
||||
@EventViewerWindow
|
||||
static Stage provideStage(StageFactory factory, ResourceBundle resourceBundle, @Named("owner") Stage owner) {
|
||||
Stage stage = factory.create();
|
||||
stage.setTitle("TODO EVENTVIEWER");
|
||||
stage.setResizable(true);
|
||||
stage.initModality(Modality.WINDOW_MODAL); //TODO: or not modal at all?
|
||||
stage.initOwner(owner);
|
||||
return stage;
|
||||
}
|
||||
|
||||
@Provides
|
||||
@EventViewerScoped
|
||||
@EventViewerWindow
|
||||
static FxmlLoaderFactory provideFxmlLoaderFactory(Map<Class<? extends FxController>, Provider<FxController>> factories, DefaultSceneFactory sceneFactory, ResourceBundle resourceBundle) {
|
||||
return new FxmlLoaderFactory(factories, sceneFactory, resourceBundle);
|
||||
}
|
||||
|
||||
@Binds
|
||||
@IntoMap
|
||||
@FxControllerKey(EventViewController.class)
|
||||
abstract FxController bindEventViewController(EventViewController controller);
|
||||
|
||||
@Provides
|
||||
@FxmlScene(FxmlFile.EVENT_VIEWER)
|
||||
@EventViewerScoped
|
||||
static Scene provideEventViewerScene(@EventViewerWindow FxmlLoaderFactory fxmlLoaders) {
|
||||
return fxmlLoaders.createScene(FxmlFile.EVENT_VIEWER);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package org.cryptomator.ui.eventviewer;
|
||||
|
||||
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 EventViewerScoped {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package org.cryptomator.ui.eventviewer;
|
||||
|
||||
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 EventViewerWindow {
|
||||
|
||||
}
|
||||
@@ -8,6 +8,7 @@ package org.cryptomator.ui.fxapp;
|
||||
import dagger.Module;
|
||||
import dagger.Provides;
|
||||
import org.cryptomator.ui.error.ErrorComponent;
|
||||
import org.cryptomator.ui.eventviewer.EventViewerComponent;
|
||||
import org.cryptomator.ui.health.HealthCheckComponent;
|
||||
import org.cryptomator.ui.lock.LockComponent;
|
||||
import org.cryptomator.ui.mainwindow.MainWindowComponent;
|
||||
@@ -33,7 +34,8 @@ import java.io.InputStream;
|
||||
ErrorComponent.class, //
|
||||
HealthCheckComponent.class, //
|
||||
UpdateReminderComponent.class, //
|
||||
ShareVaultComponent.class})
|
||||
ShareVaultComponent.class, //
|
||||
EventViewerComponent.class})
|
||||
abstract class FxApplicationModule {
|
||||
|
||||
private static Image createImageFromResource(String resourceName) throws IOException {
|
||||
|
||||
@@ -7,6 +7,7 @@ import org.cryptomator.common.vaults.VaultState;
|
||||
import org.cryptomator.integrations.tray.TrayIntegrationProvider;
|
||||
import org.cryptomator.ui.dialogs.Dialogs;
|
||||
import org.cryptomator.ui.error.ErrorComponent;
|
||||
import org.cryptomator.ui.eventviewer.EventViewerComponent;
|
||||
import org.cryptomator.ui.lock.LockComponent;
|
||||
import org.cryptomator.ui.mainwindow.MainWindowComponent;
|
||||
import org.cryptomator.ui.preferences.PreferencesComponent;
|
||||
@@ -51,6 +52,7 @@ public class FxApplicationWindows {
|
||||
private final UpdateReminderComponent.Factory updateReminderWindowFactory;
|
||||
private final LockComponent.Factory lockWorkflowFactory;
|
||||
private final ErrorComponent.Factory errorWindowFactory;
|
||||
private final EventViewerComponent.Factory eventViewWindow;
|
||||
private final ExecutorService executor;
|
||||
private final VaultOptionsComponent.Factory vaultOptionsWindow;
|
||||
private final ShareVaultComponent.Factory shareVaultWindow;
|
||||
@@ -69,6 +71,7 @@ public class FxApplicationWindows {
|
||||
ErrorComponent.Factory errorWindowFactory, //
|
||||
VaultOptionsComponent.Factory vaultOptionsWindow, //
|
||||
ShareVaultComponent.Factory shareVaultWindow, //
|
||||
EventViewerComponent.Factory eventViewWindow, //
|
||||
ExecutorService executor, //
|
||||
Dialogs dialogs) {
|
||||
this.primaryStage = primaryStage;
|
||||
@@ -80,6 +83,7 @@ public class FxApplicationWindows {
|
||||
this.updateReminderWindowFactory = updateReminderWindowFactory;
|
||||
this.lockWorkflowFactory = lockWorkflowFactory;
|
||||
this.errorWindowFactory = errorWindowFactory;
|
||||
this.eventViewWindow = eventViewWindow;
|
||||
this.executor = executor;
|
||||
this.vaultOptionsWindow = vaultOptionsWindow;
|
||||
this.shareVaultWindow = shareVaultWindow;
|
||||
@@ -200,4 +204,10 @@ public class FxApplicationWindows {
|
||||
}
|
||||
}
|
||||
|
||||
public CompletionStage<Void> showEventViewer(@Nullable Stage owner) {
|
||||
return CompletableFuture.supplyAsync(() -> {
|
||||
eventViewWindow.create(owner).showEventViewerWindow();
|
||||
return null;
|
||||
}, Platform::runLater);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -264,6 +264,10 @@ public class VaultListController implements FxController {
|
||||
appWindows.showPreferencesWindow(SelectedPreferencesTab.ANY);
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void showEventViewer() {
|
||||
appWindows.showEventViewer(mainWindow);
|
||||
}
|
||||
// Getter and Setter
|
||||
|
||||
public BooleanBinding emptyVaultListProperty() {
|
||||
|
||||
Reference in New Issue
Block a user