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
public abstract class ListModel<E> extends EditableModel implements IList<E>
Base list model implementation.
-
-
Constructor Summary
Constructors Constructor Description ListModel()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(int index, E element)booleanadd(E e)booleanaddAll(int index, Collection<? extends E> c)booleanaddAll(Collection<? extends E> c)voidaddListListener(IListListener<E> listener)Adds the list listener.voidclear()booleancontains(Object o)booleancontainsAll(Collection<?> c)IList<E>createWorkingCopy()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.Eget(int index)protected List<E>getCommittedList()protected List<E>getUncommittedList()intindexOf(Object o)protected booleanisElementEqual(E e1, E e2)Checks the equality of the two elements of the list.booleanisEmpty()booleanisEqual(List<E> other)Checks the list for equality with the current stored list.Iterator<E>iterator()intlastIndexOf(Object o)ListIterator<E>listIterator()ListIterator<E>listIterator(int index)protected voidnotifyListChanged(ChangeOrigin changeOrigin)Notifies the listeners about a change of this list.protected voidqueueNotifyListChanged()Queues the runnable that notifies the listeners about a change of this list.Eremove(int index)booleanremove(Object o)booleanremoveAll(Collection<?> c)voidremoveListListener(IListListener<E> listener)Removes the list listener.booleanretainAll(Collection<?> c)Eset(int index, E element)protected voidsetCommittedList(List<E> list)Sets the committed with the new value.protected voidsetList(List<E> list)Makes copies of the given list and sets both committed and uncommitted lists at the same time.protected voidsetUncommitedList(List<E> list)Sets the uncommitted with the new value.intsize()List<E>subList(int fromIndex, int toIndex)Object[]toArray()<T> T[]toArray(T[] a)StringtoString()-
Methods inherited from class com._1c.g5.aef2.models.EditableModel
isEditable, setEditable
-
Methods inherited from class com._1c.g5.aef2.models.Model
addModelListener, beginExternalUpdate, checkOffline, checkOnline, commit, endExternalUpdate, getComponent, getCurrentChangeOrigin, getRunnableQueue, isOnline, notifyModelChanged, notifyModelCommitted, removeModelListener, setComponent, setOnline
-
Methods inherited from class com._1c.g5.aef2.validators.Validable
addValidator, getValidatorTarget, removeValidator, validate, validate
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
Methods inherited from interface com._1c.g5.aef2.models.IModel
addModelListener, commit, getChange, getComponent, isOnline, removeModelListener, setComponent
-
Methods inherited from interface com._1c.g5.aef2.validators.IValidable
addValidator, removeValidator, validate, validate
-
Methods inherited from interface java.util.List
equals, hashCode, replaceAll, sort, spliterator
-
-
-
-
Method Detail
-
discard
public void discard()
Description copied from interface:IModelDiscards the changes stored in the model buffer since lastIModel.commit()operation.
-
isEqual
public boolean isEqual(List<E> other)
Description copied from interface:IListChecks the list for equality with the current stored list.
-
addListListener
public void addListListener(IListListener<E> listener)
Description copied from interface:IListAdds the list listener.- Specified by:
addListListenerin interfaceIList<E>- Parameters:
listener- the listener to add.
-
removeListListener
public void removeListListener(IListListener<E> listener)
Description copied from interface:IListRemoves the list listener.- Specified by:
removeListListenerin interfaceIList<E>- Parameters:
listener- the listener to remove.
-
createWorkingCopy
public IList<E> 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
public boolean contains(Object o)
-
toArray
public Object[] toArray()
-
toArray
public <T> T[] toArray(T[] a)
-
add
public boolean add(E e)
-
remove
public boolean remove(Object o)
-
containsAll
public boolean containsAll(Collection<?> c)
- Specified by:
containsAllin interfaceCollection<E>- Specified by:
containsAllin interfaceList<E>
-
addAll
public boolean addAll(Collection<? extends E> c)
-
addAll
public boolean addAll(int index, Collection<? extends E> c)
-
removeAll
public boolean removeAll(Collection<?> c)
-
retainAll
public boolean retainAll(Collection<?> c)
-
clear
public void clear()
-
lastIndexOf
public int lastIndexOf(Object o)
- Specified by:
lastIndexOfin interfaceList<E>
-
listIterator
public ListIterator<E> listIterator()
- Specified by:
listIteratorin interfaceList<E>
-
listIterator
public ListIterator<E> listIterator(int index)
- Specified by:
listIteratorin interfaceList<E>
-
fill
public void fill(Collection<E> collection)
Description copied from interface:IListClears the current stored list and adds all elements of the given collection to the stored list.
-
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
protected final List<E> getCommittedList()
- Returns:
- the committed list, under normal conditions it should be in sync with data source.
-
getUncommittedList
protected final List<E> getUncommittedList()
- Returns:
- the buffered but yet uncommitted list.
-
setCommittedList
protected final void setCommittedList(List<E> list)
Sets the committed with the new value.- Parameters:
list- the new committed list to set.
-
setUncommitedList
protected final void setUncommitedList(List<E> list)
Sets the uncommitted with the new value.- Parameters:
list- the new uncommitted list to set.
-
setList
protected final void setList(List<E> list)
Makes copies of the given list and sets both committed and uncommitted lists at the same time.- Parameters:
list- the list to set.
-
notifyListChanged
protected final void notifyListChanged(ChangeOrigin changeOrigin)
Notifies the listeners about a change of this list.
-
-