EspressReport 6.6

quadbase.reportdesigner.util
Class LocaleNumericFormat

java.lang.Object
  extended by quadbase.reportdesigner.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.reportdesigner.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.reportdesigner.util.IFormat. Please use quadbase.reportdesigner.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
          Currency format
static int NUMBER
          Number format
static int PERCENT
          Percent format
 
Fields inherited from interface quadbase.reportdesigner.util.IFormat
BARCODE, DATETIME, IMAGEURL, LOCALEDATETIME, LOCALENUMERIC, LOGICAL, NUMERIC, STRING, TEXTURL
 
Method Summary
static LocaleNumericFormat createFormat(java.lang.String text)
          For internal use only.
 java.lang.String format(java.lang.Object obj)
          Define quadbase.reportdesigner.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.reportdesigner.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.
 java.lang.String getTextFormat()
          For internal use only.
 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)
          Sets the format 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
Currency format

See Also:
Constant Field Values

NUMBER

public static final int NUMBER
Number format

See Also:
Constant Field Values

PERCENT

public static final int PERCENT
Percent format

See Also:
Constant Field Values
Method Detail

setLocale

public void setLocale(java.util.Locale locale)
Sets the format locale

Parameters:
locale - The locale to become this format locale.

getFormatType

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

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

format

public java.lang.String format(java.lang.Object obj)
Define quadbase.reportdesigner.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 of currency format

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 of currency format

getNumberInstance

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

Returns:
The new instance of numeric format

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 numeric format

getPercentInstance

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

Returns:
The new instance of percentage format

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 of percentage format

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

getTextFormat

public java.lang.String getTextFormat()
For internal use only.

Specified by:
getTextFormat in interface IFormat

createFormat

public static LocaleNumericFormat createFormat(java.lang.String text)
                                        throws java.lang.Exception
For internal use only.

Throws:
java.lang.Exception

EspressReport 6.6