M - the model typepublic class ListStore<M> extends Store<M>
List-like client side cache for elements. All operations are
performed on the currently visible set of elements.Store.Change<M,V>, Store.PropertyChange<M,V>, Store.Record, Store.StoreFilter<M>, Store.StoreSortInfo<M>| Constructor and Description |
|---|
ListStore(ModelKeyProvider<? super M> keyProvider)
Creates a new store.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(int index,
M item)
Like add(M), except the item will be inserted at the given index in the
visible items.
|
void |
add(M item)
Adds the given item to the end of the list.
|
boolean |
addAll(Collection<? extends M> items)
Adds all items to the end of the list.
|
boolean |
addAll(int index,
Collection<? extends M> items)
Adds all items at the given position.
|
void |
applySort(boolean supressEvent)
Tells the store to re-apply sort settings and to fire an event when
complete.
|
void |
clear()
Removes all items from the store.
|
M |
findModelWithKey(String key)
Finds the model with the given key, using
ModelKeyProvider as
necessary. |
M |
get(int index)
Gets the given item from the list.
|
List<M> |
getAll()
Returns a list of all items contained in the store.
|
int |
indexOf(M item)
Gets the position of the item in the set of visible items.
|
M |
remove(int index)
A ListStore acts like a Java List, and stuff is arranged in a linear
fashion, so it may be advantageous to remove based on index.
|
boolean |
remove(M model)
Removes the given item, visible or not, from the store.
|
void |
replaceAll(List<M> newItems)
Replaces all the items in the store with given list of new items.
|
int |
size()
Returns the number of visible items.
|
List<M> |
subList(int start,
int end)
Creates a new list containing references to the items in the specified
range.
|
void |
update(M item)
Replaces the item that matches the key of the given item, and fires a
StoreUpdateEvent to indicate that this change has occurred. |
addFilter, addSortInfo, addSortInfo, addStoreAddHandler, addStoreClearHandler, addStoreDataChangeHandler, addStoreFilterHandler, addStoreHandlers, addStoreRecordChangeHandler, addStoreRemoveHandler, addStoreSortHandler, addStoreUpdateHandler, clearSortInfo, commitChanges, findModel, fireEvent, getFilters, getKeyProvider, getModifiedRecords, getRecord, getSortInfo, hasMatchingKey, hasRecord, isAutoCommit, isEnableFilters, isFiltered, rejectChanges, removeFilter, removeFilters, setAutoCommit, setEnableFilterspublic ListStore(ModelKeyProvider<? super M> keyProvider)
keyProvider - the key providerpublic void add(int index,
M item)
index - - the index in the visible items. Must be a valid index, in
the range [0,size()). If the store is sorted, the index will be
ignoreditem - the item to be addedpublic void add(M item)
item - the item to be addedpublic boolean addAll(Collection<? extends M> items)
items - the items to be addedpublic boolean addAll(int index,
Collection<? extends M> items)
index - the insert indexitems - the items to be addedpublic void applySort(boolean supressEvent)
StoreStore.addSortInfo(StoreSortInfo),
Store.addSortInfo(int, StoreSortInfo), and Store.clearSortInfo().public void clear()
Storepublic M findModelWithKey(String key)
StoreModelKeyProvider as
necessary.findModelWithKey in class Store<M>key - the key of the model to findpublic M get(int index)
index - the specified index.public List<M> getAll()
Storepublic int indexOf(M item)
item - the visible itempublic M remove(int index)
index - the index of the item to removepublic boolean remove(M model)
model - model to removepublic void replaceAll(List<M> newItems)
newItems - the new contents of the storepublic int size()
public List<M> subList(int start, int end)
start - the starting indexend - the ending indexpublic void update(M item)
StoreStoreUpdateEvent to indicate that this change has occurred.
This will not cause the sort or filter to be re-applied to the object.Copyright © 2012. All Rights Reserved.