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 void
add(int index, E element)
boolean
add(E e)
boolean
addAll(int index, Collection<? extends E> c)
boolean
addAll(Collection<? extends E> c)
void
addListListener(IListListener<E> listener)
Adds the list listener.void
clear()
boolean
contains(Object o)
boolean
containsAll(Collection<?> c)
IList<E>
createWorkingCopy()
void
discard()
Discards the changes stored in the model buffer since lastIModel.commit()
operation.void
dispose()
Disposes this model.void
fill(Collection<E> collection)
Clears the current stored list and adds all elements of the given collection to the stored list.E
get(int index)
protected List<E>
getCommittedList()
protected List<E>
getUncommittedList()
int
indexOf(Object o)
protected boolean
isElementEqual(E e1, E e2)
Checks the equality of the two elements of the list.boolean
isEmpty()
boolean
isEqual(List<E> other)
Checks the list for equality with the current stored list.Iterator<E>
iterator()
int
lastIndexOf(Object o)
ListIterator<E>
listIterator()
ListIterator<E>
listIterator(int index)
protected void
notifyListChanged(ChangeOrigin changeOrigin)
Notifies the listeners about a change of this list.protected void
queueNotifyListChanged()
Queues the runnable that notifies the listeners about a change of this list.E
remove(int index)
boolean
remove(Object o)
boolean
removeAll(Collection<?> c)
void
removeListListener(IListListener<E> listener)
Removes the list listener.boolean
retainAll(Collection<?> c)
E
set(int index, E element)
protected void
setCommittedList(List<E> list)
Sets the committed with the new value.protected void
setList(List<E> list)
Makes copies of the given list and sets both committed and uncommitted lists at the same time.protected void
setUncommitedList(List<E> list)
Sets the uncommitted with the new value.int
size()
List<E>
subList(int fromIndex, int toIndex)
Object[]
toArray()
<T> T[]
toArray(T[] a)
String
toString()
-
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:IModel
Discards the changes stored in the model buffer since lastIModel.commit()
operation.
-
isEqual
public boolean isEqual(List<E> other)
Description copied from interface:IList
Checks the list for equality with the current stored list.
-
addListListener
public void addListListener(IListListener<E> listener)
Description copied from interface:IList
Adds the list listener.- Specified by:
addListListener
in interfaceIList<E>
- Parameters:
listener
- the listener to add.
-
removeListListener
public void removeListListener(IListListener<E> listener)
Description copied from interface:IList
Removes the list listener.- Specified by:
removeListListener
in interfaceIList<E>
- Parameters:
listener
- the listener to remove.
-
createWorkingCopy
public IList<E> createWorkingCopy()
- Specified by:
createWorkingCopy
in interfaceIList<E>
- Specified by:
createWorkingCopy
in interfaceIModel
- Overrides:
createWorkingCopy
in classModel
- Returns:
- the model working copy or
null
if working copies is not supported by the model.
-
dispose
public void dispose()
Description copied from interface:IModel
Disposes 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:
containsAll
in interfaceCollection<E>
- Specified by:
containsAll
in 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:
lastIndexOf
in interfaceList<E>
-
listIterator
public ListIterator<E> listIterator()
- Specified by:
listIterator
in interfaceList<E>
-
listIterator
public ListIterator<E> listIterator(int index)
- Specified by:
listIterator
in interfaceList<E>
-
fill
public void fill(Collection<E> collection)
Description copied from interface:IList
Clears 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.
-
-