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 TypeMethodDescriptionvoid
boolean
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
boolean
containsAll
(Collection<?> c) 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.get
(int index) int
protected boolean
isElementEqual
(E e1, E e2) Checks the equality of the two elements of the list.boolean
isEmpty()
boolean
Checks the list for equality with the current stored list.iterator()
int
listIterator
(int index) protected final void
notifyListChanged
(ChangeOrigin changeOrigin) Notifies the listeners about a change of this list.protected void
Queues the runnable that notifies the listeners about a change of this list.remove
(int index) boolean
Removes the first occurrence of the specified element from this list, if it is present.boolean
removeAll
(Collection<?> c) void
removeListListener
(IListListener<E> listener) Removes the list listener.boolean
retainAll
(Collection<?> c) protected final void
setCommittedList
(List<E> list) Sets the committed with the new value.protected final void
Makes copies of the given list and sets both committed and uncommitted lists at the same time.protected final void
setUncommitedList
(List<E> list) Sets the uncommitted with the new value.int
size()
subList
(int fromIndex, int toIndex) Object[]
toArray()
<T> T[]
toArray
(T[] a) 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
-
Constructor Details
-
ListModel
public ListModel()
-
-
Method Details
-
discard
public void discard()Description copied from interface:IModel
Discards the changes stored in the model buffer since lastIModel.commit()
operation. -
isEqual
Description copied from interface:IList
Checks the list for equality with the current stored list. -
addListListener
Description copied from interface:IList
Adds the list listener.- Specified by:
addListListener
in interfaceIList<E>
- Parameters:
listener
- the listener to add.
-
removeListListener
Description copied from interface:IList
Removes the list listener.- Specified by:
removeListListener
in interfaceIList<E>
- Parameters:
listener
- the listener to remove.
-
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
-
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. Returnstrue
if this list contained the specified element (or equivalently, if this list changed as a result of the call). -
containsAll
- Specified by:
containsAll
in interfaceCollection<E>
- Specified by:
containsAll
in interfaceList<E>
-
addAll
-
addAll
-
removeAll
-
retainAll
-
clear
public void clear() -
get
-
set
-
add
-
remove
-
indexOf
-
lastIndexOf
- Specified by:
lastIndexOf
in interfaceList<E>
-
listIterator
- Specified by:
listIterator
in interfaceList<E>
-
listIterator
- Specified by:
listIterator
in interfaceList<E>
-
subList
-
fill
Description copied from interface:IList
Clears 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:
true
if the elements are equals, otherwise -false
.
-