This commit is contained in:
Armin Schrenk
2025-03-21 15:37:04 +01:00
parent dd724220f8
commit b9512c9e93
3 changed files with 8 additions and 9 deletions

View File

@@ -259,7 +259,7 @@ public class Vault {
private void consumeVaultEvent(FilesystemEvent e) {
fileSystemEventAggregator.enqueue(this, e);
fileSystemEventAggregator.put(this, e);
}
// ******************************************************************************

View File

@@ -29,12 +29,12 @@ public class FileSystemEventAggregator {
}
/**
* Enques the given event to be inserted into the map.
* Adds the given event to the map. If a bucket for this event already exists, only the count is updated and the event set as the most recent one.
*
* @param v Vault where the event occurred
* @param e Actual {@link FilesystemEvent}
*/
public void enqueue(Vault v, FilesystemEvent e) {
public void put(Vault v, FilesystemEvent e) {
var key = computeKey(v, e);
hasUpdates.set(true);
map.compute(key, (k, val) -> {

View File

@@ -34,15 +34,10 @@ public class FxFSEventList {
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>> getObservableList() {
return events;
}
/**
* Clones the aggregator into the observable list
* Starts the clone task on the FX thread and wait till it is completed
*/
private void flush() {
var latch = new CountDownLatch(1);
@@ -58,6 +53,10 @@ public class FxFSEventList {
}
}
public ObservableList<Map.Entry<FSEventBucket, FSEventBucketContent>> getObservableList() {
return events;
}
public BooleanProperty unreadEventsProperty() {
return unreadEvents;
}