EspressReport 6.6

quadbase.util
Class LocaleNumericFormat

java.lang.Object
  extended by quadbase.util.LocaleNumericFormat
All Implemented Interfaces:
IFormat

public class LocaleNumericFormat
extends java.lang.Object
implements IFormat

This class formats and parses numbers in a locale-specific way. Because it is a wrapper class of java.text.NumberFormat, it is not intended for displaying very large or very small numbers that require exponential notation. Please use quadbase.util.NumberFormat for these cases. This class cannot directly extand java.text.NumberFormat because java.text.NumberFormat is an abstract class. All formats implement quadbase.util.IFormat. Please use quadbase.util.IDataPointSet.setLabelFormat(int colIndex, IFormat format) to set the label format of a data column.

See Also:
NumericFormat, DateTimeFormat, LocaleDateTimeFormat, LogicalFormat, IFormat

Field Summary
static int CURRENCY
           
static int NUMBER
           
static int PERCENT
           
 
Fields inherited from interface quadbase.util.IFormat
DATETIME, LOCALEDATETIME, LOCALENUMERIC, LOGICAL, NUMERIC
 
Method Summary
 java.lang.String format(java.lang.Object obj)
          Define quadbase.util.IFormat.
static LocaleNumericFormat getCurrencyInstance()
          Create an instance of currency format for the default locale.
static LocaleNumericFormat getCurrencyInstance(java.util.Locale locale)
          Create an instance of currency format for the specified locale.
 int getFormatType()
          Define quadbase.util.IFormat.
 int getInstanceType()
          Get the type of the instance.
 java.text.NumberFormat getNumberFormat()
          /** This method returns the java object from LocaleNumberFormat, and the returned value can later be used to setup the format of the current instance.
static LocaleNumericFormat getNumberInstance()
          Create an instance of numeric format for the default locale.
static LocaleNumericFormat getNumberInstance(java.util.Locale locale)
          Create an instance of numeric format for the specified locale.
static LocaleNumericFormat getPercentInstance()
          Create an instance of percentage format for the default locale.
static LocaleNumericFormat getPercentInstance(java.util.Locale locale)
          Create an instance of percentage format for the specified locale.
 void setFormat(LocaleNumericFormat obj)
          Copy the following attributes of the object to this: maximum fraction digits, minimum fraction digits, maximum integer digits, minimum integer digits, grouping and parse integer only.
 void setLocale(java.util.Locale locale)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CURRENCY

public static final int CURRENCY
See Also:
Constant Field Values

NUMBER

public static final int NUMBER
See Also:
Constant Field Values

PERCENT

public static final int PERCENT
See Also:
Constant Field Values
Method Detail

setLocale

public void setLocale(java.util.Locale locale)

getFormatType

public int getFormatType()
Define quadbase.util.IFormat. Return the type of quadbase.util.IFormat.

Specified by:
getFormatType in interface IFormat
Returns:
IFormat.LOCALENUMERIC

format

public java.lang.String format(java.lang.Object obj)
Define quadbase.util.IFormat. Call the appropiate format(...) method in java.text.NumberFormat and return a formatted string. If the object is not an instance of java.lang.Number, call the default toString() method.

Specified by:
format in interface IFormat
Parameters:
obj - The target object
Returns:
Formatted string

getCurrencyInstance

public static LocaleNumericFormat getCurrencyInstance()
Create an instance of currency format for the default locale.

Returns:
The new instance

getCurrencyInstance

public static LocaleNumericFormat getCurrencyInstance(java.util.Locale locale)
Create an instance of currency format for the specified locale.

Parameters:
locale - the specified locale
Returns:
The new instance

getNumberInstance

public static LocaleNumericFormat getNumberInstance()
Create an instance of numeric format for the default locale.

Returns:
The new instance

getNumberInstance

public static LocaleNumericFormat getNumberInstance(java.util.Locale locale)
Create an instance of numeric format for the specified locale.

Parameters:
locale - the specified locale
Returns:
The new instance

getPercentInstance

public static LocaleNumericFormat getPercentInstance()
Create an instance of percentage format for the default locale.

Returns:
The new instance

getPercentInstance

public static LocaleNumericFormat getPercentInstance(java.util.Locale locale)
Create an instance of percentage format for the specified locale.

Parameters:
locale - the specified locale
Returns:
The new instance

getNumberFormat

public java.text.NumberFormat getNumberFormat()
/** This method returns the java object from LocaleNumberFormat, and the returned value can later be used to setup the format of the current instance.

Returns:
The object to change the format

getInstanceType

public int getInstanceType()
Get the type of the instance.

Returns:
CURRENCY, NUMBER or PERCENT

setFormat

public void setFormat(LocaleNumericFormat obj)
Copy the following attributes of the object to this: maximum fraction digits, minimum fraction digits, maximum integer digits, minimum integer digits, grouping and parse integer only.

Parameters:
obj - Another LocaleNumericFormat instance
See Also:
NumberFormat

EspressReport 6.6