Package com.vaadin.flow.data.renderer
Class TextRenderer<ITEM>
java.lang.Object
com.vaadin.flow.data.renderer.Renderer<ITEM>
com.vaadin.flow.data.renderer.LitRenderer<ITEM>
com.vaadin.flow.data.renderer.ComponentRenderer<Component,ITEM>
com.vaadin.flow.data.renderer.BasicRenderer<ITEM,ITEM>
com.vaadin.flow.data.renderer.TextRenderer<ITEM>
- Type Parameters:
ITEM- the type of the input object that can be used by the rendered component
- All Implemented Interfaces:
Serializable
A renderer that renders each item as a text using provided
ItemLabelGenerator.- Author:
- Vaadin Ltd
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new renderer instance using the defaultItemLabelGenerator:String::valueOf.TextRenderer(ItemLabelGenerator<ITEM> itemLabelGenerator) Creates a new renderer instance using the provideditemLabelGenerator. -
Method Summary
Modifier and TypeMethodDescriptioncreateComponent(ITEM item) Creates a component for a given object model item.protected ElementcreateElement(String item) Creates a newElementthat represent the rendereditem.protected StringgetFormattedValue(ITEM item) Gets the String representation of the target object, to be used inside the template.protected StringReturns the Lit template expression used to render items.Methods inherited from class com.vaadin.flow.data.renderer.BasicRenderer
getValueProviderMethods inherited from class com.vaadin.flow.data.renderer.ComponentRenderer
render, updateComponentMethods inherited from class com.vaadin.flow.data.renderer.LitRenderer
getValueProviders, of, withFunction, withFunction, withProperty
-
Constructor Details
-
TextRenderer
public TextRenderer()Creates a new renderer instance using the defaultItemLabelGenerator:String::valueOf. -
TextRenderer
Creates a new renderer instance using the provideditemLabelGenerator.- Parameters:
itemLabelGenerator- the item label generator
-
-
Method Details
-
createComponent
Description copied from class:ComponentRendererCreates a component for a given object model item. Subclasses can override this method to provide specific behavior.- Overrides:
createComponentin classBasicRenderer<ITEM,ITEM> - Parameters:
item- the model item, possiblynull- Returns:
- a component instance representing the provided item
-
createElement
Creates a newElementthat represent the rendereditem.By default the text is wrapped inside a
<span>element. Subclasses may override this method to return some otherElement.- Parameters:
item- the item to render- Returns:
- the element representing rendered item
-
getFormattedValue
Description copied from class:BasicRendererGets the String representation of the target object, to be used inside the template.By default it uses
String.valueOf(Object)of the object.- Overrides:
getFormattedValuein classBasicRenderer<ITEM,ITEM> - Parameters:
item- the target object- Returns:
- the string representation of the object
-
getTemplateExpression
Description copied from class:LitRendererReturns the Lit template expression used to render items.- Overrides:
getTemplateExpressionin classBasicRenderer<ITEM,ITEM> - Returns:
- the template expression
-