com.vaadin.flow.data.renderer.
Class TextRenderer<ITEM>
Type Parameters:
ITEM
- the type of the input object that can be used by the rendered
component
All Implemented Interfaces:
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 default
ItemLabelGenerator
:String::valueOf
.TextRenderer
(ItemLabelGenerator<ITEM> itemLabelGenerator) Creates a new renderer instance using the provided
itemLabelGenerator
. -
Method Summary
Modifier and TypeMethodDescriptioncreateComponent
(ITEM item) Creates a component for a given object model item.
protected Element
createElement
(String item) Creates a new
Element
that represent the rendereditem
.protected String
getFormattedValue
(ITEM item) Gets the String representation of the target object, to be used inside the template.
protected String
Returns the Lit template expression used to render items.
Methods inherited from class com.vaadin.flow.data.renderer.BasicRenderer
getValueProvider
Methods inherited from class com.vaadin.flow.data.renderer.ComponentRenderer
render, updateComponent
Methods 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 default
ItemLabelGenerator
:String::valueOf
. -
TextRenderer
Creates a new renderer instance using the provided
itemLabelGenerator
.Parameters:
itemLabelGenerator
- the item label generator
-
-
Method Details
-
createComponent
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 classBasicRenderer<ITEM,
ITEM> Parameters:
item
- the model item, possiblynull
Returns:
a component instance representing the provided item
-
createElement
Creates a new
Element
that 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 renderReturns:
the element representing rendered item
-
getFormattedValue
Description copied from class:
BasicRenderer
Gets the String representation of the target object, to be used inside the template.
By default it uses
String.valueOf(Object)
of the object.Overrides:
getFormattedValue
in classBasicRenderer<ITEM,
ITEM> Parameters:
item
- the target objectReturns:
the string representation of the object
-
getTemplateExpression
Description copied from class:
LitRenderer
Returns the Lit template expression used to render items.
Overrides:
getTemplateExpression
in classBasicRenderer<ITEM,
ITEM> Returns:
the template expression
-