Package quadbase.util
Class LocaleNumericFormat
java.lang.Object
quadbase.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.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:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intFields inherited from interface quadbase.util.IFormat
DATETIME, LOCALEDATETIME, LOCALENUMERIC, LOGICAL, NUMERIC -
Method Summary
Modifier and TypeMethodDescriptionDefine quadbase.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.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.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.void
-
Field Details
-
CURRENCY
public static final int CURRENCY- See Also:
-
NUMBER
public static final int NUMBER- See Also:
-
PERCENT
public static final int PERCENT- See Also:
-
-
Method Details
-
setLocale
-
getFormatType
public int getFormatType()Define quadbase.util.IFormat. Return the type of quadbase.util.IFormat.- Specified by:
getFormatTypein interfaceIFormat- Returns:
- IFormat.LOCALENUMERIC
-
format
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. -
getCurrencyInstance
Create an instance of currency format for the default locale.- Returns:
- The new instance
-
getCurrencyInstance
Create an instance of currency format for the specified locale.- Parameters:
locale- the specified locale- Returns:
- The new instance
-
getNumberInstance
Create an instance of numeric format for the default locale.- Returns:
- The new instance
-
getNumberInstance
Create an instance of numeric format for the specified locale.- Parameters:
locale- the specified locale- Returns:
- The new instance
-
getPercentInstance
Create an instance of percentage format for the default locale.- Returns:
- The new instance
-
getPercentInstance
Create an instance of percentage format for the specified locale.- Parameters:
locale- the specified locale- Returns:
- The new instance
-
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:
-