|
ReportMill 10 API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.text.Format
java.text.NumberFormat
java.text.DecimalFormat
com.reportmill.base.RMNumberFormat
public class RMNumberFormat
This subclass extends DecimalFormat to implement ReportMill's RMFormat interface and to support the extended features "Negative in Red" and "Null String". It also has a toPattern like method, getFormatString, for the purposes of archival. Those getFormatString/setFormatString support arbitrary decimal and grouping separators. This may be dangerous since when people use the default English versions of those, I think they change depeding on the default JVM Locale. Only dangerous if someone wants to generate English Separators from a foreign local, I guess. Also, our modified pattern format can be ambiguous if either decimal or grouping separator not included. In this case we assume any separator preceeded by a '0' is the decimal separator. This seems reasonable since a decimal separator preceeded by # could result in an empty string or a fractional number with no leading zero (like ".123" instead of "0.123") which seems somewhat rare. And also a grouping separator preceeded by 0 seems somewhat rare because it could result in a long zero string like "0,000". I suppose we should instead have a syntax explicity declaring decimal and group separators: "$ #,##0.00;ds=,;gs=.".
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.text.NumberFormat |
---|
java.text.NumberFormat.Field |
Field Summary | |
---|---|
static RMNumberFormat |
BASIC
|
static RMNumberFormat |
CURRENCY
|
static RMNumberFormat |
DOLLARS
|
static RMNumberFormat |
PLAIN
|
Fields inherited from class java.text.NumberFormat |
---|
FRACTION_FIELD, INTEGER_FIELD |
Constructor Summary | |
---|---|
RMNumberFormat()
Creates an uninitialized number format. |
|
RMNumberFormat(RMNumberFormat aFormat)
Creates a number format identical to the given format. |
|
RMNumberFormat(java.lang.String aFormatString)
Creates a number format for the given format string. |
Method Summary | |
---|---|
boolean |
equals(java.lang.Object anObj)
Standard equals implementation. |
java.lang.Object |
formatRM(java.lang.Object anObj)
Returns a formatted version of the given object. |
java.lang.Object |
fromXML(com.reportmill.archiver.RXArchiver anArchiver,
com.reportmill.archiver.RXElement anElement)
XML unarchival. |
java.lang.String |
getDecimalSeparator()
Returns the decimal separator. |
java.lang.String |
getFormatString()
Returns the format string for this format. |
java.lang.String |
getLocalCurrencySymbol()
Returns the Currency symbol used for this locale. |
java.lang.String |
getNullString()
Returns the String that is substituted when this format is asked to provide stringForObjectValue(null). |
java.lang.String |
getThousandsSeparator()
Returns the thousands separator. |
boolean |
isCurrencySymbolUsed()
Returns whether currency symbol is used (dollars, local or international). |
boolean |
isLocalCurrencySymbolUsed()
Returns whether local currency symbol is used. |
boolean |
isNegativeInRed()
Returns whether this format shows negative values in red. |
boolean |
isPercentSymbolUsed()
Returns whether percent symbol is used. |
void |
setDecimalSeparator(java.lang.String aValue)
Sets the decimal separator. |
void |
setFormatString(java.lang.String aFormat)
Sets the format string for this format. |
void |
setLocalCurrencySymbolUsed(boolean aFlag)
Sets whether local currency symbol is used. |
void |
setNegativeInRed(boolean aFlag)
Sets whether this format shows negative values in red. |
void |
setNullString(java.lang.String aString)
Sets the String that is substituted when this format is asked to provide stringForObjectValue(null). |
void |
setPercentSymbolUsed(boolean aFlag)
Returns whether percent symbol is used. |
void |
setThousandsSeparator(java.lang.String aValue)
Sets the thousands separator. |
com.reportmill.archiver.RXElement |
toXML(com.reportmill.archiver.RXArchiver anArchiver)
XML archival. |
Methods inherited from class java.text.DecimalFormat |
---|
applyLocalizedPattern, applyPattern, clone, format, format, format, formatToCharacterIterator, getCurrency, getDecimalFormatSymbols, getGroupingSize, getMaximumFractionDigits, getMaximumIntegerDigits, getMinimumFractionDigits, getMinimumIntegerDigits, getMultiplier, getNegativePrefix, getNegativeSuffix, getPositivePrefix, getPositiveSuffix, hashCode, isDecimalSeparatorAlwaysShown, isParseBigDecimal, parse, setCurrency, setDecimalFormatSymbols, setDecimalSeparatorAlwaysShown, setGroupingSize, setMaximumFractionDigits, setMaximumIntegerDigits, setMinimumFractionDigits, setMinimumIntegerDigits, setMultiplier, setNegativePrefix, setNegativeSuffix, setParseBigDecimal, setPositivePrefix, setPositiveSuffix, toLocalizedPattern, toPattern |
Methods inherited from class java.text.NumberFormat |
---|
format, format, getAvailableLocales, getCurrencyInstance, getCurrencyInstance, getInstance, getInstance, getIntegerInstance, getIntegerInstance, getNumberInstance, getNumberInstance, getPercentInstance, getPercentInstance, isGroupingUsed, isParseIntegerOnly, parse, parseObject, setGroupingUsed, setParseIntegerOnly |
Methods inherited from class java.text.Format |
---|
format, parseObject |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static RMNumberFormat PLAIN
public static RMNumberFormat BASIC
public static RMNumberFormat DOLLARS
public static RMNumberFormat CURRENCY
Constructor Detail |
---|
public RMNumberFormat()
public RMNumberFormat(java.lang.String aFormatString)
public RMNumberFormat(RMNumberFormat aFormat)
Method Detail |
---|
public java.lang.String getNullString()
public void setNullString(java.lang.String aString)
public boolean isNegativeInRed()
public void setNegativeInRed(boolean aFlag)
public java.lang.String getLocalCurrencySymbol()
public boolean isLocalCurrencySymbolUsed()
public void setLocalCurrencySymbolUsed(boolean aFlag)
public boolean isCurrencySymbolUsed()
public boolean isPercentSymbolUsed()
public void setPercentSymbolUsed(boolean aFlag)
public java.lang.String getThousandsSeparator()
public void setThousandsSeparator(java.lang.String aValue)
public java.lang.String getDecimalSeparator()
public void setDecimalSeparator(java.lang.String aValue)
public java.lang.String getFormatString()
getFormatString
in interface RMFormat
public void setFormatString(java.lang.String aFormat)
setFormatString
in interface RMFormat
public java.lang.Object formatRM(java.lang.Object anObj)
formatRM
in interface RMFormat
public boolean equals(java.lang.Object anObj)
equals
in class java.text.DecimalFormat
public com.reportmill.archiver.RXElement toXML(com.reportmill.archiver.RXArchiver anArchiver)
toXML
in interface RMFormat
public java.lang.Object fromXML(com.reportmill.archiver.RXArchiver anArchiver, com.reportmill.archiver.RXElement anElement)
fromXML
in interface RMFormat
|
ReportMill 10 API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |