|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jminor.common.model.valuemap.ValueMapImpl<K,V>
org.jminor.common.model.valuemap.ValueChangeMapImpl<K,V>
K
- the type of the map keysV
- the type of the map valuespublic class ValueChangeMapImpl<K,V>
A default ValueChangeMap implementation.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface org.jminor.common.model.valuemap.ValueMap |
---|
ValueMap.ToString<K> |
Constructor Summary | |
---|---|
ValueChangeMapImpl()
|
Method Summary | |
---|---|
void |
addValueListener(ActionListener valueListener)
Adds a ActionListener, this listener will be notified each time a value changes, by calling actionPerformed() with a ValueChangeEvent argument. |
ValueChangeMap<K,V> |
getCopy()
|
ValueChangeMap<K,V> |
getInstance()
|
StateObserver |
getModifiedState()
|
ValueChangeMap<K,V> |
getOriginalCopy()
|
V |
getOriginalValue(K key)
Returns the original value associated with the given key or the current value if it has not been changed. |
Collection<K> |
getOriginalValueKeys()
|
EventObserver |
getValueChangeObserver()
Returns an Event fired each time a value changes, with a ValueChangeEvent argument. |
protected void |
handleClear()
Called after the value map has been cleared. |
protected void |
handleSetAs(ValueChangeMap<K,V> sourceMap)
Called after the value map has been set. |
protected void |
handleValueChangedEventInitialized()
|
protected void |
handleValueInitialized(K key,
V value)
|
protected void |
handleValueRemoved(K key,
V value)
Called after a value has been removed from this map. |
protected void |
handleValueSet(K key,
V value,
V previousValue,
boolean initialization)
Called after a value has been set. |
void |
initializeValue(K key,
V value)
Initializes the value associated with the given key. |
boolean |
isModified()
|
boolean |
isModified(K key)
Returns true if the value associated with the given key has been modified.. |
protected void |
notifyValueChange(K key,
V value,
V oldValue,
boolean initialization)
|
protected void |
removeOriginalValue(K key)
|
void |
removeValueListener(ActionListener valueListener)
Removes the given value listener if it has been registered with this value map. |
void |
revertAll()
Reverts all value changes that have been made. |
void |
revertValue(K key)
Reverts the value associated with the given key to its original value. |
void |
saveAll()
Saves all the value changes that have been made. |
void |
saveValue(K key)
Saves the value associated with the given key, that is, removes the original value. |
void |
setAs(ValueChangeMap<K,V> sourceMap)
After a call to this method this ValueChangeMap contains the same values and original values as the given map. |
protected void |
setOriginalValue(K key,
V oldValue)
|
Methods inherited from class org.jminor.common.model.valuemap.ValueMapImpl |
---|
clear, containsValue, copyValue, equals, getValue, getValueAsString, getValueKeys, getValues, hashCode, isValueNull, removeValue, setValue, size |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.jminor.common.model.valuemap.ValueMap |
---|
clear, containsValue, copyValue, getValueKeys, getValues, isValueNull, removeValue, setValue, size |
Methods inherited from interface org.jminor.common.model.valuemap.ValueProvider |
---|
getValue |
Methods inherited from interface org.jminor.common.model.valuemap.ValueAsStringProvider |
---|
getValueAsString |
Constructor Detail |
---|
public ValueChangeMapImpl()
Method Detail |
---|
public void initializeValue(K key, V value)
initializeValue
in interface ValueChangeMap<K,V>
key
- the key with which to associate the given valuevalue
- the value to associate with the given keypublic final V getOriginalValue(K key)
getOriginalValue
in interface ValueChangeMap<K,V>
key
- the key for which to retrieve the original value
public boolean isModified()
isModified
in interface ValueChangeMap<K,V>
public ValueChangeMap<K,V> getInstance()
getInstance
in interface ValueChangeMap<K,V>
public final ValueChangeMap<K,V> getCopy()
getCopy
in interface ValueChangeMap<K,V>
public final void setAs(ValueChangeMap<K,V> sourceMap)
setAs
in interface ValueChangeMap<K,V>
sourceMap
- the map to copy or null for clearing the destination mappublic final boolean isModified(K key)
isModified
in interface ValueChangeMap<K,V>
key
- the key
public final void revertValue(K key)
revertValue
in interface ValueChangeMap<K,V>
key
- the key for which to revert the valuepublic final void revertAll()
revertAll
in interface ValueChangeMap<K,V>
public final void saveValue(K key)
saveValue
in interface ValueChangeMap<K,V>
key
- the key for which to save the valuepublic final void saveAll()
saveAll
in interface ValueChangeMap<K,V>
public final ValueChangeMap<K,V> getOriginalCopy()
getOriginalCopy
in interface ValueChangeMap<K,V>
public final Collection<K> getOriginalValueKeys()
getOriginalValueKeys
in interface ValueChangeMap<K,V>
public final void addValueListener(ActionListener valueListener)
addValueListener
in interface ValueChangeMap<K,V>
valueListener
- the ActionListenerValueChangeEvent
public final void removeValueListener(ActionListener valueListener)
removeValueListener
in interface ValueChangeMap<K,V>
valueListener
- the ActionListener to removepublic final StateObserver getModifiedState()
getModifiedState
in interface ValueChangeMap<K,V>
public final EventObserver getValueChangeObserver()
getValueChangeObserver
in interface ValueChangeMap<K,V>
ValueChangeEvent
protected final void notifyValueChange(K key, V value, V oldValue, boolean initialization)
protected final void setOriginalValue(K key, V oldValue)
protected final void removeOriginalValue(K key)
protected void handleValueInitialized(K key, V value)
protected void handleValueChangedEventInitialized()
protected void handleValueRemoved(K key, V value)
ValueMapImpl
handleValueRemoved
in class ValueMapImpl<K,V>
key
- the keyvalue
- the value that was removedprotected void handleValueSet(K key, V value, V previousValue, boolean initialization)
ValueMapImpl
handleValueSet
in class ValueMapImpl<K,V>
key
- the keyvalue
- the valuepreviousValue
- the previous valueinitialization
- true if the value was being initializedprotected void handleClear()
ValueMapImpl
handleClear
in class ValueMapImpl<K,V>
protected void handleSetAs(ValueChangeMap<K,V> sourceMap)
sourceMap
- the source map
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |