Search in sources :

Example 1 with LabelComparator

use of org.openforis.collect.designer.model.LabelledItem.LabelComparator in project collect by openforis.

the class SurveyLanguageVM method init.

@Init
public void init() {
    languages = new ArrayList<LabelledItem>();
    List<String> codes = Languages.getCodes(Standard.ISO_639_1);
    for (String code : codes) {
        LabelledItem item = new LabelledItem(code, Labels.getLabel(code));
        languages.add(item);
    }
    Collections.sort(languages, new LabelComparator());
    assignedLanguages = getSurveyAssignedLanguages();
}
Also used : LabelledItem(org.openforis.collect.designer.model.LabelledItem) LabelComparator(org.openforis.collect.designer.model.LabelledItem.LabelComparator) Init(org.zkoss.bind.annotation.Init)

Example 2 with LabelComparator

use of org.openforis.collect.designer.model.LabelledItem.LabelComparator in project collect by openforis.

the class NewSurveyParametersPopUpVM method initLanguageModel.

private void initLanguageModel() {
    List<LabelledItem> languages = new ArrayList<LabelledItem>();
    List<String> codes = Languages.getCodes(Standard.ISO_639_1);
    for (String code : codes) {
        LabelledItem item = new LabelledItem(code, Labels.getLabel(code));
        languages.add(item);
    }
    Collections.sort(languages, new LabelComparator());
    languageModel = new BindingListModelListModel<LabelledItem>(new ListModelList<LabelledItem>(languages));
    LabelledItem defaultLanguage = LabelledItem.getByCode(languages, Locale.ENGLISH.getLanguage());
    form.put(LANGUAGE_FIELD_NAME, defaultLanguage);
}
Also used : LabelledItem(org.openforis.collect.designer.model.LabelledItem) ListModelList(org.zkoss.zul.ListModelList) ArrayList(java.util.ArrayList) LabelComparator(org.openforis.collect.designer.model.LabelledItem.LabelComparator)

Aggregations

LabelledItem (org.openforis.collect.designer.model.LabelledItem)2 LabelComparator (org.openforis.collect.designer.model.LabelledItem.LabelComparator)2 ArrayList (java.util.ArrayList)1 Init (org.zkoss.bind.annotation.Init)1 ListModelList (org.zkoss.zul.ListModelList)1