|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.extjs.gxt.ui.client.event.BaseObservable
com.extjs.gxt.ui.client.store.Store<M>
M
- the model data typepublic abstract class Store<M extends ModelData>
The store class encapsulates a client side cache of ModelData
objects
which provide input data for components such as the ComboBox
and
ListView
.
BaseEvent.setCancelled(boolean)
.
Field Summary | |
---|---|
static EventType |
Add
Add event type. |
protected java.util.List<M> |
all
|
static EventType |
BeforeAdd
BeforeAdd event type. |
static EventType |
BeforeClear
BeforeClear event type. |
static EventType |
BeforeDataChanged
BeforeDataChanged event type. |
static EventType |
BeforeRemove
BeforeRemove event type. |
static EventType |
BeforeSort
BeforeSort event type. |
static EventType |
Clear
Clear event type. |
static EventType |
DataChanged
DataChanged event type. |
static EventType |
Filter
Filter event type. |
protected java.lang.String |
filterBeginsWith
|
protected java.util.List<M> |
filtered
|
protected java.lang.String |
filterProperty
|
protected java.util.List<StoreFilter<M>> |
filters
|
protected boolean |
filtersEnabled
|
protected java.util.List<Record> |
modified
|
protected java.util.Map<M,Record> |
recordMap
|
static EventType |
Remove
Remove event type. |
protected java.util.List<M> |
snapshot
|
static EventType |
Sort
Filter event type. |
protected SortInfo |
sortInfo
|
protected StoreSorter<M> |
storeSorter
|
static EventType |
Update
Update event type. |
Constructor Summary | |
---|---|
Store()
|
Method Summary | |
---|---|
void |
addFilter(StoreFilter<M> filter)
Adds a filter to the store. |
void |
addStoreListener(StoreListener<M> listener)
Adds a store listener. |
protected void |
afterCommit(Record record)
|
protected void |
afterEdit(Record record)
|
protected void |
afterReject(Record record)
|
void |
applyFilters(java.lang.String property)
Applies the current filters to the store. |
protected void |
applySort(boolean supressEvent)
|
void |
clearFilters()
Revert to a view of this store with no filtering applied. |
void |
commitChanges()
Commit all items with outstanding changes. |
boolean |
contains(M item)
Returns true if the item is in this store. |
protected StoreEvent<M> |
createStoreEvent()
|
boolean |
equals(M model1,
M model2)
Returns true if the two models are equal as defined by the model comparer. |
void |
filter(java.lang.String property)
Filters the store using the given property. |
void |
filter(java.lang.String property,
java.lang.String beginsWith)
Filters the store using the given property. |
M |
findModel(M model)
Returns the matching model in the cache using the model comparer to test for equality. |
M |
findModel(java.lang.String key)
|
M |
findModel(java.lang.String property,
java.lang.Object value)
Returns the first model whose property matches the given value. |
java.util.List<M> |
findModels(java.lang.String property,
java.lang.Object value)
Returns a list of all matching models whose property matches the given value. |
protected void |
fireStoreEvent(EventType type,
Record.RecordUpdate operation,
Record record)
|
java.util.List<StoreFilter<M>> |
getFilters()
Returns the store's filters. |
ModelKeyProvider<M> |
getKeyProvider()
Returns the model key provider. |
ModelComparer<M> |
getModelComparer()
Returns the comparer used to compare model instances. |
java.util.List<M> |
getModels()
Returns the store's models. |
java.util.List<Record> |
getModifiedRecords()
Gets all records modified since the last commit. |
Record |
getRecord(M model)
Returns the record instance for the item. |
StoreSorter<M> |
getStoreSorter()
Returns the store sorter. |
boolean |
hasRecord(M model)
Returns true if a record exists for the given model. |
boolean |
isFiltered()
Returns true if this store is currently filtered. |
protected boolean |
isFiltered(ModelData record,
java.lang.String property)
|
boolean |
isMonitorChanges()
Returns true if the store is monitoring changes. |
protected void |
onModelChange(ChangeEvent ce)
|
protected void |
registerModel(M model)
Subclasses must register any model instance being inserted into the store. |
void |
rejectChanges()
Cancel outstanding changes on all changed records. |
void |
removeAll()
Remove all items from the store and fires the Clear event. |
void |
removeFilter(StoreFilter<M> filter)
Removes a previously added filter. |
void |
removeStoreListener(StoreListener<M> listener)
Removes a store listener. |
void |
setKeyProvider(ModelKeyProvider<M> keyProvider)
Sets the model key provider which is used to uniquely identify a model from an id. |
void |
setModelComparer(ModelComparer<M> comparer)
Sets the comparer to be used when comparing model instances. |
void |
setMonitorChanges(boolean monitorChanges)
Sets whether the store should listen to change events on its children (defaults to false). |
void |
setStoreSorter(StoreSorter<M> storeSorter)
Sets the store's sorter. |
protected void |
swapModelInstance(M oldModel,
M newModel)
|
protected void |
unregisterModel(M model)
Subclasses must unregister any model instance being removed from the store. |
void |
update(M model)
Notifies the store that the model has been updated and fires the Update event. |
Methods inherited from class com.extjs.gxt.ui.client.event.BaseObservable |
---|
addListener, callListener, fireEvent, fireEvent, getFiresEvents, getListeners, hasActiveEvent, hasListeners, hasListeners, removeAllListeners, removeListener, setFiresEvents |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final EventType BeforeAdd
public static final EventType BeforeClear
public static final EventType BeforeDataChanged
public static final EventType BeforeRemove
public static final EventType BeforeSort
public static final EventType DataChanged
public static final EventType Filter
public static final EventType Sort
public static final EventType Add
public static final EventType Remove
public static final EventType Update
public static final EventType Clear
protected java.util.List<M extends ModelData> all
protected java.util.Map<M extends ModelData,Record> recordMap
protected java.util.List<M extends ModelData> filtered
protected java.util.List<Record> modified
protected SortInfo sortInfo
protected StoreSorter<M extends ModelData> storeSorter
protected java.lang.String filterProperty
protected java.lang.String filterBeginsWith
protected boolean filtersEnabled
protected java.util.List<M extends ModelData> snapshot
protected java.util.List<StoreFilter<M extends ModelData>> filters
Constructor Detail |
---|
public Store()
Method Detail |
---|
public void addFilter(StoreFilter<M> filter)
filter
- the store filter to addpublic void addStoreListener(StoreListener<M> listener)
listener
- the listener to addpublic void applyFilters(java.lang.String property)
property
- the optional active propertypublic void clearFilters()
public void commitChanges()
Record.RecordUpdate.COMMIT
.
public boolean contains(M item)
item
- the item
public boolean equals(M model1, M model2)
model1
- the first modelmodel2
- the second model
public void filter(java.lang.String property)
property
- the property to filter bypublic void filter(java.lang.String property, java.lang.String beginsWith)
property
- the property to filter bybeginsWith
- a string the value should begin withpublic M findModel(M model)
model
- the model
public M findModel(java.lang.String key)
public M findModel(java.lang.String property, java.lang.Object value)
property
- the property namevalue
- the value to match
public java.util.List<M> findModels(java.lang.String property, java.lang.Object value)
property
- the property namevalue
- the value to match
public java.util.List<StoreFilter<M>> getFilters()
public ModelKeyProvider<M> getKeyProvider()
public ModelComparer<M> getModelComparer()
public java.util.List<M> getModels()
public java.util.List<Record> getModifiedRecords()
public Record getRecord(M model)
model
- the item
public StoreSorter<M> getStoreSorter()
public boolean hasRecord(M model)
model
- the model
public boolean isFiltered()
public boolean isMonitorChanges()
public void rejectChanges()
public void removeAll()
public void removeFilter(StoreFilter<M> filter)
filter
- the filter to removepublic void removeStoreListener(StoreListener<M> listener)
listener
- the store listener to removepublic void setKeyProvider(ModelKeyProvider<M> keyProvider)
keyProvider
- the model key providerpublic void setModelComparer(ModelComparer<M> comparer)
comparer
- the comparerpublic void setMonitorChanges(boolean monitorChanges)
ChangeEventSource
may be monitored.
monitorChanges
- true to monitor changespublic void setStoreSorter(StoreSorter<M> storeSorter)
storeSorter
- the sorterpublic void update(M model)
model
- the updated modelprotected void afterCommit(Record record)
protected void afterEdit(Record record)
protected void afterReject(Record record)
protected void applySort(boolean supressEvent)
protected StoreEvent<M> createStoreEvent()
protected void fireStoreEvent(EventType type, Record.RecordUpdate operation, Record record)
protected boolean isFiltered(ModelData record, java.lang.String property)
protected void onModelChange(ChangeEvent ce)
protected void registerModel(M model)
model
- the modelprotected void swapModelInstance(M oldModel, M newModel)
protected void unregisterModel(M model)
model
- the model
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |