|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
The TextModel
is a foundation model for MapperXML. The
TextModel
provides access to the internal "state" or value
via the getText
and setText
methods. It is the
responsibility of theses methods to provide any required parsing or
formatting as they transform the value between its String
representation and actual internal representation (int
,
Date
, BigDecimal
, etc). There are 2 properties
which govern the parse/format process: format
and
formatPattern
. These use the standard
java.text.Format
objects and patterns.
The TextModel
uses a ValueHolder
to hold the
actual "state" or value. A ValueHolder
can provide storage for
any data type. Implementations of the TextModel
can create and
use their own internal ValueHolder
. They can also be assigned
an external ValueHolder
to use. Multiple TextModels
can share the same ValueHolder
. A specific property of the
ValueHolder
host object can also be targeted. The target property
can be specified by setting the propertyName
property. (Note:
the ValueHolder
itself must be one that actually supports
access to individual properties for this feature to work, otherwise the
propertyName
setting is ignored).
The TextModel
also provides notification to
ChangeListeners
whenever the "state" or value changes. Interested
listeners can register or unregister to receive notification of
ChangeEvents
by using the addChangeListener
or
removeChangeListener
methods.
Method Summary | |
void |
addChangeListener(javax.swing.event.ChangeListener l)
Adds the specified change listener to receive change events from this text model. |
java.text.Format |
getFormat()
Returns the Format to be used by the model or null if undefined. |
java.lang.String |
getFormatPattern()
Returns the pattern used by the format |
java.lang.String |
getPropertyName()
Returns the ValueObject's propertyName where the model value is stored. |
java.lang.String |
getText()
Returns the model value as a String (using Format if defined) |
ValueHolder |
getValueHolder()
Returns the valueHolder used by the model for storing the value. |
void |
removeChangeListener(javax.swing.event.ChangeListener l)
Removes the specified change listener so that it no longer receives change events from this text model. |
void |
setFormat(java.text.Format format)
Sets the Format to be used by the model or null if undefined. |
void |
setFormatPattern(java.lang.String newPattern)
Sets the pattern used by the format |
void |
setPropertyName(java.lang.String newPropertyName)
Sets the ValueObject's propertyName where the model value is stored. |
void |
setText(java.lang.String text)
Parses the given String (using Format if defined) and sets model value. |
void |
setValueHolder(ValueHolder newValueHolder)
Sets the valueHolder used by the model for storing the value. |
Method Detail |
public java.lang.String getText() throws ModelException
ModelException
public void setText(java.lang.String text) throws ModelException
ModelException
public java.text.Format getFormat()
public void setFormat(java.text.Format format)
public java.lang.String getFormatPattern()
public void setFormatPattern(java.lang.String newPattern)
public void setValueHolder(ValueHolder newValueHolder)
public ValueHolder getValueHolder()
public void setPropertyName(java.lang.String newPropertyName)
public java.lang.String getPropertyName()
public void removeChangeListener(javax.swing.event.ChangeListener l)
public void addChangeListener(javax.swing.event.ChangeListener l)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |