|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
CheckboxModel
is a model which maintains 2 states: selected
or unselected. The CheckboxModel
provides access to the internal
"state" or value via the setText
, getText
,
setSelected
and isSelected
methods.
The setSelected
should result in either the
selectedValue
(true) or unselectedValue
(false)
value being parsed and stored in the valueHolder
. The
isSelected
method should indicate whether or not the value
stored in the valueHolder
equals (or represents) the
selectedValue
.
It is the responsibility of the set/getText
methods to
provide any required parsing or formatting as they transform the value
between its String
representation and actual internal
representation (int
, Date
, boolean
,
etc). There are 2 properties which govern the parse/format process:
format
and formatPattern
. These use the standard
java.text.Format
objects and patterns.
If the setText
method is invoked directly, the value passed
to it must be equal to either the selectedValue
or
unselectedValue
, otherwise an
UnknownStateValueException
will occur.
This model supports null as the "unselected" state. This is accomplished
by setting the unselectedValue
to blank (""). A initial null
value in the value holder is treated as unselected by the isSelected and
getText methods.
Method Summary | |
java.lang.String |
getSelectedValue()
Get the value used to indicate a selected state. |
java.lang.String |
getText()
Returns text/display value of current state. |
java.lang.String |
getUnselectedValue()
Get the value used to indicate an unselected state. |
boolean |
isSelected()
Gets the current state as selected(true) or unselected(false). |
void |
setSelected(boolean newSelected)
Sets the current state as selected(true) or unselected(false). |
void |
setSelectedValue(java.lang.String newSelectedValue)
Set the value used to indicate a selected state. |
void |
setText(java.lang.String value)
Sets the current state by matching the given value to the selected or unselected values. |
void |
setUnselectedValue(java.lang.String newUnselectedValue)
Set the value used to indicate an unselected state. |
Methods inherited from interface com.taursys.model.TextModel |
addChangeListener, getFormat, getFormatPattern, getPropertyName, getValueHolder, removeChangeListener, setFormat, setFormatPattern, setPropertyName, setValueHolder |
Method Detail |
public java.lang.String getText() throws UnknownStateValueException, ModelException
getText
in interface TextModel
UnknownStateValueException
- if the given value does not match a
known state text value.
ModelException
- if problem while matching properties of valueHolder
object to list object.public void setText(java.lang.String value) throws UnknownStateValueException, ModelException
setText
in interface TextModel
UnknownStateValueException
- if the given value does not match a
known state text value.
ModelException
- if problem while setting properties of object in
valueHolder.public void setSelected(boolean newSelected) throws ModelException
ModelException
- if problem while setting properties of object in
valueHolder.public boolean isSelected() throws UnknownStateValueException, ModelException
UnknownStateValueException
- if the internal value does not match a
known state text value.
ModelException
- if problem while setting properties of object in
valueHolder.public void setSelectedValue(java.lang.String newSelectedValue)
newSelectedValue
- the value used to indicate a selected state.public java.lang.String getSelectedValue()
public void setUnselectedValue(java.lang.String newUnselectedValue)
newUnselectedValue
- the value used to indicate a unselected state.public java.lang.String getUnselectedValue()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |