Package org.openhab.core.ui.icon
Interface IconProvider
- All Known Implementing Classes:
AbstractResourceIconProvider
@NonNullByDefault
public interface IconProvider
An icon provider can provide
InputStream
s for icons.
The source of the images can depend on the provider implementation.
The byte stream represents a PNG or SVG image, depending on the format.
The icon category corresponds to the list of available channel categories.
In order to provide means to user interfaces to know, what kind of icon sets are available in the system (and offered
by some icon provider), the provider can additionally provide a set of IconSet
s.- Author:
- Kai Kreuzer - Initial contribution
-
Method Summary
Modifier and TypeMethodDescription@Nullable InputStream
getIcon
(String category, String iconSetId, @Nullable String state, IconSet.Format format) retrieves theInputStream
of an iconReturns a set of icon set definitions (meta-data) which this provider defines.getIconSets
(@Nullable Locale locale) Returns a set of localized icon set definitions (meta-data) which this provider defines.@Nullable Integer
hasIcon
(String category, String iconSetId, IconSet.Format format) determines whether this provider can deliver an icon for a given name
-
Method Details
-
getIconSets
Returns a set of icon set definitions (meta-data) which this provider defines.- Returns:
- a set of icon sets in the default locale
-
getIconSets
Returns a set of localized icon set definitions (meta-data) which this provider defines.- Parameters:
locale
- the locale to use for the results- Returns:
- a set of icon sets in the requested locale
-
hasIcon
determines whether this provider can deliver an icon for a given name- Parameters:
category
- the icon categoryiconSetId
- the id of the icon set for which the icon is requestedformat
- the format of the stream (usually either png or svg)- Returns:
- a non-negative Integer value defining the priority (higher is more important) or
null
, if this provider cannot deliver an icon. Default for full icon sets should be 0, so that others have the chance to override icons.
-
getIcon
@Nullable InputStream getIcon(String category, String iconSetId, @Nullable String state, IconSet.Format format) retrieves theInputStream
of an icon- Parameters:
category
- the icon categoryiconSetId
- the id of the icon set for which the icon is requestedstate
- the string representation of the state (for the case that the icon differs for different states)format
- the format of the stream (usually either png or svg)- Returns:
- a byte stream of the icon in the given format or null, if no icon exists
-