|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.google.gwt.user.client.ui.UIObject
com.google.gwt.user.client.ui.Widget
com.extjs.gxt.ui.client.widget.Component
com.extjs.gxt.ui.client.widget.BoxComponent
com.extjs.gxt.ui.client.widget.treepanel.TreePanel<M>
M
- the model typepublic class TreePanel<M extends ModelData>
A hierarchical tree widget bound directly to a @link TreeStore
.
TreePanel
contains no child widgets, rather, the tree is
rendered based on the models contained in the tree store. Once bound, the
tree will remain in sync with the bound tree store.
setDisplayProperty(String)
. The
is useful when the item's text is contained within the model's data. Second,
a model string provider can be specified using
setLabelProvider(ModelStringProvider)
.
With state enabled, TreePanel will save and restore the expand state of the
nodes in the tree. A ModelKeyProvider
must specified with the
TreeStore
this tree is bound to. Save and restore works with
both local, and asynchronous loading of children.
BaseEvent.setCancelled(boolean)
.BaseEvent.setCancelled(boolean)
.BaseEvent.setCancelled(boolean)
.
Nested Class Summary | |
---|---|
static class |
TreePanel.CheckCascade
Check cascade enum. |
static class |
TreePanel.CheckNodes
Check nodes enum. |
static class |
TreePanel.Joint
Joint enum. |
class |
TreePanel.TreeNode
Maintains the internal state of nodes contained in the tree. |
Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject |
---|
com.google.gwt.user.client.ui.UIObject.DebugIdImpl, com.google.gwt.user.client.ui.UIObject.DebugIdImplEnabled |
Field Summary | |
---|---|
protected java.util.Map<M,java.lang.String> |
cache
|
protected java.lang.String |
displayProperty
|
protected boolean |
filtering
|
protected java.lang.String |
itemSelector
|
protected TreeLoader<M> |
loader
|
protected java.util.Map<java.lang.String,TreePanel.TreeNode> |
nodes
|
protected TreePanelSelectionModel<M> |
sm
|
protected TreeStore<M> |
store
|
protected TreePanelView<M> |
view
|
Fields inherited from class com.extjs.gxt.ui.client.widget.BoxComponent |
---|
adjustSize, cacheSizes, ensureVisibilityOnSizing, height, lastSize, layer, shim, width |
Fields inherited from class com.extjs.gxt.ui.client.widget.Component |
---|
afterRender, attachables, baseStyle, disabled, disabledStyle, disableTextSelection, dummy, focusable, hidden, mask, maskMessage, maskMessageStyleName, monitorWindowResize, rendered, resizeHandler, setElementRender, stateId, swallowEvents, toolTip, windowResizeDelay, windowResizeTask |
Fields inherited from class com.google.gwt.user.client.ui.UIObject |
---|
DEBUG_ID_PREFIX |
Constructor Summary | |
---|---|
TreePanel(TreeStore<M> store)
Creates a new tree panel. |
Method Summary | |
---|---|
void |
addCheckListener(CheckChangedListener<M> listener)
Adds the check change listener. |
protected TreePanel.Joint |
calcualteJoint(M model)
|
protected com.google.gwt.user.client.ui.AbstractImagePrototype |
calculateIconStyle(M model)
|
protected void |
clean()
|
protected void |
clear()
|
void |
collapseAll()
Collapses all nodes. |
protected ComponentEvent |
createComponentEvent(com.google.gwt.user.client.Event event)
|
protected void |
doClean()
|
protected void |
doUpdate()
|
void |
expandAll()
Expands all nodes. |
TreePanel.TreeNode |
findNode(com.google.gwt.user.client.Element target)
Returns the tree node for the given target. |
protected TreePanel.TreeNode |
findNode(M m)
|
protected java.lang.String |
generateModelId(M m)
|
java.util.List<M> |
getCheckedSelection()
Returns the current checked selection. |
TreePanel.CheckNodes |
getCheckNodes()
Returns the child nodes value which determines what node types have a check box. |
TreePanel.CheckCascade |
getCheckStyle()
The check cascade style value which determines if check box changes cascade to parent and children. |
protected java.util.List<M> |
getChildModel(java.util.List<M> l,
boolean onlyVisible)
|
protected com.google.gwt.user.client.Element |
getContainer(M model)
|
java.lang.String |
getDisplayProperty()
Returns the display property. |
ModelIconProvider<M> |
getIconProvider()
Returns the model icon provider. |
ModelProcessor<M> |
getModelProcessor()
Returns the model processor. |
TreePanelSelectionModel<M> |
getSelectionModel()
Returns the tree's selection model. |
TreeStore<M> |
getStore()
Returns the tree's store. |
TreeStyle |
getStyle()
Returns the tree style. |
protected java.lang.String |
getText(M model)
|
TreePanelView<M> |
getView()
Returns the tree's view. |
protected int |
getVisibleRowCount()
|
protected boolean |
hasChildren(M model)
|
boolean |
isAutoExpand()
Returns true if auto expand is enabled. |
boolean |
isAutoLoad()
Returns true if auto load is enabled. |
boolean |
isAutoSelect()
Returns true if select on load is enabled. |
boolean |
isCaching()
Returns true when a loader is queried for it's children each time a node is expanded. |
boolean |
isCheckable()
Returns true if check boxes are enabled. |
protected boolean |
isCheckable(TreePanel.TreeNode node)
|
boolean |
isChecked(M model)
Returns true if the model is checked. |
boolean |
isExpanded(M model)
Returns true if the model is expanded. |
boolean |
isExpandOnFilter()
Returns the if expand all and collapse all is enabled on filter changes. |
boolean |
isLeaf(M model)
Returns true if the model is a leaf node. |
boolean |
isTrackMouseOver()
Returns true if nodes are highlighted on mouse over. |
protected void |
notifyShow()
|
protected void |
onAdd(TreeStoreEvent<M> se)
|
protected void |
onAttach()
|
protected void |
onCheckCascade(M model,
boolean checked)
|
protected void |
onCheckClick(TreePanelEvent tpe,
TreePanel.TreeNode node)
|
protected void |
onClear(TreeStoreEvent<M> se)
|
protected void |
onClick(TreePanelEvent tpe)
|
protected void |
onCollapse(M model,
TreePanel.TreeNode node,
boolean deep)
|
void |
onComponentEvent(ComponentEvent ce)
Any events a component receives will be forwarded to this method. |
protected void |
onDataChanged(TreeStoreEvent<M> se)
|
protected void |
onDoubleClick(TreePanelEvent tpe)
|
protected void |
onExpand(M model,
TreePanel.TreeNode node,
boolean deep)
|
protected void |
onFilter(TreeStoreEvent<M> se)
|
protected void |
onFocus(ComponentEvent ce)
|
protected void |
onRemove(TreeStoreEvent<M> se)
|
protected void |
onRender(com.google.gwt.user.client.Element target,
int index)
Subclasses must override and ensure setElement is called for lazy rendered components. |
protected void |
onResize(int width,
int height)
Called after the component is resized, this method is empty by default but can be implemented by any subclass that needs to perform custom logic after a resize occurs. |
protected void |
onScroll(TreePanelEvent<M> tpe)
|
protected void |
onUpdate(TreeStoreEvent<M> se)
|
protected M |
prepareData(M model)
|
void |
recalculate()
Called when the component is in a LayoutContainer and the container's layout executes. |
protected void |
refresh(M model)
|
protected java.lang.String |
register(M m)
|
void |
removeCheckListener(CheckChangedListener<M> listener)
Removes the check change listener. |
protected java.lang.String |
renderChild(M parent,
M child,
int depth,
TreePanelView.TreeViewRenderMode renderMode)
|
protected void |
renderChildren(M parent)
|
void |
scrollIntoView(M model)
Scrolls the tree to ensure the given model is visible. |
void |
setAutoExpand(boolean autoExpand)
If set to true, all non leaf nodes will be expanded automatically (defaults to false). |
void |
setAutoLoad(boolean autoLoad)
Sets whether all children should automatically be loaded recursively (defaults to false). |
void |
setAutoSelect(boolean autoSelect)
True to select the first model after the store's data changes (defaults to false). |
void |
setCaching(boolean caching)
Sets whether the children should be cached after first being retrieved from the store (defaults to true). |
void |
setCheckable(boolean checkable)
Sets whether check boxes are used in the tree. |
void |
setChecked(M item,
boolean checked)
Sets the check state of the item. |
void |
setCheckedSelection(java.util.List<M> selection)
Sets the current checked selection. |
void |
setCheckNodes(TreePanel.CheckNodes checkNodes)
Sets which tree items will display a check box (defaults to BOTH). |
void |
setCheckStyle(TreePanel.CheckCascade checkStyle)
Sets the cascading behavior for check tree (defaults to PARENTS). |
void |
setDisplayProperty(java.lang.String displayProperty)
Sets the display property name used to the item's text. |
void |
setExpanded(M model,
boolean expand)
Sets the item's expand state. |
void |
setExpanded(M model,
boolean expand,
boolean deep)
Sets the item's expand state. |
void |
setExpandOnFilter(boolean expandOnFilter)
Sets whether the tree should expand all and collapse all when filters are applied (defaults to true). |
void |
setIconProvider(ModelIconProvider<M> iconProvider)
Sets the tree's model icon provider which provides the icon style for each model. |
void |
setLabelProvider(ModelStringProvider<M> labelProvider)
Sets the tree's model string provider for the text description of each node. |
void |
setLeaf(M model,
boolean leaf)
Sets the item's leaf state. |
void |
setModelProcessor(ModelProcessor<M> modelProcessor)
Sets the treepanels's model processor. |
void |
setSelectionModel(TreePanelSelectionModel<M> sm)
Sets the tree's selection model. |
void |
setStyle(TreeStyle style)
Sets the tree style. |
void |
setTrackMouseOver(boolean trackMouseOver)
True to highlight nodes when the mouse is over (defaults to true). |
void |
setView(TreePanelView<M> view)
Sets the tree's view. |
void |
toggle(M model)
Toggles the model's expand state. |
protected void |
unregister(M m)
|
protected void |
update()
|
Methods inherited from class com.extjs.gxt.ui.client.widget.BoxComponent |
---|
adjustPosition, adjustSize, afterRender, getBounds, getHeight, getHeight, getPosition, getPositionEl, getResizeEl, getShadow, getShadowOffset, getShadowPosition, getSize, getWidth, getWidth, hideShadow, hideShim, hideUnders, isAutoHeight, isAutoWidth, isDeferHeight, isShim, onHide, onPosition, onShow, onUnload, setAutoHeight, setAutoWidth, setBounds, setBounds, setDeferHeight, setHeight, setHeight, setPagePosition, setPagePosition, setPixelSize, setPosition, setShadow, setShadowOffset, setShadowPosition, setShim, setSize, setSize, setWidth, setWidth, sync, syncSize |
Methods inherited from class com.google.gwt.user.client.ui.Widget |
---|
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, fireEvent, getHandlerCount, getLayoutData, getParent, isAttached, isOrWasAttached, setLayoutData |
Methods inherited from class com.google.gwt.user.client.ui.UIObject |
---|
addStyleDependentName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, isVisible, removeStyleDependentName, setElement, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setVisible, sinkBitlessEvent, unsinkEvents |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected java.util.Map<M extends ModelData,java.lang.String> cache
protected java.lang.String displayProperty
protected boolean filtering
protected java.lang.String itemSelector
protected TreeLoader<M extends ModelData> loader
protected java.util.Map<java.lang.String,TreePanel.TreeNode> nodes
protected TreePanelSelectionModel<M extends ModelData> sm
protected TreeStore<M extends ModelData> store
protected TreePanelView<M extends ModelData> view
Constructor Detail |
---|
public TreePanel(TreeStore<M> store)
store
- the tree storeMethod Detail |
---|
public void addCheckListener(CheckChangedListener<M> listener)
CheckProvider
addCheckListener
in interface CheckProvider<M extends ModelData>
listener
- the listener to be addedpublic void collapseAll()
public void expandAll()
public TreePanel.TreeNode findNode(com.google.gwt.user.client.Element target)
target
- the target element
public java.util.List<M> getCheckedSelection()
CheckProvider
getCheckedSelection
in interface CheckProvider<M extends ModelData>
public TreePanel.CheckNodes getCheckNodes()
setCheckable(boolean)
.
public TreePanel.CheckCascade getCheckStyle()
public java.lang.String getDisplayProperty()
public ModelIconProvider<M> getIconProvider()
public ModelProcessor<M> getModelProcessor()
public TreePanelSelectionModel<M> getSelectionModel()
public TreeStore<M> getStore()
public TreeStyle getStyle()
public TreePanelView<M> getView()
public boolean isAutoExpand()
public boolean isAutoLoad()
public boolean isAutoSelect()
public boolean isCaching()
public boolean isCheckable()
public boolean isChecked(M model)
CheckProvider
isChecked
in interface CheckProvider<M extends ModelData>
model
- the model
public boolean isExpanded(M model)
model
- the model
public boolean isExpandOnFilter()
public boolean isLeaf(M model)
model
- the model
public boolean isTrackMouseOver()
public void onComponentEvent(ComponentEvent ce)
Component
Component.onBrowserEvent(com.google.gwt.user.client.Event)
method
should not be overridden or modified.
onComponentEvent
in class Component
ce
- the base eventpublic void recalculate()
Component
recalculate
in class Component
public void removeCheckListener(CheckChangedListener<M> listener)
CheckProvider
removeCheckListener
in interface CheckProvider<M extends ModelData>
listener
- the listener to be removedpublic void scrollIntoView(M model)
model
- the model to scroll into viewpublic void setAutoExpand(boolean autoExpand)
autoExpand
- the auto expand state to set.public void setAutoLoad(boolean autoLoad)
autoLoad
- true to auto loadpublic void setAutoSelect(boolean autoSelect)
autoSelect
- true to auto selectpublic void setCaching(boolean caching)
false
, a load request will
be made each time a node is expanded.
caching
- the caching statepublic void setCheckable(boolean checkable)
checkable
- true for check boxespublic void setChecked(M item, boolean checked)
setAutoLoad(boolean)
can be used to
render all children.
item
- the itemchecked
- true for checkedpublic void setCheckedSelection(java.util.List<M> selection)
CheckProvider
setCheckedSelection
in interface CheckProvider<M extends ModelData>
selection
- the checked selectionpublic void setCheckNodes(TreePanel.CheckNodes checkNodes)
Valid values are:
checkNodes
- the child nodes valuepublic void setCheckStyle(TreePanel.CheckCascade checkStyle)
setAutoLoad(boolean)
can be used to
fully render the tree on render.
Valid values are:
checkStyle
- the child stylepublic void setDisplayProperty(java.lang.String displayProperty)
ModelStringProvider
can be specified using
setLabelProvider(ModelStringProvider)
.
displayProperty
- the property namepublic void setExpanded(M model, boolean expand)
model
- the modelexpand
- true to expandpublic void setExpanded(M model, boolean expand, boolean deep)
model
- the modelexpand
- true to expanddeep
- true to expand all children recursivelypublic void setExpandOnFilter(boolean expandOnFilter)
expandOnFilter
- true to expand and collapse on filter changespublic void setIconProvider(ModelIconProvider<M> iconProvider)
iconProvider
- the icon providerpublic void setLabelProvider(ModelStringProvider<M> labelProvider)
null
will be passed.
labelProvider
- the label providerpublic void setLeaf(M model, boolean leaf)
model
- the modelleaf
- the leaf statepublic void setModelProcessor(ModelProcessor<M> modelProcessor)
modelProcessor
- ModelProcessor
public void setSelectionModel(TreePanelSelectionModel<M> sm)
sm
- the selection modelpublic void setStyle(TreeStyle style)
style
- the tree stylepublic void setTrackMouseOver(boolean trackMouseOver)
trackMouseOver
- true to highlight nodes on mouse overpublic void setView(TreePanelView<M> view)
view
- the viewpublic void toggle(M model)
model
- the modelprotected TreePanel.Joint calcualteJoint(M model)
protected com.google.gwt.user.client.ui.AbstractImagePrototype calculateIconStyle(M model)
protected void clean()
protected void clear()
protected ComponentEvent createComponentEvent(com.google.gwt.user.client.Event event)
createComponentEvent
in class BoxComponent
protected void doClean()
protected void doUpdate()
protected TreePanel.TreeNode findNode(M m)
protected java.lang.String generateModelId(M m)
protected java.util.List<M> getChildModel(java.util.List<M> l, boolean onlyVisible)
protected com.google.gwt.user.client.Element getContainer(M model)
protected java.lang.String getText(M model)
protected int getVisibleRowCount()
protected boolean hasChildren(M model)
protected boolean isCheckable(TreePanel.TreeNode node)
protected void notifyShow()
notifyShow
in class Component
protected void onAdd(TreeStoreEvent<M> se)
protected void onAttach()
onAttach
in class Component
protected void onCheckCascade(M model, boolean checked)
protected void onCheckClick(TreePanelEvent tpe, TreePanel.TreeNode node)
protected void onClear(TreeStoreEvent<M> se)
protected void onClick(TreePanelEvent tpe)
protected void onCollapse(M model, TreePanel.TreeNode node, boolean deep)
protected void onDataChanged(TreeStoreEvent<M> se)
protected void onDoubleClick(TreePanelEvent tpe)
protected void onExpand(M model, TreePanel.TreeNode node, boolean deep)
protected void onFilter(TreeStoreEvent<M> se)
protected void onFocus(ComponentEvent ce)
protected void onRemove(TreeStoreEvent<M> se)
protected void onRender(com.google.gwt.user.client.Element target, int index)
Component
onRender
in class Component
target
- the target elementindex
- the insert locationprotected void onResize(int width, int height)
BoxComponent
onResize
in class BoxComponent
width
- the widthheight
- the heightprotected void onScroll(TreePanelEvent<M> tpe)
protected void onUpdate(TreeStoreEvent<M> se)
protected M prepareData(M model)
protected void refresh(M model)
protected java.lang.String register(M m)
protected java.lang.String renderChild(M parent, M child, int depth, TreePanelView.TreeViewRenderMode renderMode)
protected void renderChildren(M parent)
protected void unregister(M m)
protected void update()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |