more renaming

This commit is contained in:
Armin Schrenk
2025-03-21 15:21:22 +01:00
parent cc8aa00326
commit 94410f1839
7 changed files with 32 additions and 39 deletions

View File

@@ -4,7 +4,7 @@ import org.cryptomator.common.vaults.Vault;
import org.cryptomator.event.FSEventBucket;
import org.cryptomator.event.FSEventBucketContent;
import org.cryptomator.ui.common.FxController;
import org.cryptomator.ui.fxapp.EventsUpdateCheck;
import org.cryptomator.ui.fxapp.FxFSEventList;
import javax.inject.Inject;
import javafx.beans.value.ObservableValue;
@@ -36,8 +36,8 @@ public class EventViewController implements FxController {
ListView<Map.Entry<FSEventBucket, FSEventBucketContent>> eventListView;
@Inject
public EventViewController(EventsUpdateCheck eventsUpdateCheck, ObservableList<Vault> vaults, ResourceBundle resourceBundle, EventListCellFactory cellFactory) {
this.filteredEventList = eventsUpdateCheck.getList().filtered(_ -> true);
public EventViewController(FxFSEventList fxFSEventList, ObservableList<Vault> vaults, ResourceBundle resourceBundle, EventListCellFactory cellFactory) {
this.filteredEventList = fxFSEventList.getObservableList().filtered(_ -> true);
this.vaults = vaults;
this.sortedEventList = new SortedList<>(filteredEventList, this::compareBuckets);
this.choiceBoxEntries = FXCollections.observableArrayList();

View File

@@ -11,10 +11,9 @@ 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 org.cryptomator.ui.fxapp.FxFSEventList;
import javax.inject.Named;
import javax.inject.Provider;
import javafx.beans.property.BooleanProperty;
import javafx.scene.Scene;
import javafx.stage.Modality;
import javafx.stage.Stage;
@@ -27,7 +26,7 @@ abstract class EventViewModule {
@Provides
@EventViewScoped
@EventViewWindow
static Stage provideStage(StageFactory factory, ResourceBundle resourceBundle, @Named("unreadEventsAvailable") BooleanProperty unreadEvents) {
static Stage provideStage(StageFactory factory, ResourceBundle resourceBundle, FxFSEventList fxFSEventList) {
Stage stage = factory.create();
stage.setHeight(498);
stage.setTitle(resourceBundle.getString("eventView.title"));
@@ -35,7 +34,7 @@ abstract class EventViewModule {
stage.initModality(Modality.NONE);
stage.focusedProperty().addListener((_,_,isFocused) -> {
if(isFocused) {
unreadEvents.setValue(false);
fxFSEventList.unreadEventsProperty().setValue(false);
}
});
return stage;

View File

@@ -29,10 +29,10 @@ public class FxApplication {
private final FxApplicationStyle applicationStyle;
private final FxApplicationTerminator applicationTerminator;
private final AutoUnlocker autoUnlocker;
private final EventsUpdateCheck eventsUpdateCheck; //not unused! By injecting it here, the object gets initiated the service starts
private final FxFSEventList fxFSEventList; //not unused! By injecting it here, the object gets initiated the service starts
@Inject
FxApplication(@Named("startupTime") long startupTime, Environment environment, Settings settings, AppLaunchEventHandler launchEventHandler, Lazy<TrayMenuComponent> trayMenu, FxApplicationWindows appWindows, FxApplicationStyle applicationStyle, FxApplicationTerminator applicationTerminator, AutoUnlocker autoUnlocker, EventsUpdateCheck eventsUpdateCheck) {
FxApplication(@Named("startupTime") long startupTime, Environment environment, Settings settings, AppLaunchEventHandler launchEventHandler, Lazy<TrayMenuComponent> trayMenu, FxApplicationWindows appWindows, FxApplicationStyle applicationStyle, FxApplicationTerminator applicationTerminator, AutoUnlocker autoUnlocker, FxFSEventList fxFSEventList) {
this.startupTime = startupTime;
this.environment = environment;
this.settings = settings;
@@ -42,7 +42,7 @@ public class FxApplication {
this.applicationStyle = applicationStyle;
this.applicationTerminator = applicationTerminator;
this.autoUnlocker = autoUnlocker;
this.eventsUpdateCheck = eventsUpdateCheck;
this.fxFSEventList = fxFSEventList;
}
public void start() {

View File

@@ -77,11 +77,4 @@ abstract class FxApplicationModule {
return factory.create();
}
@Provides
@FxApplicationScoped
@Named("unreadEventsAvailable")
static BooleanProperty provideUnreadEventsAvailable() {
return new SimpleBooleanProperty(false);
}
}

View File

@@ -5,9 +5,9 @@ import org.cryptomator.event.FSEventBucketContent;
import org.cryptomator.event.FileSystemEventAggregator;
import javax.inject.Inject;
import javax.inject.Named;
import javafx.application.Platform;
import javafx.beans.property.BooleanProperty;
import javafx.beans.property.SimpleBooleanProperty;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import java.util.Map;
@@ -17,37 +17,37 @@ import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
@FxApplicationScoped
public class EventsUpdateCheck {
public class FxFSEventList {
private final ObservableList<Map.Entry<FSEventBucket, FSEventBucketContent>> events;
private final FileSystemEventAggregator eventRegistry;
private final FileSystemEventAggregator eventAggregator;
private final ScheduledFuture<?> scheduledTask;
private final BooleanProperty unreadEvents;
@Inject
public EventsUpdateCheck(FileSystemEventAggregator eventRegistry, ScheduledExecutorService scheduler, @Named("unreadEventsAvailable") BooleanProperty unreadEvents) {
public FxFSEventList(FileSystemEventAggregator fsEventAggregator, ScheduledExecutorService scheduler) {
this.events = FXCollections.observableArrayList();
this.eventRegistry = eventRegistry;
this.unreadEvents = unreadEvents;
this.eventAggregator = fsEventAggregator;
this.unreadEvents = new SimpleBooleanProperty(false);
this.scheduledTask = scheduler.scheduleWithFixedDelay(() -> {
if (eventRegistry.hasUpdates()) {
if (fsEventAggregator.hasUpdates()) {
flush();
}
}, 1000, 1000, TimeUnit.MILLISECONDS);
//TODO: allow the task to be canceled (to enable ui actions, e.g. when the contextMenu is open, the list should not be updated
}
public ObservableList<Map.Entry<FSEventBucket, FSEventBucketContent>> getList() {
public ObservableList<Map.Entry<FSEventBucket, FSEventBucketContent>> getObservableList() {
return events;
}
/**
* Clones the registry into the observable list
* Clones the aggregator into the observable list
*/
private void flush() {
var latch = new CountDownLatch(1);
Platform.runLater(() -> {
eventRegistry.cloneTo(events);
eventAggregator.cloneTo(events);
unreadEvents.setValue(true);
latch.countDown();
});
@@ -58,6 +58,9 @@ public class EventsUpdateCheck {
}
}
public BooleanProperty unreadEventsProperty() {
return unreadEvents;
}
}

View File

@@ -6,18 +6,17 @@ import org.cryptomator.common.vaults.Vault;
import org.cryptomator.common.vaults.VaultListManager;
import org.cryptomator.cryptofs.CryptoFileSystemProvider;
import org.cryptomator.cryptofs.DirStructure;
import org.cryptomator.event.FileSystemEventRegistry;
import org.cryptomator.ui.addvaultwizard.AddVaultWizardComponent;
import org.cryptomator.ui.common.FxController;
import org.cryptomator.ui.common.VaultService;
import org.cryptomator.ui.dialogs.Dialogs;
import org.cryptomator.ui.fxapp.FxFSEventList;
import org.cryptomator.ui.fxapp.FxApplicationWindows;
import org.cryptomator.ui.preferences.SelectedPreferencesTab;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.inject.Inject;
import javax.inject.Named;
import javafx.beans.binding.Bindings;
import javafx.beans.binding.BooleanBinding;
import javafx.beans.property.BooleanProperty;
@@ -25,7 +24,6 @@ import javafx.beans.property.ObjectProperty;
import javafx.beans.property.SimpleBooleanProperty;
import javafx.beans.value.ObservableValue;
import javafx.collections.ListChangeListener;
import javafx.collections.MapChangeListener;
import javafx.collections.ObservableList;
import javafx.fxml.FXML;
import javafx.geometry.Side;
@@ -69,7 +67,7 @@ public class VaultListController implements FxController {
private final VaultListCellFactory cellFactory;
private final AddVaultWizardComponent.Builder addVaultWizard;
private final BooleanBinding emptyVaultList;
private final BooleanProperty newEventsPresent;
private final BooleanProperty unreadEvents;
private final VaultListManager vaultListManager;
private final BooleanProperty draggingVaultOver = new SimpleBooleanProperty();
private final ResourceBundle resourceBundle;
@@ -96,7 +94,7 @@ public class VaultListController implements FxController {
FxApplicationWindows appWindows, //
Settings settings, //
Dialogs dialogs, //
@Named("unreadEventsAvailable") BooleanProperty unreadEvents) {
FxFSEventList fxFSEventList) {
this.mainWindow = mainWindow;
this.vaults = vaults;
this.selectedVault = selectedVault;
@@ -109,7 +107,7 @@ public class VaultListController implements FxController {
this.dialogs = dialogs;
this.emptyVaultList = Bindings.isEmpty(vaults);
this.newEventsPresent = unreadEvents;
this.unreadEvents = fxFSEventList.unreadEventsProperty();
selectedVault.addListener(this::selectedVaultDidChange);
cellSize = settings.compactMode.map(compact -> compact ? 30.0 : 60.0);
@@ -272,7 +270,7 @@ public class VaultListController implements FxController {
@FXML
public void showEventViewer() {
appWindows.showEventViewer();
newEventsPresent.setValue(false);
unreadEvents.setValue(false);
}
// Getter and Setter
@@ -300,11 +298,11 @@ public class VaultListController implements FxController {
return cellSize.getValue();
}
public ObservableValue<Boolean> newEventsPresentProperty() {
return newEventsPresent;
public ObservableValue<Boolean> unreadEventsPresentProperty() {
return unreadEvents;
}
public boolean getNewEventsPresent() {
return newEventsPresent.getValue();
public boolean getUnreadEventsPresent() {
return unreadEvents.getValue();
}
}

View File

@@ -56,7 +56,7 @@
</tooltip>
</Button>
<AnchorPane mouseTransparent="true" minWidth="12" maxWidth="12" minHeight="12" maxHeight="12" StackPane.alignment="CENTER">
<Circle radius="4" styleClass="icon-update-indicator" AnchorPane.topAnchor="-8" AnchorPane.rightAnchor="-6" visible="${controller.newEventsPresent}" />
<Circle radius="4" styleClass="icon-update-indicator" AnchorPane.topAnchor="-8" AnchorPane.rightAnchor="-6" visible="${controller.unreadEventsPresent}" />
</AnchorPane>
</StackPane>
<Button onMouseClicked="#showPreferences" styleClass="button-right" alignment="CENTER" minWidth="20" contentDisplay="GRAPHIC_ONLY">