com.vaadin.client.renderers
Class NumberRenderer

java.lang.Object
  extended by com.vaadin.client.renderers.NumberRenderer
Type Parameters:
T - The number type to render.
All Implemented Interfaces:
Renderer<java.lang.Number>

public class NumberRenderer
extends java.lang.Object
implements Renderer<java.lang.Number>

Renders a number into a cell using a specific NumberFormat. By default uses the default number format returned by NumberFormat#getDecimalFormat().

Since:
7.4
Author:
Vaadin Ltd

Constructor Summary
NumberRenderer()
           
NumberRenderer(NumberFormat format)
           
 
Method Summary
 NumberFormat getFormat()
          Gets the number format that the number should be formatted in.
 void render(RendererCellReference cell, java.lang.Number number)
          Called whenever the Grid updates a cell.
 void setFormat(NumberFormat format)
          Sets the number format to use for formatting the number.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NumberRenderer

public NumberRenderer()

NumberRenderer

public NumberRenderer(NumberFormat format)
Method Detail

getFormat

public NumberFormat getFormat()
Gets the number format that the number should be formatted in.

Returns:
the number format used to render the number

setFormat

public void setFormat(NumberFormat format)
               throws java.lang.IllegalArgumentException
Sets the number format to use for formatting the number.

Parameters:
format - the format to use
Throws:
java.lang.IllegalArgumentException - when the format is null

render

public void render(RendererCellReference cell,
                   java.lang.Number number)
Description copied from interface: Renderer
Called whenever the Grid updates a cell.

For optimal performance, work done in this method should be kept to a minimum since it will be called continuously while the user is scrolling. It is recommended to set up the cell's DOM structure in ComplexRenderer.init(RendererCellReference) and only make incremental updates based on cell data in this method.

Specified by:
render in interface Renderer<java.lang.Number>
Parameters:
cell - The cell. Note that the cell is a flyweight and should not be stored outside of the method as it will change.
number - The column data object


Copyright © 2000-2014 Vaadin Ltd. All Rights Reserved.