Package com._1c.g5.aef2.models.list
Class ListModel<E>
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.list.ListModel<E>
- All Implemented Interfaces:
IEditableModel,IModel,IList<E>,IValidable,Iterable<E>,Collection<E>,List<E>
- Direct Known Subclasses:
BmList,EmfList,ListWorkingCopy,PojoList,ViewModelList
Base list model implementation.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidbooleanbooleanaddAll(int index, Collection<? extends E> c) booleanaddAll(Collection<? extends E> c) voidaddListListener(IListListener<E> listener) Adds the list listener.voidclear()booleanbooleancontainsAll(Collection<?> c) voiddiscard()Discards the changes stored in the model buffer since lastIModel.commit()operation.voiddispose()Disposes this model.voidfill(Collection<E> collection) Clears the current stored list and adds all elements of the given collection to the stored list.get(int index) intprotected booleanisElementEqual(E e1, E e2) Checks the equality of the two elements of the list.booleanisEmpty()booleanChecks the list for equality with the current stored list.iterator()intlistIterator(int index) protected final voidnotifyListChanged(ChangeOrigin changeOrigin) Notifies the listeners about a change of this list.protected voidQueues the runnable that notifies the listeners about a change of this list.remove(int index) booleanRemoves the first occurrence of the specified element from this list, if it is present.booleanremoveAll(Collection<?> c) voidremoveListListener(IListListener<E> listener) Removes the list listener.booleanretainAll(Collection<?> c) protected final voidsetCommittedList(List<E> list) Sets the committed with the new value.protected final voidMakes copies of the given list and sets both committed and uncommitted lists at the same time.protected final voidsetUncommitedList(List<E> list) Sets the uncommitted with the new value.intsize()subList(int fromIndex, int toIndex) Object[]toArray()<T> T[]toArray(T[] a) toString()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, 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 java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface com._1c.g5.aef2.models.IModel
addModelListener, commit, getChange, getComponent, isOnline, removeModelListener, setComponentMethods inherited from interface com._1c.g5.aef2.validators.IValidable
addValidator, removeValidator, validate, validateMethods inherited from interface java.util.List
equals, hashCode, replaceAll, sort, spliterator
-
Constructor Details
-
ListModel
public ListModel()
-
-
Method Details
-
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:IListChecks the list for equality with the current stored list. -
addListListener
Description copied from interface:IListAdds the list listener.- Specified by:
addListListenerin interfaceIList<E>- Parameters:
listener- the listener to add.
-
removeListListener
Description copied from interface:IListRemoves the list listener.- Specified by:
removeListListenerin interfaceIList<E>- Parameters:
listener- the listener to remove.
-
createWorkingCopy
- Specified by:
createWorkingCopyin interfaceIList<E>- Specified by:
createWorkingCopyin interfaceIModel- Overrides:
createWorkingCopyin classModel- Returns:
- the model working copy or
nullif working copies is not supported by the model.
-
dispose
public void dispose()Description copied from interface:IModelDisposes this model. -
size
public int size() -
isEmpty
public boolean isEmpty() -
contains
-
iterator
-
toArray
-
toArray
public <T> T[] toArray(T[] a) -
add
-
remove
Removes the first occurrence of the specified element from this list, if it is present. But ifo == null, removes all null elements from this list. If the list does not contain the element, it is unchanged. Returnstrueif this list contained the specified element (or equivalently, if this list changed as a result of the call). -
containsAll
- Specified by:
containsAllin interfaceCollection<E>- Specified by:
containsAllin interfaceList<E>
-
addAll
-
addAll
-
removeAll
-
retainAll
-
clear
public void clear() -
get
-
set
-
add
-
remove
-
indexOf
-
lastIndexOf
- Specified by:
lastIndexOfin interfaceList<E>
-
listIterator
- Specified by:
listIteratorin interfaceList<E>
-
listIterator
- Specified by:
listIteratorin interfaceList<E>
-
subList
-
fill
Description copied from interface:IListClears the current stored list and adds all elements of the given collection to the stored list. -
toString
-
queueNotifyListChanged
protected void queueNotifyListChanged()Queues the runnable that notifies the listeners about a change of this list. In fact it queues a runnable that performsnotifyListChanged(ChangeOrigin). -
getCommittedList
- Returns:
- the committed list, under normal conditions it should be in sync with data source.
-
getUncommittedList
- Returns:
- the buffered but yet uncommitted list.
-
setCommittedList
Sets the committed with the new value.- Parameters:
list- the new committed list to set.
-
setUncommitedList
Sets the uncommitted with the new value.- Parameters:
list- the new uncommitted list to set.
-
setList
Makes copies of the given list and sets both committed and uncommitted lists at the same time.- Parameters:
list- the list to set.
-
notifyListChanged
Notifies the listeners about a change of this list. -
isElementEqual
Checks the equality of the two elements of the list.- Parameters:
e1- the first elemente2- the second element- Returns:
trueif the elements are equals, otherwise -false.
-