Packagecom.esri.bacore
Classpublic class ValueFormatter
InheritanceValueFormatter Inheritance mx.formatters.NumberFormatter
Implements IValueFormatter

The ValueFormatter class provides the default implementation of interface.



Public Properties
 PropertyDefined By
  formatUnits : Function
A function providing units for a formatted value.
ValueFormatter
Public Methods
 MethodDefined By
  
Initializes a new instance of the ValueFormatter class.
ValueFormatter
  
formatValue(value:Number, decimals:int):String
Converts a numeric value to a string representation with the required number of digits after the decimal point.
ValueFormatter
  
formatValueWithUnits(value:Number, decimals:int, valueType:BAValueType):String
Converts a numeric value to a string representation with the required number of digits after the decimal point provided with units if necessary.
ValueFormatter
Property Detail
formatUnitsproperty
formatUnits:Function

A function providing units for a formatted value.

The signature of this function is the following:

FormatUnits(formattedValue:String, valueType:BAValueType):String;

It can add units to a formatted value and return the resulting string. For example, if the valueType is BAValueType.PERCENTAGE, this function can append the percent sign to the input formattedValue. If units are missing for the given value type, the function should return the input formattedValue.

If this function is null, units are not added to a value formatted with the FormatValueWithUnits method.


Implementation
    public function get formatUnits():Function
    public function set formatUnits(value:Function):void
Constructor Detail
ValueFormatter()Constructor
public function ValueFormatter()

Initializes a new instance of the ValueFormatter class.

Method Detail
formatValue()method
public function formatValue(value:Number, decimals:int):String

Converts a numeric value to a string representation with the required number of digits after the decimal point.

The base version formats a value using the format method of the base class with specified decimals as a precision value.

Parameters

value:Number — A numeric value to be converted.
 
decimals:int — The number of significant digits after the decimal point. Negative value means unknown number of digits.

Returns
String
formatValueWithUnits()method 
public function formatValueWithUnits(value:Number, decimals:int, valueType:BAValueType):String

Converts a numeric value to a string representation with the required number of digits after the decimal point provided with units if necessary.

The base version formats the value using the FormatValue method and after that adds units if necessary using the FormatUnits function associated with this formatter.

Parameters

value:Number — A numeric value to be converted.
 
decimals:int — The number of significant digits after the decimal point. Negative value means unknown number of digits.
 
valueType:BAValueType — Type of value.

Returns
String