Search in sources :

Example 16 with StringStringPair

use of com.serotonin.db.pair.StringStringPair in project ma-core-public by infiniteautomation.

the class PublisherListDwr method init.

@DwrPermission(admin = true)
public ProcessResult init() {
    ProcessResult response = new ProcessResult();
    List<StringStringPair> translatedTypes = new ArrayList<StringStringPair>();
    for (String type : ModuleRegistry.getPublisherDefinitionTypes()) translatedTypes.add(new StringStringPair(type, translate(ModuleRegistry.getPublisherDefinition(type).getDescriptionKey())));
    StringStringPairComparator.sort(translatedTypes);
    response.addData("types", translatedTypes);
    response.addData("publishers", PublisherDao.instance.getPublishers(new PublisherDao.PublisherNameComparator()));
    return response;
}
Also used : StringStringPair(com.serotonin.db.pair.StringStringPair) ProcessResult(com.serotonin.m2m2.i18n.ProcessResult) ArrayList(java.util.ArrayList) DwrPermission(com.serotonin.m2m2.web.dwr.util.DwrPermission)

Example 17 with StringStringPair

use of com.serotonin.db.pair.StringStringPair in project ma-core-public by infiniteautomation.

the class Common method getLanguages.

public static List<StringStringPair> getLanguages() {
    if (languages == null) {
        languages = new ArrayList<StringStringPair>();
        for (String localeStr : ModuleRegistry.getLocales()) {
            Locale locale = parseLocale(localeStr);
            if (locale != null)
                languages.add(new StringStringPair(localeStr, Translations.getTranslations(locale).translate("locale.name")));
        }
        StringStringPairComparator.sort(languages);
    }
    return languages;
}
Also used : Locale(java.util.Locale) StringStringPair(com.serotonin.db.pair.StringStringPair)

Aggregations

StringStringPair (com.serotonin.db.pair.StringStringPair)17 DwrPermission (com.serotonin.m2m2.web.dwr.util.DwrPermission)11 ArrayList (java.util.ArrayList)11 ProcessResult (com.serotonin.m2m2.i18n.ProcessResult)9 User (com.serotonin.m2m2.vo.User)5 JsonObject (com.serotonin.json.type.JsonObject)2 JsonString (com.serotonin.json.type.JsonString)2 ShareUser (com.serotonin.m2m2.view.ShareUser)2 AnonymousUser (com.serotonin.m2m2.vo.AnonymousUser)2 DataPointVO (com.serotonin.m2m2.vo.DataPointVO)2 IOException (java.io.IOException)2 HashMap (java.util.HashMap)2 Version (com.github.zafarkhaja.semver.Version)1 ShouldNeverHappenException (com.serotonin.ShouldNeverHappenException)1 LongLongPair (com.serotonin.db.pair.LongLongPair)1 JsonException (com.serotonin.json.JsonException)1 JsonWriter (com.serotonin.json.JsonWriter)1 JsonTypeReader (com.serotonin.json.type.JsonTypeReader)1 SystemSettingsDao (com.serotonin.m2m2.db.dao.SystemSettingsDao)1 SimpleCompoundComponent (com.serotonin.m2m2.gviews.component.SimpleCompoundComponent)1