Package com.vaadin.flow.data.renderer
Class NumberRenderer<SOURCE>
java.lang.Object
com.vaadin.flow.data.renderer.Renderer<SOURCE>
com.vaadin.flow.data.renderer.LitRenderer<SOURCE>
com.vaadin.flow.data.renderer.ComponentRenderer<Component,SOURCE>
com.vaadin.flow.data.renderer.BasicRenderer<SOURCE,Number>
com.vaadin.flow.data.renderer.NumberRenderer<SOURCE>
- Type Parameters:
SOURCE
- the type of the input item, from which the number is extracted
- All Implemented Interfaces:
Serializable
A renderer for presenting number values.
- Author:
- Vaadin Ltd
- See Also:
-
Constructor Summary
ModifierConstructorDescriptionprotected
NumberRenderer
(ValueProvider<SOURCE, Number> valueProvider) Creates a new number renderer.NumberRenderer
(ValueProvider<SOURCE, Number> valueProvider, String formatString) Creates a new number renderer.NumberRenderer
(ValueProvider<SOURCE, Number> valueProvider, String formatString, Locale locale) Creates a new number renderer.NumberRenderer
(ValueProvider<SOURCE, Number> valueProvider, String formatString, Locale locale, String nullRepresentation) Creates a new number renderer.NumberRenderer
(ValueProvider<SOURCE, Number> valueProvider, NumberFormat numberFormat) Creates a new number renderer.NumberRenderer
(ValueProvider<SOURCE, Number> valueProvider, NumberFormat numberFormat, String nullRepresentation) Creates a new number renderer.NumberRenderer
(ValueProvider<SOURCE, Number> valueProvider, Locale locale) Creates a new number renderer. -
Method Summary
Modifier and TypeMethodDescriptionprotected String
getFormattedValue
(Number value) Gets the String representation of the target object, to be used inside the template.Methods inherited from class com.vaadin.flow.data.renderer.BasicRenderer
createComponent, getTemplateExpression, 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
-
NumberRenderer
Creates a new number renderer.The renderer is configured to render with the number's natural string representation in the default locale.
- Parameters:
valueProvider
- the callback to provide aNumber
to the renderer, notnull
-
NumberRenderer
Creates a new number renderer.The renderer is configured to render the number as defined with the given number format.
- Parameters:
valueProvider
- the callback to provide aNumber
to the renderer, notnull
numberFormat
- the number format with which to display numbers, notnull
-
NumberRenderer
public NumberRenderer(ValueProvider<SOURCE, Number> valueProvider, NumberFormat numberFormat, String nullRepresentation) Creates a new number renderer.The renderer is configured to render the number as defined with the given number format.
- Parameters:
valueProvider
- the callback to provide aNumber
to the renderer, notnull
numberFormat
- the number format with which to display numbers, notnull
nullRepresentation
- the textual representation ofnull
value
-
NumberRenderer
Creates a new number renderer.The renderer is configured to render with the number's natural string representation in the given locale.
- Parameters:
valueProvider
- the callback to provide aNumber
to the renderer, notnull
locale
- the locale in which to display numbers
-
NumberRenderer
public NumberRenderer(ValueProvider<SOURCE, Number> valueProvider, String formatString, Locale locale) Creates a new number renderer.The renderer is configured to render with the number's natural string representation in the given locale.
- Parameters:
valueProvider
- the callback to provide aNumber
to the renderer, notnull
formatString
- the format string with which to format the number, notnull
locale
- the locale in which to display numbers, notnull
-
NumberRenderer
Creates a new number renderer.The renderer is configured to render with the given format string in the default locale.
- Parameters:
valueProvider
- the callback to provide aNumber
to the renderer, notnull
formatString
- the format string with which to format the number, notnull
- See Also:
-
NumberRenderer
public NumberRenderer(ValueProvider<SOURCE, Number> valueProvider, String formatString, Locale locale, String nullRepresentation) Creates a new number renderer.The renderer is configured to render with the given format string in the given locale.
- Parameters:
valueProvider
- the callback to provide aNumber
to the renderer, notnull
formatString
- the format string with which to format the number, notnull
locale
- the locale in which to present numbers, notnull
nullRepresentation
- the textual representation ofnull
value- See Also:
-
-
Method Details
-
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<SOURCE,
Number> - Parameters:
value
- the target object- Returns:
- the string representation of the object
-