Fix platform thread issue

This commit is contained in:
crschnick 2023-02-22 14:17:04 +00:00
parent 305f8d69e8
commit 5d5c3ea140

View file

@ -7,6 +7,7 @@ import atlantafx.base.theme.Tweaks;
import io.xpipe.app.comp.base.LazyTextFieldComp; import io.xpipe.app.comp.base.LazyTextFieldComp;
import io.xpipe.app.core.AppResources; import io.xpipe.app.core.AppResources;
import io.xpipe.app.fxcomps.impl.PrettyImageComp; import io.xpipe.app.fxcomps.impl.PrettyImageComp;
import io.xpipe.app.fxcomps.util.PlatformThread;
import io.xpipe.app.fxcomps.util.SimpleChangeListener; import io.xpipe.app.fxcomps.util.SimpleChangeListener;
import io.xpipe.app.util.Containers; import io.xpipe.app.util.Containers;
import io.xpipe.app.util.HumanReadableFormat; import io.xpipe.app.util.HumanReadableFormat;
@ -234,11 +235,12 @@ final class FileListComp extends AnchorPane {
}); });
fileList.getShown().addListener((observable, oldValue, newValue) -> { fileList.getShown().addListener((observable, oldValue, newValue) -> {
table.getItems().setAll(newValue); PlatformThread.runLaterIfNeededBlocking(() -> {
table.getItems().setAll(newValue);
if (newValue.size() > 0) { if (newValue.size() > 0) {
table.scrollTo(0); table.scrollTo(0);
} }
});
}); });
return table; return table;