Search in sources :

Example 1 with SortKey

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;
}
Also used : StringWithLocale(net.parostroj.timetable.model.LocalizedString.StringWithLocale) Locale(java.util.Locale) Path(org.beanfabrics.Path) SortKey(org.beanfabrics.model.SortKey) LocalizedString(net.parostroj.timetable.model.LocalizedString) HashSet(java.util.HashSet)

Aggregations

HashSet (java.util.HashSet)1 Locale (java.util.Locale)1 LocalizedString (net.parostroj.timetable.model.LocalizedString)1 StringWithLocale (net.parostroj.timetable.model.LocalizedString.StringWithLocale)1 Path (org.beanfabrics.Path)1 SortKey (org.beanfabrics.model.SortKey)1