Package com._1c.g5.aef2.models.map
Class MapModel<K,V>
java.lang.Object
com._1c.g5.aef2.validators.Validable
com._1c.g5.aef2.models.Model
com._1c.g5.aef2.models.EditableModel
com._1c.g5.aef2.models.map.MapModel<K,V>
- All Implemented Interfaces:
IEditableModel,IModel,IMap<K,,V> IValidable,Map<K,V>
- Direct Known Subclasses:
BmMap,EmfMap,MapWorkingCopy,PojoMap
Base map model implementation.
-
Nested Class Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddMapListener(IMapListener<K, V> listener) Adds the map listener.voidclear()booleancontainsKey(Object key) booleancontainsValue(Object value) voiddiscard()Discards the changes stored in the model buffer since lastIModel.commit()operation.entrySet()voidClears the current stored map and adds all elements of the given map to the stored one.static <K,V> Map<K, V> fromCollection(Collection<Map.Entry<K, V>> collection) Returns the newly created map from entry collection.protected booleanisElementEqual(V e1, V e2) Checks the equality of the two values of the map.booleanisEmpty()booleanChecks the map for equality with the current stored map.keySet()protected final voidnotifyMapChanged(ChangeOrigin changeOrigin) Notifies the listeners about a change of this map.voidprotected final voidQueues the runnable that notifies the listeners about a change of this map.voidremoveMapListener(IMapListener<K, V> listener) Removes the map listener.protected final voidsetCommittedMap(Map<K, V> map) Sets the committed with the new value.protected final voidMakes copies of the given map and sets both committed and uncommitted maps at the same time.protected final voidsetUncommitedMap(Map<K, V> map) Sets the uncommitted with the new value.intsize()toString()values()Methods inherited from class com._1c.g5.aef2.models.EditableModel
isEditable, setEditableMethods inherited from class com._1c.g5.aef2.models.Model
addModelListener, beginExternalUpdate, checkOffline, checkOnline, commit, dispose, endExternalUpdate, getComponent, getCurrentChangeOrigin, getRunnableQueue, isOnline, notifyModelChanged, notifyModelCommitted, removeModelListener, setComponent, setOnlineMethods inherited from class com._1c.g5.aef2.validators.Validable
addValidator, getValidatorTarget, removeValidator, validate, validateMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com._1c.g5.aef2.models.IModel
addModelListener, commit, dispose, getChange, getComponent, isOnline, removeModelListener, setComponentMethods inherited from interface com._1c.g5.aef2.validators.IValidable
addValidator, removeValidator, validate, validateMethods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, equals, forEach, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Constructor Details
-
MapModel
public MapModel()
-
-
Method Details
-
addMapListener
Description copied from interface:IMapAdds the map listener.- Specified by:
addMapListenerin interfaceIMap<K,V> - Parameters:
listener- the listener to add.
-
removeMapListener
Description copied from interface:IMapRemoves the map listener.- Specified by:
removeMapListenerin interfaceIMap<K,V> - Parameters:
listener- the listener to add.
-
createWorkingCopy
- Specified by:
createWorkingCopyin interfaceIMap<K,V> - Specified by:
createWorkingCopyin interfaceIModel- Overrides:
createWorkingCopyin classModel- Returns:
- the model working copy or
nullif working copies is not supported by the model.
-
discard
public void discard()Description copied from interface:IModelDiscards the changes stored in the model buffer since lastIModel.commit()operation. -
isEqual
Description copied from interface:IMapChecks the map for equality with the current stored map. -
size
public int size() -
isEmpty
public boolean isEmpty() -
containsKey
- Specified by:
containsKeyin interfaceMap<K,V>
-
containsValue
- Specified by:
containsValuein interfaceMap<K,V>
-
get
-
put
-
remove
-
putAll
-
clear
public void clear() -
keySet
-
values
-
entrySet
-
fill
Description copied from interface:IMapClears the current stored map and adds all elements of the given map to the stored one. -
toString
-
queueNotifyMapChanged
protected final void queueNotifyMapChanged()Queues the runnable that notifies the listeners about a change of this map. In fact it queues a runnable that performsnotifyMapChanged(ChangeOrigin). -
getCommittedMap
- Returns:
- the committed list, under normal conditions it should be in sync with data source.
-
getUncommittedMap
- Returns:
- the buffered but yet uncommitted list.
-
setCommittedMap
Sets the committed with the new value.- Parameters:
map- the new committed map to set.
-
setUncommitedMap
Sets the uncommitted with the new value.- Parameters:
map- the new uncommitted map to set.
-
setMap
Makes copies of the given map and sets both committed and uncommitted maps at the same time.- Parameters:
map- the map to set.
-
notifyMapChanged
Notifies the listeners about a change of this map. -
isElementEqual
Checks the equality of the two values of the map.- Parameters:
e1- the first valuee2- the second value- Returns:
trueif the values are equals, otherwise -false.
-
fromCollection
Returns the newly created map from entry collection.- Parameters:
collection- the collection of map entries.- Returns:
- the map
-