org.jminor.common.model.valuemap
Interface ValueChangeMapEditModel<K,V>

Type Parameters:
K - the type of the value map keys
V - the type of the value map values
All Superinterfaces:
Refreshable
All Known Subinterfaces:
EntityEditModel
All Known Implementing Classes:
AbstractValueChangeMapEditModel, DefaultEntityEditModel

public interface ValueChangeMapEditModel<K,V>
extends Refreshable

Specifies an object which facilitates the editing of values in a ValueChangeMap


Method Summary
 void addValueListener(K key, ActionListener listener)
           
 void addValueMapSetListener(ActionListener listener)
           
 void addValueSetListener(K key, ActionListener listener)
           
 ValueChangeMap<K,V> getDefaultValueMap()
           
 StateObserver getModifiedState()
           
 ValueMapValidator<K,V> getValidator()
           
 StateObserver getValidState()
           
 V getValue(K key)
          Returns the value associated with the given key in the underlying value map
 EventObserver getValueChangeObserver(K key)
           
 boolean isModified()
           
 boolean isNullable(K key)
           
 boolean isValid()
           
 boolean isValid(K key, int action)
          Returns true if the given value is valid for the given key, using the validate method
 boolean isValueNull(K key)
           
 void removeValueListener(K key, ActionListener listener)
           
 void removeValueMapSetListener(ActionListener listener)
           
 void removeValueSetListener(K key, ActionListener listener)
           
 void setValue(K key, V value)
          Sets the given value in the underlying value map
 void setValueMap(ValueChangeMap<K,V> valueMap)
          Sets the active value map, that is, deep copies the value from the source map into the underlying map
 void validate(K key, int action)
          Checks if the value associated with the give key is valid, throws a ValidationException if not
 
Methods inherited from interface org.jminor.common.model.Refreshable
clear, refresh
 

Method Detail

getModifiedState

StateObserver getModifiedState()
Returns:
a State indicating the modified status of this value map
See Also:
isModified()

getValidState

StateObserver getValidState()
Returns:
a State indicating the valid status of this value map
See Also:
getValidator(), isValid()

addValueSetListener

void addValueSetListener(K key,
                         ActionListener listener)
Parameters:
key - the key for which to monitor value changes
listener - a listener notified each time the value of key is set

removeValueSetListener

void removeValueSetListener(K key,
                            ActionListener listener)
Parameters:
key - the key
listener - the listener to remove

addValueMapSetListener

void addValueMapSetListener(ActionListener listener)
Parameters:
listener - a listener notified each time the value map is set

removeValueMapSetListener

void removeValueMapSetListener(ActionListener listener)
Parameters:
listener - the listener to remove

addValueListener

void addValueListener(K key,
                      ActionListener listener)
Parameters:
key - the key for which to monitor value changes
listener - a listener notified each time the value of key changes

removeValueListener

void removeValueListener(K key,
                         ActionListener listener)
Parameters:
key - the key
listener - the listener to remove

getValueChangeObserver

EventObserver getValueChangeObserver(K key)
Parameters:
key - the key for which to retrieve the event
Returns:
an Event object which fires when the value of key changes

getValidator

ValueMapValidator<K,V> getValidator()
Returns:
the validatorAFTM

setValueMap

void setValueMap(ValueChangeMap<K,V> valueMap)
Sets the active value map, that is, deep copies the value from the source map into the underlying map

Parameters:
valueMap - the map to set as active, if null then the default map value is set as active
See Also:
getDefaultValueMap(), addValueMapSetListener(java.awt.event.ActionListener)

isNullable

boolean isNullable(K key)
Parameters:
key - the key
Returns:
true if this value is allowed to be null in the underlying value map

isValueNull

boolean isValueNull(K key)
Parameters:
key - the key
Returns:
true if the value of the given key is null

setValue

void setValue(K key,
              V value)
Sets the given value in the underlying value map

Parameters:
key - the key to associate the given value with
value - the value to associate with the given key

getValue

V getValue(K key)
Returns the value associated with the given key in the underlying value map

Parameters:
key - the key of the value to retrieve
Returns:
the value associated with the given key

getDefaultValueMap

ValueChangeMap<K,V> getDefaultValueMap()
Returns:
a value map containing the default values

validate

void validate(K key,
              int action)
              throws ValidationException
Checks if the value associated with the give key is valid, throws a ValidationException if not

Parameters:
key - the key
action - describes the action requiring validation, ValueChangeMapEditModel.INSERT, ValueChangeMapEditModel.UPDATE or ValueChangeMapEditModel.UNKNOWN
Throws:
ValidationException - if the given value is not valid for the given key

isValid

boolean isValid(K key,
                int action)
Returns true if the given value is valid for the given key, using the validate method

Parameters:
key - the key
action - describes the action requiring validation, ValueChangeMapEditModel.INSERT, ValueChangeMapEditModel.UPDATE or ValueChangeMapEditModel.UNKNOWN
Returns:
true if the value is valid
See Also:
validate(Object, int), ValueMapValidator.validate(ValueMap, Object, int)

isValid

boolean isValid()
Returns:
true if the underlying value map contains only valid values
See Also:
()

isModified

boolean isModified()
Returns:
true if the underlying value map is modified
See Also:
getModifiedState()