|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.taursys.model.DefaultTextModel com.taursys.model.DefaultCheckboxModel
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
method simply invokes the setText
method with either the selectedValue
or
unselectedValue
. The isSelected
method simply
invokes the getText
method and returns true if the value equals
the selectedValue
.
The set/getText
methods 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.
Constructor Summary | |
DefaultCheckboxModel()
Constructs a new DefaultCheckboxModel The default valueHolder for this model is a String VariantValueHolder. |
|
DefaultCheckboxModel(int javaDataType)
Constructs new DefaultCheckboxModel and sets valueHolder to a VariantValueHolder for given data type. |
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. |
java.lang.String |
toString()
Returns a string representation of this object. |
Methods inherited from class com.taursys.model.DefaultTextModel |
addChangeListener, createDefaultValueHolder, fireStateChanged, getFormat, getFormatPattern, getPropertyName, getValueHolder, removeChangeListener, setFormat, setFormatPattern, setPropertyName, setupFormat, setValueHolder, stateChanged |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface com.taursys.model.TextModel |
addChangeListener, getFormat, getFormatPattern, getPropertyName, getValueHolder, removeChangeListener, setFormat, setFormatPattern, setPropertyName, setValueHolder |
Constructor Detail |
public DefaultCheckboxModel()
public DefaultCheckboxModel(int javaDataType) throws UnsupportedDataTypeException
UnsupportedDataTypeException
- if invalid javaDataType is givenDataTypes
Method Detail |
public java.lang.String getText() throws UnknownStateValueException, ModelException
getText
in interface CheckboxModel
getText
in class DefaultTextModel
UnknownStateValueException
- if the given value does not match the
selected or unselected values.
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 CheckboxModel
setText
in class DefaultTextModel
UnknownStateValueException
- if the given value does not match the
selected or unselected values.
ModelException
- if problem while setting properties of object in
valueHolder.public void setSelected(boolean newSelected) throws ModelException
setSelected
in interface CheckboxModel
ModelException
- if problem while setting properties of object in
valueHolder.public boolean isSelected() throws UnknownStateValueException, ModelException
isSelected
in interface CheckboxModel
UnknownStateValueException
- if the given value does not match the
selected or unselected values.
ModelException
- if problem while setting properties of object in
valueHolder.public void setSelectedValue(java.lang.String newSelectedValue)
setSelectedValue
in interface CheckboxModel
newSelectedValue
- the value used to indicate a selected state.public java.lang.String getSelectedValue()
getSelectedValue
in interface CheckboxModel
public void setUnselectedValue(java.lang.String newUnselectedValue)
setUnselectedValue
in interface CheckboxModel
newUnselectedValue
- the value used to indicate a unselected state.public java.lang.String getUnselectedValue()
getUnselectedValue
in interface CheckboxModel
public java.lang.String toString()
toString
in class DefaultTextModel
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |