mirror of
https://github.com/xpipe-io/xpipe.git
synced 2025-04-17 01:33:36 +00:00
Rework list box sync again
This commit is contained in:
parent
c67411815e
commit
10dab33ed4
7 changed files with 5 additions and 13 deletions
|
@ -53,7 +53,7 @@ public class BrowserFileSystemSavedState {
|
|||
|
||||
public BrowserFileSystemSavedState() {
|
||||
lastDirectory = null;
|
||||
recentDirectories = FXCollections.observableList(new ArrayList<>(STORED));
|
||||
recentDirectories = FXCollections.synchronizedObservableList(FXCollections.observableList(new ArrayList<>(STORED)));
|
||||
}
|
||||
|
||||
static BrowserFileSystemSavedState loadForStore(BrowserFileSystemTabModel model) {
|
||||
|
@ -164,7 +164,7 @@ public class BrowserFileSystemSavedState {
|
|||
.map(recentEntry -> new RecentEntry(FileNames.toDirectory(recentEntry.directory), recentEntry.time))
|
||||
.filter(distinctBy(recentEntry -> recentEntry.getDirectory()))
|
||||
.collect(Collectors.toCollection(ArrayList::new));
|
||||
return new BrowserFileSystemSavedState(null, FXCollections.observableList(cleaned));
|
||||
return new BrowserFileSystemSavedState(null, FXCollections.synchronizedObservableList(FXCollections.observableList(cleaned)));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ public class BrowserHistorySavedStateImpl implements BrowserHistorySavedState {
|
|||
ObservableList<Entry> lastSystems;
|
||||
|
||||
public BrowserHistorySavedStateImpl(List<Entry> lastSystems) {
|
||||
this.lastSystems = FXCollections.observableArrayList(lastSystems);
|
||||
this.lastSystems = FXCollections.synchronizedObservableList(FXCollections.observableArrayList(lastSystems));
|
||||
}
|
||||
|
||||
private static BrowserHistorySavedStateImpl INSTANCE;
|
||||
|
|
|
@ -53,7 +53,6 @@ public class BrowserHistoryTabComp extends SimpleComp {
|
|||
|
||||
return true;
|
||||
})
|
||||
.createSynchronized()
|
||||
.getList();
|
||||
var empty = Bindings.createBooleanBinding(() -> list.isEmpty(), list);
|
||||
var contentDisplay = createListDisplay(list);
|
||||
|
|
|
@ -70,7 +70,6 @@ public class BrowserOverviewComp extends SimpleComp {
|
|||
|
||||
var recent = new DerivedObservableList<>(model.getSavedState().getRecentDirectories(), true)
|
||||
.mapped(s -> FileEntry.ofDirectory(model.getFileSystem(), s.getDirectory()))
|
||||
.createSynchronized()
|
||||
.getList();
|
||||
var recentOverview = new BrowserFileOverviewComp(model, recent, true);
|
||||
var recentPane = new SimpleTitledPaneComp(AppI18n.observable("recent"), recentOverview, false);
|
||||
|
|
|
@ -163,7 +163,6 @@ public class StoreCategoryComp extends SimpleComp {
|
|||
});
|
||||
|
||||
var l = category.getChildren()
|
||||
.createSynchronized()
|
||||
.getList()
|
||||
.sorted(Comparator.comparing(storeCategoryWrapper ->
|
||||
storeCategoryWrapper.nameProperty().getValue().toLowerCase(Locale.ROOT)));
|
||||
|
|
|
@ -135,7 +135,7 @@ public class StoreSection {
|
|||
category,
|
||||
filterString,
|
||||
updateObservable);
|
||||
return new StoreSection(null, ordered.createSynchronized(), shown.createSynchronized(), 0);
|
||||
return new StoreSection(null, ordered, shown, 0);
|
||||
}
|
||||
|
||||
private static StoreSection create(
|
||||
|
@ -212,7 +212,7 @@ public class StoreSection {
|
|||
e.getPersistentState(),
|
||||
e.getCache(),
|
||||
updateObservable);
|
||||
return new StoreSection(e, cached.createSynchronized(), filtered.createSynchronized(), depth);
|
||||
return new StoreSection(e, cached, filtered, depth);
|
||||
}
|
||||
|
||||
private static boolean showInCategory(StoreCategoryWrapper categoryWrapper, StoreEntryWrapper entryWrapper) {
|
||||
|
|
|
@ -32,11 +32,6 @@ public class DerivedObservableList<T> {
|
|||
return new DerivedObservableList<>(l, unique);
|
||||
}
|
||||
|
||||
public DerivedObservableList<T> createSynchronized() {
|
||||
var l = FXCollections.synchronizedObservableList(list);
|
||||
return new DerivedObservableList<>(l, unique);
|
||||
}
|
||||
|
||||
public void setContent(List<? extends T> newList) {
|
||||
if (list.equals(newList)) {
|
||||
return;
|
||||
|
|
Loading…
Add table
Reference in a new issue