K
- the type of the value map keysV
- the type of values in this mappublic class DefaultValueMapEditModel<K,V> extends java.lang.Object implements ValueMapEditModel<K,V>
Modifier | Constructor and Description |
---|---|
protected |
DefaultValueMapEditModel(ValueMap<K,V> valueMap,
ValueMap.Validator validator) |
Modifier and Type | Method and Description |
---|---|
void |
addValueListener(K key,
EventDataListener<ValueChange<K,V>> listener)
Adds a listener notified each time the value associated with the given key changes
|
void |
addValueSetListener(K key,
EventDataListener<ValueChange<K,V>> listener)
Adds a listener notified each time the value associated with the given key is set via
ValueMapEditModel.put(Object, Object) , note that this event is only fired when the the value changes |
V |
get(K key)
Returns the value associated with the given key in the underlying value map
|
ValueMap.Validator |
getValidator() |
StateObserver |
getValidObserver() |
protected ValueMap<K,V> |
getValueMap() |
EventObserver<ValueChange<K,V>> |
getValueObserver() |
EventObserver<ValueChange<K,V>> |
getValueObserver(K key) |
boolean |
isNotNull(K key) |
boolean |
isNull(K key) |
boolean |
isNullable(K key) |
boolean |
isValid() |
boolean |
isValid(K key)
Returns true if the value associated with the given key is valid, using the
validate method |
void |
put(K key,
V value)
Sets the given value in the underlying value map
|
V |
remove(K key)
Removes the given value from the map
|
void |
removeValueListener(K key,
EventDataListener listener) |
void |
removeValueSetListener(K key,
EventDataListener listener) |
void |
validate()
Validates the current state of the ValueMap
|
void |
validate(java.util.Collection<? extends ValueMap<K,V>> valueMaps)
Validates the given ValueMaps
|
void |
validate(K key)
Checks if the value associated with the given key is valid, throws a ValidationException if not
|
void |
validate(ValueMap<K,V> valueMap)
Validates the current state of the given ValueMap
|
protected DefaultValueMapEditModel(ValueMap<K,V> valueMap, ValueMap.Validator validator)
valueMap
- the ValueMap to editvalidator
- the validatorpublic final V get(K key)
get
in interface ValueMapEditModel<K,V>
key
- the key of the value to retrievepublic final void put(K key, V value)
put
in interface ValueMapEditModel<K,V>
key
- the key to associate the given value withvalue
- the value to associate with the given keypublic final V remove(K key)
remove
in interface ValueMapEditModel<K,V>
key
- the key associated with the value to removepublic final boolean isNullable(K key)
isNullable
in interface ValueMapEditModel<K,V>
key
- the keypublic final boolean isNull(K key)
isNull
in interface ValueMapEditModel<K,V>
key
- the keypublic boolean isNotNull(K key)
isNotNull
in interface ValueMapEditModel<K,V>
key
- the keypublic final StateObserver getValidObserver()
getValidObserver
in interface ValueMapEditModel<K,V>
ValueMapEditModel.getValidator()
,
ValueMapEditModel.isValid()
public final boolean isValid()
isValid
in interface ValueMapEditModel<K,V>
ValueMapEditModel.getValidObserver()
public final void validate(K key) throws ValidationException
validate
in interface ValueMapEditModel<K,V>
key
- the key the value is associated withValidationException
- if the given value is not valid for the given keypublic final void validate() throws ValidationException
validate
in interface ValueMapEditModel<K,V>
ValidationException
- in case the ValueMap is invalidpublic final void validate(ValueMap<K,V> valueMap) throws ValidationException
validate
in interface ValueMapEditModel<K,V>
valueMap
- the ValueMap to validateValidationException
- in case the ValueMap is invalidpublic final void validate(java.util.Collection<? extends ValueMap<K,V>> valueMaps) throws ValidationException
validate
in interface ValueMapEditModel<K,V>
valueMaps
- the value maps to validateValidationException
- on finding the first invalid ValueMappublic final boolean isValid(K key)
validate
methodisValid
in interface ValueMapEditModel<K,V>
key
- the key the value is associated withValueMapEditModel.validate(Object)
,
ValueMap.Validator#validate(ValueMap)
public final ValueMap.Validator getValidator()
getValidator
in interface ValueMapEditModel<K,V>
public final EventObserver<ValueChange<K,V>> getValueObserver()
getValueObserver
in interface ValueMapEditModel<K,V>
public final EventObserver<ValueChange<K,V>> getValueObserver(K key)
getValueObserver
in interface ValueMapEditModel<K,V>
key
- the key for which to retrieve the eventkey
changespublic final void addValueSetListener(K key, EventDataListener<ValueChange<K,V>> listener)
ValueMapEditModel.put(Object, Object)
, note that this event is only fired when the the value changesaddValueSetListener
in interface ValueMapEditModel<K,V>
key
- the key for which to monitor value changeslistener
- a listener notified each time the value of key
is set via this modelpublic final void removeValueSetListener(K key, EventDataListener listener)
removeValueSetListener
in interface ValueMapEditModel<K,V>
key
- the keylistener
- the listener to removepublic final void addValueListener(K key, EventDataListener<ValueChange<K,V>> listener)
addValueListener
in interface ValueMapEditModel<K,V>
key
- the key for which to monitor value changeslistener
- a listener notified each time the value of key
changespublic final void removeValueListener(K key, EventDataListener listener)
removeValueListener
in interface ValueMapEditModel<K,V>
key
- the keylistener
- the listener to remove