Package quadbase.reportdesigner.util
Class LocaleNumericFormat
java.lang.Object
quadbase.reportdesigner.util.LocaleNumericFormat
- All Implemented Interfaces:
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:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intCurrency formatstatic final intNumber formatstatic final intPercent formatFields inherited from interface quadbase.reportdesigner.util.IFormat
BARCODE, DATETIME, IMAGEURL, LOCALEDATETIME, LOCALENUMERIC, LOGICAL, NUMERIC, STRING, TEXTURL -
Method Summary
Modifier and TypeMethodDescriptionstatic LocaleNumericFormatcreateFormat(String text) For internal use only.Define quadbase.reportdesigner.util.IFormat.static LocaleNumericFormatCreate an instance of currency format for the default locale.static LocaleNumericFormatgetCurrencyInstance(Locale locale) Create an instance of currency format for the specified locale.intDefine quadbase.reportdesigner.util.IFormat.intGet the type of the instance.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 LocaleNumericFormatCreate an instance of numeric format for the default locale.static LocaleNumericFormatgetNumberInstance(Locale locale) Create an instance of numeric format for the specified locale.static LocaleNumericFormatCreate an instance of percentage format for the default locale.static LocaleNumericFormatgetPercentInstance(Locale locale) Create an instance of percentage format for the specified locale.For internal use only.voidCopy 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.voidSets the format locale
-
Field Details
-
CURRENCY
public static final int CURRENCYCurrency format- See Also:
-
NUMBER
public static final int NUMBERNumber format- See Also:
-
PERCENT
public static final int PERCENTPercent format- See Also:
-
-
Method Details
-
setLocale
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:
getFormatTypein interfaceIFormat- Returns:
- IFormat.LOCALENUMERIC
-
format
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. -
getCurrencyInstance
Create an instance of currency format for the default locale.- Returns:
- The new instance of currency format
-
getCurrencyInstance
Create an instance of currency format for the specified locale.- Parameters:
locale- the specified locale- Returns:
- The new instance of currency format
-
getNumberInstance
Create an instance of numeric format for the default locale.- Returns:
- The new instance of numeric format
-
getNumberInstance
Create an instance of numeric format for the specified locale.- Parameters:
locale- the specified locale- Returns:
- The new instance numeric format
-
getPercentInstance
Create an instance of percentage format for the default locale.- Returns:
- The new instance of percentage format
-
getPercentInstance
Create an instance of percentage format for the specified locale.- Parameters:
locale- the specified locale- Returns:
- The new instance of percentage format
-
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
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:
-
getTextFormat
For internal use only.- Specified by:
getTextFormatin interfaceIFormat
-
createFormat
For internal use only.- Throws:
Exception
-