|
|||||||||
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>
com.extjs.gxt.ui.client.store.TreeStore<M>
public class TreeStore<M extends ModelData>
A store for hierarchical data.
The parent child relationships are handled internally by the store. It is important to note that the store does not use the the parent and children of any TreeModel instances added to the store. It is important to note the sorting behavior when working with TreeStore. When a sorter is set, it is applied to all existing models in the cache and the Sort event is fired. At this point, the sorter is enabled and active. Remote sorting is not supported with TreeStore.
Field Summary | |
---|---|
protected TreeLoader<M> |
loader
|
protected java.util.Map<java.lang.String,TreeModel> |
modelFastMap
|
protected java.util.Map<M,TreeModel> |
modelMap
|
protected BaseTreeModel |
rootWrapper
|
protected java.util.Map<java.lang.String,M> |
wrapperMap
|
Fields inherited from class com.extjs.gxt.ui.client.store.Store |
---|
Add, all, BeforeAdd, BeforeClear, BeforeDataChanged, BeforeRemove, BeforeSort, Clear, DataChanged, Filter, filterBeginsWith, filtered, filterProperty, filters, filtersEnabled, modified, recordMap, Remove, snapshot, Sort, sortInfo, storeSorter, Update |
Constructor Summary | |
---|---|
TreeStore()
Creates a new tree store. |
|
TreeStore(TreeLoader<M> loader)
Creates a new tree store. |
Method Summary | |
---|---|
void |
add(java.util.List<M> models,
boolean addChildren)
Adds the models to the root of the store and fires the Add event. |
void |
add(M item,
boolean addChildren)
Adds the items to the store and fires the Add event. |
void |
add(M parent,
java.util.List<M> children,
boolean addChildren)
Adds the models to the given parent and fires the Add event. |
void |
add(M parent,
M item,
boolean addChildren)
Adds the child to the parent and fires the Add event. |
void |
applyFilters(java.lang.String property)
Applies the current filters to the store. |
protected void |
applySort(boolean supressEvent)
|
protected void |
applySort(java.util.List<TreeModel> list)
|
void |
clearFilters()
Revert to a view of this store with no filtering applied. |
protected TreeStoreEvent<M> |
createStoreEvent()
|
protected TreeModel |
findWrapper(M item)
|
java.util.List<M> |
getAllItems()
Returns all the stores items. |
M |
getChild(int index)
Returns the root level child. |
M |
getChild(M parent,
int index)
Returns the child at the given index. |
int |
getChildCount()
Returns the root level child count. |
int |
getChildCount(M parent)
Returns the child count for the parent. |
java.util.List<M> |
getChildren(M parent)
Returns the children of the parent. |
java.util.List<M> |
getChildren(M parent,
boolean deep)
Returns the children of the parent. |
int |
getDepth(M item)
Returns the depth of the item. |
M |
getFirstChild(M parent)
Returns the fist child of the parent. |
M |
getLastChild(M parent)
Returns the last child of the parent. |
TreeLoader<M> |
getLoader()
Returns the store's loader. |
TreeStoreModel |
getModelState(M model)
Returns the parent-child relationships for the given model. |
M |
getNextSibling(M item)
Returns the next sibling of the model. |
M |
getParent(M item)
Returns the parent of the item. |
M |
getPreviousSibling(M item)
Returns the item's previous sibling. |
java.util.List<M> |
getRootItems()
Returns the root level items. |
SortInfo |
getSortState()
Returns the current sort state of this store. |
boolean |
hasChildren(M parent)
Returns true if the given parent model has any children. |
int |
indexOf(M item)
Returns the item's index in it's parent including root level items. |
void |
insert(java.util.List<M> models,
int index,
boolean addChildren)
Inserts the models into the store and fires the Add event. |
void |
insert(M item,
int index,
boolean addChildren)
Adds the item to the store and fires the Add event. |
void |
insert(M parent,
java.util.List<M> children,
int index,
boolean addChildren)
Inserts the children to the parent and fires the Add event. |
void |
insert(M parent,
M model,
int index,
boolean addChildren)
Adds the child to the parent and fires the Add event. |
protected void |
onBeforeLoad(LoadEvent le)
|
protected void |
onLoad(TreeLoadEvent le)
|
protected void |
onLoadException(LoadEvent le)
|
protected void |
onModelChange(ChangeEvent ce)
|
void |
remove(M model)
Removes the model from the store and fires the Remove event. |
void |
remove(M parent,
M child)
Removes the child from the parent and fires the Remove event. |
void |
removeAll()
Remove all items from the store and fires the Clear event. |
void |
removeAll(M parent)
Removes all the parent's children. |
void |
setSortInfo(SortInfo info)
Sets the current sort info used when sorting items in the store. |
void |
setStoreSorter(StoreSorter<M> storeSorter)
Sets the store's sorter. |
void |
sort(java.lang.String field,
Style.SortDir sortDir)
Sorts the store. |
protected void |
swapModelInstance(M oldModel,
M newModel)
|
protected java.util.List<M> |
unwrap(java.util.List<TreeModel> models)
|
protected M |
unwrap(TreeModel wrapper)
|
protected java.util.List<M> |
unwrapChildren(TreeModel parent)
|
protected TreeModel |
wrap(M model)
|
Methods inherited from class com.extjs.gxt.ui.client.store.Store |
---|
addFilter, addStoreListener, afterCommit, afterEdit, afterReject, commitChanges, contains, equals, filter, filter, findModel, findModel, findModel, findModels, fireStoreEvent, getFilters, getKeyProvider, getModelComparer, getModels, getModifiedRecords, getRecord, getStoreSorter, hasRecord, isFiltered, isFiltered, isMonitorChanges, registerModel, rejectChanges, removeFilter, removeStoreListener, setKeyProvider, setModelComparer, setMonitorChanges, unregisterModel, update |
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 |
---|
protected TreeLoader<M extends ModelData> loader
protected java.util.Map<java.lang.String,TreeModel> modelFastMap
protected java.util.Map<M extends ModelData,TreeModel> modelMap
protected BaseTreeModel rootWrapper
protected java.util.Map<java.lang.String,M extends ModelData> wrapperMap
Constructor Detail |
---|
public TreeStore()
public TreeStore(TreeLoader<M> loader)
loader
- the tree loaderMethod Detail |
---|
public void add(java.util.List<M> models, boolean addChildren)
models
- the models to be addedaddChildren
- true to recursively add all childrenpublic void add(M item, boolean addChildren)
item
- the item to addaddChildren
- true to recursively add all childrenpublic void add(M parent, java.util.List<M> children, boolean addChildren)
parent
- the parentchildren
- the childrenaddChildren
- true to recursively add all childrenpublic void add(M parent, M item, boolean addChildren)
parent
- the parent itemitem
- the child itemaddChildren
- true to recursively add all childrenpublic void applyFilters(java.lang.String property)
Store
applyFilters
in class Store<M extends ModelData>
property
- the optional active propertypublic void clearFilters()
Store
clearFilters
in class Store<M extends ModelData>
public java.util.List<M> getAllItems()
public M getChild(int index)
index
- the index
public M getChild(M parent, int index)
parent
- the parent model or null if parent is rootindex
- the index
public int getChildCount()
public int getChildCount(M parent)
parent
- the parent
public java.util.List<M> getChildren(M parent)
parent
- the parent
public java.util.List<M> getChildren(M parent, boolean deep)
parent
- the parentdeep
- true to return all children recursively
public int getDepth(M item)
item
- the item
public M getFirstChild(M parent)
parent
- the parent
public M getLastChild(M parent)
parent
- the parent
public TreeLoader<M> getLoader()
public TreeStoreModel getModelState(M model)
TreeStoreModel.getModel()
method. The children of each tree model
contains tree model instances which wrap the actual child model.
model
- the model
public M getNextSibling(M item)
item
- the model
public M getParent(M item)
item
- the item
public M getPreviousSibling(M item)
item
- the item
public java.util.List<M> getRootItems()
public SortInfo getSortState()
public boolean hasChildren(M parent)
parent
- the parent model
public int indexOf(M item)
item
- the item
public void insert(java.util.List<M> models, int index, boolean addChildren)
models
- the models to insertindex
- the insert indexaddChildren
- true to recursively add all childrenpublic void insert(M item, int index, boolean addChildren)
item
- the item to insertindex
- the insert indexaddChildren
- true to recursively add all childrenpublic void insert(M parent, java.util.List<M> children, int index, boolean addChildren)
parent
- the parentchildren
- the childrenindex
- the insert indexaddChildren
- true to recursively add all childrenpublic void insert(M parent, M model, int index, boolean addChildren)
parent
- the parent modelmodel
- the child modelindex
- the insert indexaddChildren
- true to recursively add all childrenpublic void remove(M model)
model
- the item to be removedpublic void remove(M parent, M child)
parent
- the parent modelchild
- the child modelpublic void removeAll()
Store
removeAll
in class Store<M extends ModelData>
public void removeAll(M parent)
parent
- the parentpublic void setSortInfo(SortInfo info)
info
- the sort infopublic void setStoreSorter(StoreSorter<M> storeSorter)
Store
setStoreSorter
in class Store<M extends ModelData>
storeSorter
- the sorterpublic void sort(java.lang.String field, Style.SortDir sortDir)
field
- the field to sort bysortDir
- the sort dirprotected void applySort(boolean supressEvent)
applySort
in class Store<M extends ModelData>
protected void applySort(java.util.List<TreeModel> list)
protected TreeStoreEvent<M> createStoreEvent()
createStoreEvent
in class Store<M extends ModelData>
protected TreeModel findWrapper(M item)
protected void onBeforeLoad(LoadEvent le)
protected void onLoad(TreeLoadEvent le)
protected void onLoadException(LoadEvent le)
protected void onModelChange(ChangeEvent ce)
onModelChange
in class Store<M extends ModelData>
protected void swapModelInstance(M oldModel, M newModel)
swapModelInstance
in class Store<M extends ModelData>
protected java.util.List<M> unwrap(java.util.List<TreeModel> models)
protected M unwrap(TreeModel wrapper)
protected java.util.List<M> unwrapChildren(TreeModel parent)
protected TreeModel wrap(M model)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |