public class ValueState extends SimpleState implements MutableState, ChangeListener
mInSetEnabled
mIsEnabled, mIsInitialized, mListenerList, mName, mReason
Constructor and Description |
---|
ValueState(ValueModel<?> pModel)
We wrap a ValueModel as a MutableState object.
|
Modifier and Type | Method and Description |
---|---|
Boolean |
getMeaningOfNull() |
void |
reset()
Resets a MutableState to not initilized.
|
void |
setEnabled(boolean pEnabled)
Sets the state, the wrapped ValueModel will be set to Boolean.TRUE or Boolean.FALSE.
|
void |
setEnabled(boolean pEnabled,
Object pReason)
Sets the state with a reason object.
|
void |
setMeaningOfNull(Boolean pMeaningOfNull)
configures the behaviour of the state when the
value model has the value null.
|
void |
stateChanged(ChangeEvent pEvent)
Invoked when the target of the listener has changed its state.
|
inSetEnabled
addChangeListener, checkDisposed, dispose, fireStateChanged, getChangeReason, getDependents, getName, isDisposed, isEnabled, isInitialized, removeChangeListener, setName, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addChangeListener, dispose, getChangeReason, getDependents, getName, isDisposed, isEnabled, isInitialized, removeChangeListener, setName
public ValueState(ValueModel<?> pModel)
pModel
- model we wrap, must not be nullIllegalArgumentException
- if pModel is nullpublic void setEnabled(boolean pEnabled)
setEnabled
in interface MutableState
setEnabled
in class SimpleState
pEnabled
- true if the state gets enabledpublic void setEnabled(boolean pEnabled, Object pReason)
setEnabled
in interface MutableState
setEnabled
in class SimpleState
pEnabled
- true if the state gets enabledpReason
- null or reason for the changepublic void reset()
reset
in interface MutableState
reset
in class SimpleState
public void setMeaningOfNull(Boolean pMeaningOfNull)
AbstractState.isInitialized()
.
If the parameter is Boolean.TRUE
, then a value of null
in the value model means that the state is enabled.
If the parameter is Boolean.FALSE
, then a value of null
in the value model means that the state is disabled.pMeaningOfNull
- the meaning of nullpublic Boolean getMeaningOfNull()
setMeaningOfNull(Boolean)
public void stateChanged(ChangeEvent pEvent)
stateChanged
in interface ChangeListener
pEvent
- a ChangeEvent objectCopyright © 2017 Jürgen Zeller (privat). All rights reserved.