Summary
Tag name:
<
af:convertNumber
>
This is an extension of the standard JSF javax.faces.convert.NumberConverter
The converter provides all the standard functionality of the default NumberConverter
and is strict while converting to object.
JSF javax.faces.convert.NumberConverter will convert values like
22.22.2 or 22ABC to valid Number 22.22 and 22 respectively. Here it would
result in a conversion failure and would throw a ConverterException.
If
number grouping separator, decimal separator
is configured in
adf-faces-config.xml
file,
it will be used during call to
getAsObject()
and
getAsString()
for parsing and formatting. If it has not been set,
number grouping separator, decimal separator
is
defaulted based on the locale.
If
currencyCode
is set on the converter then it will be used.
Else uses the
currencyCode
set in
adf-faces-config.xml
file. If it is not set in the configuration file then it is defaulted based on the locale.
Since ADF Faces is compatible with JDK 1.4 and higher versions,
the
currencyCode
gets preference over
currencySymbol.
See JSF's javax.faces.convert.NumberConverter for the way in which
currencyCode
and
currencySymbol
gets preference for
different version of JDK.
This converter is automatically registered under the standard
converter ID, and therefore will be used when the
<
f:convertNumber
>
tag is used.
Further more information see javadoc for
oracle.adf.view.faces.converter.NumberConverter
Example:
<af:inputText id="mdf5" value="0.75"
label="Score">
<af:convertNumber type='percent' locale="en-US" />
</af:inputText>
Attributes
|
Name
|
Type
|
Supports EL?
|
Description
|
|
convertCurrencyMessageDetail
|
String
|
Yes
|
Custom error message to be used, for creating detail part of the
FacesMessage
, when
value
cannot be converted to a number, when
type
is set to
'currency'
and
pattern
is null or not set.
Parameters:
-
{0} the label that identifies the component
-
{1} value entered by the user
|
|
convertNumberMessageDetail
|
String
|
Yes
|
Custom error message to be used, for creating detail part of the
FacesMessage
, when
value
cannot be converted to a number, when
type
is set to
'number'
and
pattern
is null or not set.
Parameters:
-
{0} the label that identifies the component
-
{1} value entered by the user
|
|
convertPatternMessageDetail
|
String
|
Yes
|
Custom error message to be used, for creating detail part of the
FacesMessage
message, when
value
cannot be converted to a number, based
on the
pattern
set.
Parameters:
-
{0} the label that identifies the component
-
{1} value entered by the user
-
{
2} the specified conversion pattern
|
|
convertPercentMessageDetail
|
String
|
Yes
|
Custom error message to be used, for creating detail part of the
FacesMessage
, when
value
cannot be converted to a number, when
type
is set to
'percent'
and
pattern
is null or not set.
Parameters:
-
{0} the label that identifies the component
-
{1} value entered by the user
|
|
currencyCode
|
String
|
Yes
|
The ISO 4217 currency code, applied only when formatting currencies.
Currency code can also be set for the entire application in adf-faces-config.xml file.
If currency code is not set on the converter, and if set on
adf-faces-config.xml configuration file it will be used by calling
AdfFacesContext().getCurrenctInstance().getCurrencyCode().
This currency code will be used during call to getAsString() for formatting,
provided type is set to 'currency'.
|
|
currencySymbol
|
String
|
Yes
|
Currency symbol, is applied only when formatting currencies.
If currency code is set then symbol will be ignored.
|
|
groupingUsed
|
boolean
|
Yes
|
Flag specifying whether formatted output will contain grouping separators.
Default value is true.
|
|
integerOnly
|
boolean
|
Yes
|
Flag specifying whether only the integer part of the value will be formatted
and parsed. Default value is false.
|
|
locale
|
java.util.Locale
|
Yes
|
Locale whose predefined styles f
or numbers are used during formatting and parsing.
If not specified, the Locale returned by FacesContext.getViewRoot().getLocale()
will be used.
|
|
maxFractionDigits
|
int
|
Yes
|
Maximum number of digits that will be formatted in the fractional portion of the
output.
|
|
maxIntegerDigits
|
int
|
Yes
|
Maximum number of digits that will be formatted in the integer portion of the
output.
|
|
minFractionDigits
|
int
|
Yes
|
Minimum number of digits that will be formatted in the fractional portion of
the output.
|
|
minIntegerDigits
|
int
|
Yes
|
Minimum number of digits that will be formatted in the integer portion of the
output.
|
|
pattern
|
String
|
Yes
|
Custom formatting pattern which determins how the number string should be
formatted and parsed.
|
|
type
|
String
|
Yes
|
Specifies how the number string will be formatted and parsed.
Valid values are "number", "currency", and "percent".
Default value is "number".
|