com.vaadin.flow.data.renderer.

Class IconRenderer<ITEM>

Type Parameters:

ITEM - the type of the input object that can be used by the rendered component

All Implemented Interfaces:

Serializable

public class IconRenderer<ITEM> extends ComponentRenderer<Component,ITEM>

A renderer that renders each item as a text following by an icon using provided icon generator and label generator.

Author:

Vaadin Ltd

See Also:

  • Constructor Details

    • IconRenderer

      public IconRenderer(SerializableFunction<ITEM,? extends Component> iconGenerator)

      Creates a new renderer instance using the default ItemLabelGenerator: String::valueOf and the provided iconGenerator.

      Parameters:

      iconGenerator - the icon component generator

    • IconRenderer

      public IconRenderer(SerializableFunction<ITEM,? extends Component> iconGenerator, ItemLabelGenerator<ITEM> itemLabelGenerator)

      Creates a new renderer instance using the provided iconGenerator and itemLabelGenerator.

      Parameters:

      iconGenerator - the icon component generator

      itemLabelGenerator - the item label generator

  • Method Details

    • createComponent

      public Component createComponent(ITEM item)

      Description copied from class: ComponentRenderer

      Creates a component for a given object model item. Subclasses can override this method to provide specific behavior.

      Overrides:

      createComponent in class ComponentRenderer<Component,ITEM>

      Parameters:

      item - the model item, possibly null

      Returns:

      a component instance representing the provided item