|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.beanfabrics.AbstractBean
org.beanfabrics.ValidatableBean
org.beanfabrics.model.AbstractPM
org.beanfabrics.model.AbstractValuePM
org.beanfabrics.model.TextPM
org.beanfabrics.model.BigDecimalPM
public class BigDecimalPM
The BigDecimalPM
is a PresentationModel
that contains a
BigDecimal
value.
This class is the base class for any other 'numeric' presentation models in
Beanfabrics since it has the most generic validation rule (see
BigDecimalPM.BigDecimalValidationRule
) and content conversion methods.
Nested Class Summary | |
---|---|
protected class |
BigDecimalPM.BigDecimalComparable
The BigDecimalPM.BigDecimalComparable delegates the comparison to the model's
BigDecimal value if available, or otherwise falls back to the
super.compareTo(...) |
class |
BigDecimalPM.BigDecimalValidationRule
This rule evaluates to invalid if the PM's value can't be converted into a BigDecimal . |
static class |
BigDecimalPM.Format
The BigDecimalPM.Format is a IFormat for converting
between BigDecimal and String . |
Nested classes/interfaces inherited from class org.beanfabrics.model.TextPM |
---|
TextPM.DefaultOptionsValidationRule, TextPM.TextComparable |
Nested classes/interfaces inherited from class org.beanfabrics.model.AbstractValuePM |
---|
AbstractValuePM.MandatoryValidationRule |
Nested classes/interfaces inherited from class org.beanfabrics.model.AbstractPM |
---|
AbstractPM.PropertiesValidationRule |
Field Summary |
---|
Fields inherited from class org.beanfabrics.model.TextPM |
---|
KEY_MESSAGE_VALUE_NOT_AN_OPTION |
Fields inherited from class org.beanfabrics.model.AbstractValuePM |
---|
KEY_MESSAGE_MANDATORY |
Fields inherited from class org.beanfabrics.model.AbstractPM |
---|
KEY_MESSAGE_ONE_OR_MORE_INVALID |
Constructor Summary | |
---|---|
BigDecimalPM()
Constructs a BigDecimalPM . |
Method Summary | |
---|---|
protected IFormat<java.math.BigDecimal> |
createDefaultFormat()
Creates the default format for this PM. |
java.math.BigDecimal |
getBigDecimal()
Returns the value of this PM as a BigDecimal . |
java.math.BigInteger |
getBigInteger()
Returns the value of this PM as a BigInteger . |
java.lang.Comparable<?> |
getComparable()
Returns the comparable substitute. |
protected static java.text.DecimalFormat |
getDecimalFormat(java.util.Locale locale)
Factory method for creating a DecimalFormat for the specified
Locale . |
IFormat<java.math.BigDecimal> |
getFormat()
Returns the IFormat of this PM used for converting between
BigDecimal and String values. |
void |
reformat()
Reformats the text value by first parsing it and the formatting it using this PM's format. |
void |
setBigDecimal(java.math.BigDecimal value)
Sets the value of this PM to the given BigDecimal value. |
void |
setBigInteger(java.math.BigInteger value)
Sets the value of this PM to the giben BigInteger value. |
void |
setDefaultBigDecimal(java.math.BigDecimal value)
Sets the default value of this PM to the given BigDecimal value. |
void |
setDefaultBigInteger(java.math.BigInteger value)
Sets the default value of this PM to the given BigInteger value. |
void |
setFormat(IFormat<java.math.BigDecimal> newFormat)
Sets the format of this PM and reformats the text value. |
Methods inherited from class org.beanfabrics.model.TextPM |
---|
getDefaultText, getOptions, getText, getText, isEmpty, isModified, isRestrictedToOptions, preset, reset, setDefaultText, setOptions, setRestrictedToOptions, setText |
Methods inherited from class org.beanfabrics.model.AbstractValuePM |
---|
getDescription, getTitle, isEditable, isMandatory, revalidate, setDescription, setEditable, setMandatory, setTitle |
Methods inherited from class org.beanfabrics.model.AbstractPM |
---|
getContext, getSupportMap, revalidateProperties |
Methods inherited from class org.beanfabrics.ValidatableBean |
---|
getValidationState, getValidator, isValid, setValidationState |
Methods inherited from class org.beanfabrics.AbstractBean |
---|
addPropertyChangeListener, addPropertyChangeListener, equals, getPropertyChangeSupport, removePropertyChangeListener, removePropertyChangeListener |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.beanfabrics.model.ITextPM |
---|
getOptions, getText, isModified, preset, reset, setOptions, setText |
Methods inherited from interface org.beanfabrics.model.IValuePM |
---|
getDescription, getTitle, isEditable, isEmpty, isMandatory, setDescription, setEditable, setMandatory, setTitle |
Methods inherited from interface org.beanfabrics.Bean |
---|
addPropertyChangeListener, addPropertyChangeListener, getPropertyChangeSupport, removePropertyChangeListener, removePropertyChangeListener |
Methods inherited from interface org.beanfabrics.validation.Validatable |
---|
getValidationState, getValidator, isValid, revalidate |
Methods inherited from interface org.beanfabrics.support.Supportable |
---|
getSupportMap |
Methods inherited from interface org.beanfabrics.context.ContextOwner |
---|
getContext |
Constructor Detail |
---|
public BigDecimalPM()
BigDecimalPM
.
Method Detail |
---|
public void reformat()
reformat
in interface ITextPM
reformat
in class TextPM
#setFormat(DecimalFormat)
protected IFormat<java.math.BigDecimal> createDefaultFormat()
BigDecimalPM.Format
with the
default DecimalFormat
of the current Locale
.
protected static java.text.DecimalFormat getDecimalFormat(java.util.Locale locale)
DecimalFormat
for the specified
Locale
.
locale
-
DecimalFormat
.public IFormat<java.math.BigDecimal> getFormat()
IFormat
of this PM used for converting between
BigDecimal
and String
values.
public void setFormat(IFormat<java.math.BigDecimal> newFormat)
BigDecimal
and String
values.
newFormat
- the new formatpublic void setBigDecimal(java.math.BigDecimal value)
BigDecimal
value.
setBigDecimal
in interface IBigDecimalPM
ITextPM.setText(String)
public java.math.BigDecimal getBigDecimal() throws ConversionException
BigDecimal
.
getBigDecimal
in interface IBigDecimalPM
BigDecimal
ConversionException
- if the text value can't be converted into a
valid BigDecimal
public void setDefaultBigDecimal(java.math.BigDecimal value)
BigDecimal
value.
value
- TextPM.setDefaultText(String)
public void setBigInteger(java.math.BigInteger value)
BigInteger
value.
value
- TextPM.setText(String)
public java.math.BigInteger getBigInteger() throws ConversionException
BigInteger
.
BigInteger
ConversionException
- if the text value can't be converted into a
valid BigInteger
public void setDefaultBigInteger(java.math.BigInteger value)
BigInteger
value.
value
- TextPM.setDefaultText(String)
public java.lang.Comparable<?> getComparable()
TextPM
Override this method to control how instances of this class are sorted by a Sorter.
The default implementation returns a TextPM.TextComparable
or one of its subclasses.
getComparable
in interface HasComparable
getComparable
in class TextPM
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |