|
Project Wonder 2.0 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.text.Format com.webobjects.foundation.NSNumberFormatter er.extensions.ERXNumberFormatter
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.
Nested Class Summary |
Nested classes inherited from class java.text.Format |
Format.Field |
Field Summary | |
protected static String |
DefaultKey
|
Fields inherited from class com.webobjects.foundation.NSNumberFormatter |
_CLASS, _CurrencyPattern, _DecimalPattern, _IntegerPattern, DefaultPattern, NSDecimalNotANumber, RoundBankers, RoundDown, RoundPlain, RoundUp |
Constructor Summary | |
ERXNumberFormatter()
|
|
ERXNumberFormatter(String pattern)
Public constructor |
Method Summary | |
static Format |
defaultNumberFormatterForObject(Object object)
|
StringBuffer |
format(Object value,
StringBuffer buffer,
FieldPosition position)
Overridden to perform optional conversions on the value given. |
static NSNumberFormatter |
numberFormatterForPattern(String pattern)
Returns a shared instance for the specified pattern. |
Object |
parseObject(String aString)
Strips out the ignored characters and optionally performs an operation on the value from the string to be parsed. |
protected BigDecimal |
performFormat(BigDecimal value)
Override this in your subclass to provide for other operations when formatting a value. |
protected BigDecimal |
performParse(BigDecimal value)
Override this in your subclass to provide for other operations when parsing a value. |
protected void |
setFactor(BigDecimal value)
|
void |
setIgnoredChars(String value)
|
static void |
setNumberFormatterForPattern(NSNumberFormatter formatter,
String pattern)
Sets a shared instance for the specified pattern. |
protected void |
setOperator(String value)
|
void |
setPattern(String pattern)
Overridden to search the pattern for operators and factors. |
protected void |
setScale(Integer value)
|
static NSNumberFormatter |
sharedInstance()
Returns the default shared instance |
Methods inherited from class java.text.Format |
clone, format, formatToCharacterIterator |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected static final String DefaultKey
Constructor Detail |
public ERXNumberFormatter(String pattern)
public ERXNumberFormatter()
Method Detail |
public static NSNumberFormatter sharedInstance()
public static Format defaultNumberFormatterForObject(Object object)
object
-
public static NSNumberFormatter numberFormatterForPattern(String pattern)
public static void setNumberFormatterForPattern(NSNumberFormatter formatter, String pattern)
public void setIgnoredChars(String value)
protected void setFactor(BigDecimal value)
protected void setOperator(String value)
protected void setScale(Integer value)
public void setPattern(String pattern)
'(' . operatorChar . factor . [';' scale ] . '=)' normalFormatterString
NSNumberFormatter.setPattern(java.lang.String)
protected BigDecimal performFormat(BigDecimal value)
value
-
protected BigDecimal performParse(BigDecimal value)
value
-
public Object parseObject(String aString) throws ParseException
aString
- to be parsed
ParseException
public StringBuffer format(Object value, StringBuffer buffer, FieldPosition position)
Format.format(java.lang.Object, java.lang.StringBuffer, java.text.FieldPosition)
|
Last updated: Do, Dez 9, 2004 12:46 PM CET | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |