use of org.beanfabrics.model.SortKey in project grafikon by jub77.
the class LocalizedStringPM method initImpl.
private LolizationEditResult initImpl(LocalizedString string, Collection<Locale> availableLocales, boolean editable) {
if (currentResult != null) {
currentResult.finishBuild();
currentResult = null;
}
if (string == null) {
this.strings.clear();
this.string.setText(null);
this.string.setEditable(false);
return null;
}
this.string.setEditable(true);
currentResult = editable ? new EditResultImpl() : null;
Collection<Locale> stringLocales = string.getLocales();
Set<Locale> locales = new HashSet<>(availableLocales);
locales.addAll(stringLocales);
strings.clear();
for (Locale locale : locales) {
String text = string.getLocalizedString(locale);
strings.add(new StringWithLocalePM(text, locale));
}
this.string.setText(string.getDefaultString());
strings.sortBy(Arrays.asList(new SortKey(true, new Path("locale"))));
return currentResult;
}
Aggregations