Package quadbase.util

Class LocaleNumericFormat

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

public class LocaleNumericFormat extends 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:
  • Field Details

  • Method Details

    • setLocale

      public void setLocale(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 String format(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(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(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(Locale locale)
      Create an instance of percentage format for the specified locale.
      Parameters:
      locale - the specified locale
      Returns:
      The new instance
    • getNumberFormat

      public 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: