Package org.openhab.core.ui.items
Interface ItemUIProvider
- All Known Subinterfaces:
ItemUIRegistry
@NonNullByDefault
public interface ItemUIProvider
This interface describes the methods that need to be implemented by a provider that
wants to define the appearance of an item in the UI.
- Author:
- Kai Kreuzer - Initial contribution
-
Method Summary
Modifier and TypeMethodDescription@Nullable String
getCategory
(String itemName) Returns the category to use.@Nullable Widget
getDefaultWidget
(@Nullable Class<? extends Item> itemType, String itemName) Provides a default widget for a given item (class).@Nullable String
Returns the label text to be used for an item in the UI.@Nullable Widget
Provides a widget for a given item.
-
Method Details
-
getCategory
Returns the category to use.- Parameters:
itemName
- the name of the item to return the icon for- Returns:
- the name of the category to use or null if undefined.
-
getLabel
Returns the label text to be used for an item in the UI.- Parameters:
itemName
- the name of the item to return the label text for- Returns:
- the label text to be used in the UI or null if undefined.
-
getDefaultWidget
Provides a default widget for a given item (class). This is used whenever the UI needs to be created dynamically and there is no other source of information about the widgets.- Parameters:
itemType
- the class of the item or null, if unknownitemName
- the item name to get the default widget for- Returns:
- a widget implementation that can be used for the given item or null, if no default is available for the type
-
getWidget
Provides a widget for a given item. This can be used to overwrite the widget listed in the sitemap. A use case for this is that the sitemap defines merely the parent-child-relation of widgets, but the concrete widget to be used for rendering might be selected dynamically at runtime.
If the sitemap widget should not be overridden, this method must return
null
.- Parameters:
itemName
- the item name to get the widget for- Returns:
- a widget to use for the given item or
null
if sitemap should not be overridden.
-