Search in sources :

Example 1 with ChannelGroupTypeBuilder

use of org.eclipse.smarthome.core.thing.type.ChannelGroupTypeBuilder in project smarthome by eclipse.

the class ChannelGroupTypeI18nLocalizationService method createLocalizedChannelGroupType.

public ChannelGroupType createLocalizedChannelGroupType(Bundle bundle, ChannelGroupType channelGroupType, @Nullable Locale locale) {
    ChannelGroupTypeUID channelGroupTypeUID = channelGroupType.getUID();
    String defaultLabel = channelGroupType.getLabel();
    String label = thingTypeI18nUtil.getChannelGroupLabel(bundle, channelGroupTypeUID, defaultLabel, locale);
    String description = thingTypeI18nUtil.getChannelGroupDescription(bundle, channelGroupTypeUID, channelGroupType.getDescription(), locale);
    List<ChannelDefinition> localizedChannelDefinitions = channelI18nUtil.createLocalizedChannelDefinitions(bundle, channelGroupType.getChannelDefinitions(), channelDefinition -> thingTypeI18nUtil.getChannelLabel(bundle, channelGroupTypeUID, channelDefinition, channelDefinition.getLabel(), locale), channelDefinition -> thingTypeI18nUtil.getChannelDescription(bundle, channelGroupTypeUID, channelDefinition, channelDefinition.getDescription(), locale), locale);
    ChannelGroupTypeBuilder builder = ChannelGroupTypeBuilder.instance(channelGroupTypeUID, label == null ? defaultLabel : label).isAdvanced(channelGroupType.isAdvanced()).withCategory(channelGroupType.getCategory()).withChannelDefinitions(localizedChannelDefinitions);
    if (description != null) {
        builder.withDescription(description);
    }
    return builder.build();
}
Also used : ChannelDefinition(org.eclipse.smarthome.core.thing.type.ChannelDefinition) ChannelGroupTypeUID(org.eclipse.smarthome.core.thing.type.ChannelGroupTypeUID) ChannelGroupTypeBuilder(org.eclipse.smarthome.core.thing.type.ChannelGroupTypeBuilder)

Aggregations

ChannelDefinition (org.eclipse.smarthome.core.thing.type.ChannelDefinition)1 ChannelGroupTypeBuilder (org.eclipse.smarthome.core.thing.type.ChannelGroupTypeBuilder)1 ChannelGroupTypeUID (org.eclipse.smarthome.core.thing.type.ChannelGroupTypeUID)1