SOURCE - the type of the item used inside the rendererTARGET - the type of the output object, such as Number or LocalDatepublic abstract class BasicRenderer<SOURCE,TARGET> extends ComponentRenderer<Component,SOURCE>
NumberRenderer and
LocalDateRenderer.| Modifier | Constructor and Description |
|---|---|
protected |
BasicRenderer(ValueProvider<SOURCE,TARGET> valueProvider)
Builds a new template renderer using the value provider as the source of
values to be rendered.
|
| Modifier and Type | Method and Description |
|---|---|
Component |
createComponent(SOURCE item)
Creates a component for a given object model item.
|
protected String |
getFormattedValue(TARGET object)
Gets the String representation of the target object, to be used inside
the template.
|
protected String |
getTemplateForProperty(String property,
Rendering<SOURCE> context)
Gets the template String for a given property.
|
protected String |
getTemplatePropertyName(Rendering<SOURCE> context)
Gets the name of the property to be transmitted and used inside the
template.
|
protected ValueProvider<SOURCE,TARGET> |
getValueProvider() |
Rendering<SOURCE> |
render(Element container,
DataKeyMapper<SOURCE> keyMapper,
Element contentTemplate)
Handles the rendering of the model objects by using the given
<template> element in the given container. |
setComponentRendererTag, updateComponentgetEventHandlers, getValueProviders, render, setEventHandler, setPropertyprotected BasicRenderer(ValueProvider<SOURCE,TARGET> valueProvider)
valueProvider - the callback to provide a objects to the renderer, not
nullprotected ValueProvider<SOURCE,TARGET> getValueProvider()
public Rendering<SOURCE> render(Element container, DataKeyMapper<SOURCE> keyMapper, Element contentTemplate)
Renderer<template> element in the given container.
Subclasses of Renderer usually override this method to provide additional features.
render in class ComponentRenderer<Component,SOURCE>container - the element in which the template will be attached to, not
nullkeyMapper - mapper used internally to fetch items by key and to provide
keys for given items. It is required when either event
handlers or DataGenerator are supportedcontentTemplate - the <template> element to be used for rendering in the
container, not nullprotected String getTemplatePropertyName(Rendering<SOURCE> context)
This method is only called when
render(Element, DataKeyMapper, Element) is invoked.
context - the rendering contextRendering.getTemplateElement()protected String getTemplateForProperty(String property, Rendering<SOURCE> context)
This method is only called when
render(Element, DataKeyMapper, Element) is invoked.
property - the property to be used inside the templatecontext - the rendering context<template>
elementgetTemplatePropertyName(Rendering)public Component createComponent(SOURCE item)
ComponentRenderercreateComponent in class ComponentRenderer<Component,SOURCE>item - the model item, possibly nullprotected String getFormattedValue(TARGET object)
By default it uses String.valueOf(Object) of the object.
object - the target objectCopyright © 2025. All rights reserved.