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 Detail

      • getCategory

        @Nullable String getCategory​(String itemName)
        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

        @Nullable String getLabel​(String itemName)
        Returns the label text to be used for an item in the UI.
        Parameters:
        item - 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

        @Nullable Widget getDefaultWidget​(@Nullable Class<? extends Item> itemType,
                                          String itemName)
        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 unknown
        itemName - 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

        @Nullable Widget getWidget​(String itemName)

        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.