mirror of
https://github.com/danieldemus/openhab-core.git
synced 2025-01-25 19:55:48 +01:00
Sort Ephemeris config parameter options (#1681)
Fixes #1663 Signed-off-by: Wouter Born <github@maindrain.net>
This commit is contained in:
parent
9739271b52
commit
b62d494bf0
@ -27,6 +27,7 @@ import java.time.format.TextStyle;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
@ -112,12 +113,21 @@ public class EphemerisManagerImpl implements EphemerisManager, ConfigOptionProvi
|
||||
final Properties properties = new Properties();
|
||||
properties.load(stream);
|
||||
properties.forEach(this::parseProperty);
|
||||
|
||||
sortByLabel(countries);
|
||||
regions.values().forEach(this::sortByLabel);
|
||||
cities.values().forEach(this::sortByLabel);
|
||||
} catch (IllegalArgumentException | IllegalStateException | IOException e) {
|
||||
logger.warn("The resource '{}' could not be loaded properly! ConfigDescription options are not available.",
|
||||
JOLLYDAY_COUNTRY_DESCRIPTIONS, e);
|
||||
}
|
||||
}
|
||||
|
||||
private void sortByLabel(List<ParameterOption> parameterOptions) {
|
||||
Collections.sort(parameterOptions,
|
||||
(ParameterOption po1, ParameterOption po2) -> po1.getLabel().compareTo(po2.getLabel()));
|
||||
}
|
||||
|
||||
@Activate
|
||||
protected void activate(Map<String, Object> config) {
|
||||
modified(config);
|
||||
|
Loading…
Reference in New Issue
Block a user