mirror of
https://github.com/cryptomator/cryptomator.git
synced 2026-04-17 16:16:52 -04:00
more renaming
This commit is contained in:
@@ -32,13 +32,14 @@ import java.util.Set;
|
||||
* The map is size restricted to {@value MAX_SIZE} elements. If a _new_ element (i.e. not already present) is added, the least recently added is removed.
|
||||
*/
|
||||
@Singleton
|
||||
public class VaultEventsMap implements ObservableMap<VaultEventsMap.EventKey, VaultEvent> {
|
||||
public class VaultEventsMap implements ObservableMap<VaultEventsMap.Key, VaultEvent> {
|
||||
|
||||
private static final int MAX_SIZE = 300;
|
||||
|
||||
public record EventKey(Vault v, Path key, Class<? extends FilesystemEvent> c) {}
|
||||
public record Key(Vault v, Path key, Class<? extends FilesystemEvent> c) {}
|
||||
public record Value(FilesystemEvent event, int count) {}
|
||||
|
||||
private final ObservableMap<VaultEventsMap.EventKey, VaultEvent> delegate;
|
||||
private final ObservableMap<Key, VaultEvent> delegate;
|
||||
|
||||
@Inject
|
||||
public VaultEventsMap() {
|
||||
@@ -46,12 +47,12 @@ public class VaultEventsMap implements ObservableMap<VaultEventsMap.EventKey, Va
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addListener(MapChangeListener<? super EventKey, ? super VaultEvent> mapChangeListener) {
|
||||
public void addListener(MapChangeListener<? super Key, ? super VaultEvent> mapChangeListener) {
|
||||
delegate.addListener(mapChangeListener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeListener(MapChangeListener<? super EventKey, ? super VaultEvent> mapChangeListener) {
|
||||
public void removeListener(MapChangeListener<? super Key, ? super VaultEvent> mapChangeListener) {
|
||||
delegate.removeListener(mapChangeListener);
|
||||
}
|
||||
|
||||
@@ -81,7 +82,7 @@ public class VaultEventsMap implements ObservableMap<VaultEventsMap.EventKey, Va
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable VaultEvent put(EventKey key, VaultEvent value) {
|
||||
public @Nullable VaultEvent put(Key key, VaultEvent value) {
|
||||
return delegate.put(key, value);
|
||||
}
|
||||
|
||||
@@ -91,7 +92,7 @@ public class VaultEventsMap implements ObservableMap<VaultEventsMap.EventKey, Va
|
||||
}
|
||||
|
||||
@Override
|
||||
public void putAll(@NotNull Map<? extends EventKey, ? extends VaultEvent> m) {
|
||||
public void putAll(@NotNull Map<? extends Key, ? extends VaultEvent> m) {
|
||||
delegate.putAll(m);
|
||||
}
|
||||
|
||||
@@ -101,7 +102,7 @@ public class VaultEventsMap implements ObservableMap<VaultEventsMap.EventKey, Va
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull Set<EventKey> keySet() {
|
||||
public @NotNull Set<Key> keySet() {
|
||||
return delegate.keySet();
|
||||
}
|
||||
|
||||
@@ -111,7 +112,7 @@ public class VaultEventsMap implements ObservableMap<VaultEventsMap.EventKey, Va
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull Set<Entry<EventKey, VaultEvent>> entrySet() {
|
||||
public @NotNull Set<Entry<Key, VaultEvent>> entrySet() {
|
||||
return delegate.entrySet();
|
||||
}
|
||||
|
||||
@@ -148,7 +149,7 @@ public class VaultEventsMap implements ObservableMap<VaultEventsMap.EventKey, Va
|
||||
return this.remove(key);
|
||||
}
|
||||
|
||||
private EventKey computeKey(VaultEvent ve) {
|
||||
private Key computeKey(VaultEvent ve) {
|
||||
var e = ve.actualEvent();
|
||||
var p = switch (e) {
|
||||
case DecryptionFailedEvent(_, Path ciphertextPath, _) -> ciphertextPath;
|
||||
@@ -157,6 +158,6 @@ public class VaultEventsMap implements ObservableMap<VaultEventsMap.EventKey, Va
|
||||
case BrokenDirFileEvent(_, Path ciphertext) -> ciphertext;
|
||||
case BrokenFileNodeEvent(_, _, Path ciphertext) -> ciphertext;
|
||||
};
|
||||
return new EventKey(ve.v(), p, e.getClass());
|
||||
return new Key(ve.v(), p, e.getClass());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ public class EventViewController implements FxController {
|
||||
});
|
||||
|
||||
eventList.addAll(vaultEventsMap.values());
|
||||
vaultEventsMap.addListener((MapChangeListener<? super VaultEventsMap.EventKey, ? super VaultEvent>) this::updateList);
|
||||
vaultEventsMap.addListener((MapChangeListener<? super VaultEventsMap.Key, ? super VaultEvent>) this::updateList);
|
||||
eventListView.setCellFactory(cellFactory);
|
||||
eventListView.setItems(reversedEventList);
|
||||
|
||||
@@ -70,7 +70,7 @@ public class EventViewController implements FxController {
|
||||
vaultFilterChoiceBox.setConverter(new VaultConverter(resourceBundle));
|
||||
}
|
||||
|
||||
private void updateList(MapChangeListener.Change<? extends VaultEventsMap.EventKey, ? extends VaultEvent> change) {
|
||||
private void updateList(MapChangeListener.Change<? extends VaultEventsMap.Key, ? extends VaultEvent> change) {
|
||||
if (change.wasAdded() && change.wasRemoved()) {
|
||||
//entry updated
|
||||
eventList.remove(change.getValueRemoved());
|
||||
|
||||
@@ -112,7 +112,7 @@ public class VaultListController implements FxController {
|
||||
this.emptyVaultList = Bindings.isEmpty(vaults);
|
||||
this.vaultEventsMap = vaultEventsMap;
|
||||
this.newEventsPresent = new SimpleBooleanProperty(false);
|
||||
vaultEventsMap.addListener((MapChangeListener<? super VaultEventsMap.EventKey, ? super VaultEvent>) change -> {
|
||||
vaultEventsMap.addListener((MapChangeListener<? super VaultEventsMap.Key, ? super VaultEvent>) change -> {
|
||||
if (change.wasAdded()) {
|
||||
newEventsPresent.setValue(true);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user