|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sencha.gxt.data.shared.Store<M>
com.sencha.gxt.data.shared.TreeStore<M>
M - the model typepublic class TreeStore<M>
A Store for hierarchical data. Parent-Child relationships are tracked
internally, and can be accessed through the getParent(Object) and
getChildren(Object) calls, and modified through the many add()
overrides or the remove(Object) method.
As with ListStore, all changes and data are relative to what is
currently visible, due to the Store.StoreFilters. As such, if filters
are active and structural changes are required, it might be necessary to
disable filters to make the change, re-enabling them when finished.
| Nested Class Summary | |
|---|---|
static interface |
TreeStore.TreeNode<T>
Simple interface to allow data to be imported/exported from a TreeStore, complete with the structure of the tree. |
| Nested classes/interfaces inherited from class com.sencha.gxt.data.shared.Store |
|---|
Store.Change<M,V>, Store.PropertyChange<M,V>, Store.Record, Store.StoreFilter<M>, Store.StoreSortInfo<M> |
| Constructor Summary | |
|---|---|
TreeStore(ModelKeyProvider<? super M> keyProvider)
Creates a tree store with the given key provider. |
|
| Method Summary | |
|---|---|
void |
add(List<M> rootNodes)
Adds the data models as roots of the tree. |
void |
add(M root)
Adds the given data model as a root of the tree. |
void |
add(M parent,
List<M> children)
Adds the list of children to the end of the visible children of the given parent model |
void |
add(M parent,
M child)
Adds the child to the end of the visible children of the parent model |
void |
addSubTree(int index,
List<? extends TreeStore.TreeNode<M>> children)
Imports a list of subtrees at the given position in the root of the tree. |
void |
addSubTree(M parent,
int index,
List<? extends TreeStore.TreeNode<M>> children)
Imports a list of subtrees to append to the given parent object already present in the tree. |
void |
applySort(boolean suppressEvent)
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. |
List<M> |
getAll()
Gets all visible items in the tree |
List<M> |
getAllChildren(M parent)
Recursively builds a list of all of the visible elements below the given one in the tree |
int |
getAllItemsCount()
Gets the total count of all visible items in the tree |
M |
getChild(int index)
Returns the root level child. |
int |
getChildCount(M parent)
Gets the number of visible children in the given node |
List<M> |
getChildren(M parent)
Gets the list of visible children attached to the given element |
int |
getDepth(M child)
Gets the depth of the given element in the tree, where 1 indicates that it is a root element of the tree. |
M |
getFirstChild(M parent)
Returns the fist child of the parent. |
M |
getLastChild(M parent)
Returns the last child of the parent. |
M |
getNextSibling(M item)
Returns the next sibling of the model. |
M |
getParent(M child)
Returns the parent of the given child. |
M |
getPreviousSibling(M item)
Returns the item's previous sibling. |
int |
getRootCount()
Gets the number of items at the root of the tree, that is, the number of visible items that have been added without specifying a parent. |
List<M> |
getRootItems()
Gets the visible items at the root of the tree. |
TreeStore.TreeNode<M> |
getSubTree(M parent)
Gets the full subtree model from the given parent node. |
boolean |
hasChildren(M item)
Returns true if the given node has visible children |
int |
indexOf(M item)
Returns the item's index in it's parent including root level items. |
void |
insert(int index,
List<M> rootNodes)
Inserts the given models at the given index in the list of root nodes |
void |
insert(int index,
M root)
Inserts the given model at the given index in the list of root nodes |
void |
insert(M parent,
int index,
List<M> children)
Inserts the child models at the given position in the parent's list of visible children. |
void |
insert(M parent,
int index,
M child)
Inserts the child model at the given position in the parent's list of visible children |
boolean |
remove(M model)
Removes the given model from the store. |
void |
removeChildren(M parent)
Removed the children of the given model from the store. |
void |
replaceChildren(M parent,
List<M> children)
Replaces the children of the given parent with a list of new child models. |
void |
replaceSubTree(M parent,
List<? extends TreeStore.TreeNode<M>> children)
Replaces the children of the given parent with a list of subtrees. |
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. |
| Methods inherited from class com.sencha.gxt.data.shared.Store |
|---|
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, setEnableFilters |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public TreeStore(ModelKeyProvider<? super M> keyProvider)
keyProvider - the key provider| Method Detail |
|---|
public void add(List<M> rootNodes)
rootNodes - the items to addpublic void add(M root)
root - the data model to add as a root
public void add(M parent,
List<M> children)
parent - the parent itemchildren - the items to insert
public void add(M parent,
M child)
parent - the parent data modelchild - the child data model
public void addSubTree(int index,
List<? extends TreeStore.TreeNode<M>> children)
index - the insert location of the new subtreechildren - the list of subtrees
public void addSubTree(M parent,
int index,
List<? extends TreeStore.TreeNode<M>> children)
parent - the parent data modelindex - the child indexchildren - the list of subtreespublic void applySort(boolean suppressEvent)
StoreStore.addSortInfo(StoreSortInfo),
Store.addSortInfo(int, StoreSortInfo), and Store.clearSortInfo().
applySort in class Store<M>suppressEvent - true to suppress event from firingpublic void clear()
Store
public M findModelWithKey(String key)
StoreModelKeyProvider as
necessary.
findModelWithKey in class Store<M>key - the key of the model to find
public List<M> getAll()
getAll in class Store<M>public List<M> getAllChildren(M parent)
parent - the parent data model
public int getAllItemsCount()
public M getChild(int index)
index - the index
public int getChildCount(M parent)
parent - the parent of the children
public List<M> getChildren(M parent)
parent - given element
public int getDepth(M child)
child - given element
public M getFirstChild(M parent)
parent - the parent
public M getLastChild(M parent)
parent - the parent
public M getNextSibling(M item)
item - the model
public M getParent(M child)
child - the given child
public M getPreviousSibling(M item)
item - the item
public int getRootCount()
public List<M> getRootItems()
public TreeStore.TreeNode<M> getSubTree(M parent)
parent - the model data representing the parent of the subtree
public boolean hasChildren(M item)
item - given node
public int indexOf(M item)
item - the item
public void insert(int index,
List<M> rootNodes)
index - the insert indexrootNodes - the items to insert
public void insert(int index,
M root)
index - the insert indexroot - the root item
public void insert(M parent,
int index,
List<M> children)
parent - the parent itemindex - the insert indexchildren - the items to insert
public void insert(M parent,
int index,
M child)
parent - the parent itemindex - the insert indexchild - the child itempublic boolean remove(M model)
StoreRemoveEvent if the element was visible.
model - the data model to remove
public void removeChildren(M parent)
StoreRemoveEvent for the models which were visible
parent - the parent of the children to remove
public void replaceChildren(M parent,
List<M> children)
parent - the parent data modelchildren - the list of child models
public void replaceSubTree(M parent,
List<? extends TreeStore.TreeNode<M>> children)
parent - the parent data modelchildren - the list of subtreespublic 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.
update in class Store<M>item - the new item to take its place in the Store.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||