Always hide spinner, as soon as locationPresetLoading is finished

This commit is contained in:
Armin Schrenk
2024-01-19 10:44:06 +01:00
parent 830bb5776f
commit 062c674ef1

View File

@@ -150,10 +150,13 @@ public class CreateNewVaultLocationController implements FxController {
private void loadLocationPresets() {
Platform.runLater(() -> loadingPresetLocations.set(true));
LocationPresetsProvider.loadAll(LocationPresetsProvider.class) //
.flatMap(LocationPresetsProvider::getLocations) //we do not use sorted(), because it evaluates the stream elements, blocking until all elements are gathered
.forEach(this::createRadioButtonFor);
Platform.runLater(() -> loadingPresetLocations.set(false));
try{
LocationPresetsProvider.loadAll(LocationPresetsProvider.class) //
.flatMap(LocationPresetsProvider::getLocations) //we do not use sorted(), because it evaluates the stream elements, blocking until all elements are gathered
.forEach(this::createRadioButtonFor);
} finally {
Platform.runLater(() -> loadingPresetLocations.set(false));
}
}
private void createRadioButtonFor(LocationPreset preset) {