T
- the type we contain as our valuepublic interface ValueModel<T>
Modifier and Type | Method and Description |
---|---|
void |
addChangeListener(ChangeListener pDependent)
Add an dependent listener to a ValueModel, "Java style".
|
boolean |
booleanValue()
Converts our value to a boolean.
|
void |
dispose()
Cleanup all resources: disconnect from any input sources (like
other ValueModel's ...), and remove all listeners.
Any method besides isDisposed, dispose or getName will throw an IllegalStateException after the ValueModel was disposed. |
double |
doubleValue()
Converts our value to a double.
|
float |
floatValue()
Converts our value to a float.
|
List<Object> |
getDependents()
Return a immutable list of all direct dependents of the value model.
|
String |
getName()
Return the name of the state.
|
T |
getValue()
Get the current value, during a callback this is the new value.
|
int |
intValue()
Converts our value to an int.
|
boolean |
isDisposed()
Check if the value model is disposed.
|
boolean |
isEditable()
Returns true if a setValue() is possible, and doesn't throw an
UnsupportedOperationException,
|
boolean |
isSetForced()
Returns true if setValueForced() was called, only useful during a callback.
|
long |
longValue()
Converts our value to an long.
|
void |
onChangeSend(Object pDependent,
String pMethodName)
Add an dependent listener to a ValueModel, "Smalltalk style".
|
void |
removeChangeListener(ChangeListener pDependent)
Remove a dependent listener, "Java style".
|
void |
retractInterestsFor(Object pDependent)
Remove a dependent listener, "Smalltalk style".
|
void |
setName(String pName)
Set the name of the state.
|
void |
setObjectValue(Object pValue)
Needed since we generified everything, if we have no type given.
|
void |
setValue(boolean pValue)
Converts the given
boolean to an object and
sets it as new value. |
void |
setValue(double pValue)
Converts the given
double to an object and
sets it as new value. |
void |
setValue(float pValue)
Converts the given
float to an object and
sets it as new value. |
void |
setValue(int pValue)
Converts the given
int to an object and
sets it as new value. |
void |
setValue(long pValue)
Converts the given
long to an object and
sets it as new value. |
void |
setValue(T pValue)
Set a new value in this model.
|
void |
setValue(T pValue,
boolean pIsSetForced)
Set a new value, either forced or without force.
|
void |
setValueForced(T pValue)
Set a new value in this model.
|
String |
stringValue()
Converts our value to a String.
|
T getValue()
void setValue(T pValue)
pValue
- the new value (null is o.k.)UnsupportedOperationException
- if this ValueModel is not mutablevoid setObjectValue(Object pValue)
pValue
- the value to be casted and set as new valuevoid setValueForced(T pValue)
pValue
- the new value (null is o.k.)UnsupportedOperationException
- if this ValueModel is not mutablevoid setValue(T pValue, boolean pIsSetForced)
pValue
- the new value (null is o.k.)pIsSetForced
- true if a forced setValue should be done (see
#setValueForced for details)UnsupportedOperationException
- if this ValueModel is not mutableboolean isSetForced()
boolean isEditable()
void onChangeSend(Object pDependent, String pMethodName)
pDependent
- the object to callpMethodName
- the method name to call backIllegalArgumentException
- if pDependent or pMethod is null,
or no method with the signature
"public void pMethodName(ChangeEvent e)"
is found for pDependent.void addChangeListener(ChangeListener pDependent)
pDependent
- the object to callIllegalArgumentException
- if pDependent is nullvoid retractInterestsFor(Object pDependent)
pDependent
- object to de-registervoid removeChangeListener(ChangeListener pDependent)
pDependent
- object to de-registervoid dispose()
boolean isDisposed()
List<Object> getDependents()
String getName()
void setName(String pName)
pName
- the name of the state (must not be null)IllegalArgumentException
- if pState is nullboolean booleanValue()
NumberFormatException
- if the value can't be converted to a booleanvoid setValue(boolean pValue)
boolean
to an object and
sets it as new value.pValue
- the value to be converted and set as new valueint intValue()
NumberFormatException
- if the value can't be converted to a intvoid setValue(int pValue)
int
to an object and
sets it as new value.pValue
- the value to be converted and set as new valuelong longValue()
NumberFormatException
- if the value can't be converted to a longvoid setValue(long pValue)
long
to an object and
sets it as new value.pValue
- the value to be converted and set as new valuefloat floatValue()
NumberFormatException
- if the value can't be converted to a floatvoid setValue(float pValue)
float
to an object and
sets it as new value.pValue
- the value to be converted and set as new valuedouble doubleValue()
NumberFormatException
- if the value can't be converted to a doublevoid setValue(double pValue)
double
to an object and
sets it as new value.pValue
- the value to be converted and set as new valueString stringValue()
Copyright © 2017 Jürgen Zeller (privat). All rights reserved.