ERXNumberFormatter Class Reference

Inherits com::webobjects::foundation::NSNumberFormatter.

Collaboration diagram for ERXNumberFormatter:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 ERXNumberFormatter ()
 ERXNumberFormatter (String pattern)
StringBuffer format (Object value, StringBuffer buffer, FieldPosition position)
Object parseObject (String aString) throws java.text.ParseException
void setIgnoredChars (String value)
void setPattern (String pattern)

Static Public Member Functions

static Format defaultNumberFormatterForObject (Object object)
static NSNumberFormatter numberFormatterForPattern (String pattern)
static void setNumberFormatterForPattern (NSNumberFormatter formatter, String pattern)
static NSNumberFormatter sharedInstance ()

Protected Member Functions

BigDecimal performFormat (BigDecimal value)
BigDecimal performParse (BigDecimal value)
void setFactor (BigDecimal value)
void setOperator (String value)
void setScale (Integer value)

Static Protected Attributes

static final String DefaultKey = "ERXNumberFormatter.DefaultKey"

Static Package Functions

 [static initializer]

Private Attributes

BigDecimal _factor
String _ignoredChars = ERXProperties.stringForKeyWithDefault("er.extensions.ERXNumberFormatter.ignoredChars", "%$")
String _operator
Integer _scale

Static Private Attributes

static Hashtable _repository = new Hashtable()


Detailed Description

An extension to the number formatter. It will strip out the characters '%$,' when parsing a string and can scale values by setting a pattern like (/1024=)0.00 KB which will divide the actual value by 1024 or (*60;4=)0.00 which will multiply the actual value by 60. When used for parsing, the resulting value will be scaled to a scale of 4. So when the real value is 0.0165, the display value will be 0.99 and when this is re-entered, the resulting value will again be 0.0165.

Constructor & Destructor Documentation

ERXNumberFormatter ( String  pattern  ) 

Public constructor


Member Function Documentation

[static initializer] (  )  [static, package]

static Format defaultNumberFormatterForObject ( Object  object  )  [static]

Parameters:
object 

StringBuffer format ( Object  value,
StringBuffer  buffer,
FieldPosition  position 
)

Overridden to perform optional conversions on the value given.

See also:
java.text.Format.format(java.lang.Object, java.lang.StringBuffer, java.text.FieldPosition)

static NSNumberFormatter numberFormatterForPattern ( String  pattern  )  [static]

Returns a shared instance for the specified pattern.

Returns:
shared instance of formatter

Object parseObject ( String  aString  )  throws java.text.ParseException

Strips out the ignored characters and optionally performs an operation on the value from the string to be parsed.

Parameters:
aString to be parsed
Returns:
the parsed object

BigDecimal performFormat ( BigDecimal  value  )  [protected]

Override this in your subclass to provide for other operations when formatting a value.

Parameters:
value 

BigDecimal performParse ( BigDecimal  value  )  [protected]

Override this in your subclass to provide for other operations when parsing a value.

Parameters:
value 

void setFactor ( BigDecimal  value  )  [protected]

void setIgnoredChars ( String  value  ) 

static void setNumberFormatterForPattern ( NSNumberFormatter  formatter,
String  pattern 
) [static]

Sets a shared instance for the specified pattern.

void setOperator ( String  value  )  [protected]

void setPattern ( String  pattern  ) 

Overridden to search the pattern for operators and factors. The pattern should be '(' . operatorChar . factor . [';' scale ] . '=)' normalFormatterString

See also:
com.webobjects.foundation.NSNumberFormatter.setPattern(java.lang.String)

void setScale ( Integer  value  )  [protected]

static NSNumberFormatter sharedInstance (  )  [static]

Returns the default shared instance

Returns:
shared instance


Member Data Documentation

BigDecimal _factor [private]

String _ignoredChars = ERXProperties.stringForKeyWithDefault("er.extensions.ERXNumberFormatter.ignoredChars", "%$") [private]

String _operator [private]

Hashtable _repository = new Hashtable() [static, private]

holds a reference to the repository

Integer _scale [private]

final String DefaultKey = "ERXNumberFormatter.DefaultKey" [static, protected]


The documentation for this class was generated from the following file:

Generated on Sat May 26 06:43:12 2012 for Project Wonder by  doxygen 1.5.8