com.extjs.gxt.ui.client.widget.treegrid
Class TreeGrid<M extends ModelData>

java.lang.Object
  extended by com.google.gwt.user.client.ui.UIObject
      extended by com.google.gwt.user.client.ui.Widget
          extended by com.extjs.gxt.ui.client.widget.Component
              extended by com.extjs.gxt.ui.client.widget.BoxComponent
                  extended by com.extjs.gxt.ui.client.widget.grid.Grid<M>
                      extended by com.extjs.gxt.ui.client.widget.treegrid.TreeGrid<M>
Type Parameters:
M - the model type
All Implemented Interfaces:
Observable, com.google.gwt.event.shared.HasHandlers, com.google.gwt.user.client.EventListener
Direct Known Subclasses:
EditorTreeGrid

public class TreeGrid<M extends ModelData>
extends Grid<M>

A hierarchical tree grid bound to a TreeStore.

A TreeGridCellRenderer can be assigned to the ColumnConfig in which the tree will be displayed.

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.


Nested Class Summary
 class TreeGrid.TreeNode
           
 
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
 
Fields inherited from class com.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIX
 
Constructor Summary
TreeGrid(TreeStore store, ColumnModel cm)
           
 
Method Summary
 TreeGrid.TreeNode findNode(com.google.gwt.user.client.Element target)
          Returns the tree node for the given target.
 ModelIconProvider<M> getIconProvider()
          Returns the model icon provider.
 TreeStyle getStyle()
          Returns the tree style.
 TreeStore<M> getTreeStore()
          Returns the tree's tree store.
 TreeGridView getTreeView()
          Returns the tree's view.
 boolean isExpanded(M model)
          Returns true if the model is expanded.
 boolean isLeaf(M model)
          Returns true if the model is a leaf node.
 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 setIconProvider(ModelIconProvider<M> iconProvider)
          Sets the tree's model icon provider which provides the icon style for each model.
 void setView(GridView view)
          Sets the view's grid (pre-render).
 void toggle(M model)
          Toggles the model's expand state.
 
Methods inherited from class com.extjs.gxt.ui.client.widget.grid.Grid
getAutoExpandColumn, getAutoExpandMax, getAutoExpandMin, getColumnModel, getLazyRowRender, getMinColumnWidth, getSelectionModel, getStore, getView, isEnableColumnResize, isHideHeaders, isLoadMask, isStripeRows, isTrackMouseOver, isViewReady, onComponentEvent, reconfigure, setAutoExpandColumn, setAutoExpandMax, setAutoExpandMin, setEnableColumnResize, setHideHeaders, setLazyRowRender, setLoadMask, setMinColumnWidth, setSelectionModel, setStringProvider, setStripeRows, setTrackMouseOver
 
Methods inherited from class com.extjs.gxt.ui.client.widget.BoxComponent
getBounds, getHeight, getHeight, getPosition, getShadow, getShadowOffset, getShadowPosition, getSize, getWidth, getWidth, isAutoHeight, isAutoWidth, isDeferHeight, isShim, 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.extjs.gxt.ui.client.widget.Component
addListener, addPlugin, addStyleName, addWidgetListener, clearState, disable, disableEvents, disableTextSelection, el, enable, enableEvents, fireEvent, fireEvent, fireEvent, fly, focus, getBaseStyle, getBorders, getContextMenu, getData, getElement, getHideMode, getId, getItemId, getListeners, getModel, getState, getStateId, getToolTip, hasListeners, hasListeners, hide, hideToolTip, isDisabledEvents, isEnabled, isRendered, isStateful, isVisible, mask, mask, mask, onBrowserEvent, recalculate, removeAllListeners, removeFromParent, removeListener, removeStyleName, removeSwallow, removeToolTip, removeWidgetListener, render, render, repaint, saveState, setBorders, setContextMenu, setData, setElement, setEnabled, setHideMode, setId, setIntStyleAttribute, setItemId, setStateful, setStateId, setStyleAttribute, setStyleName, setTitle, setToolTip, setToolTip, setVisible, setZIndex, show, sinkEvents, swallowEvent, swallowEvent, toString, unmask
 
Methods inherited from class com.google.gwt.user.client.ui.Widget
fireEvent, getParent, isAttached
 
Methods inherited from class com.google.gwt.user.client.ui.UIObject
addStyleDependentName, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getOffsetHeight, getOffsetWidth, getStyleName, getStylePrimaryName, getTitle, isVisible, removeStyleDependentName, setStylePrimaryName, setVisible, unsinkEvents
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TreeGrid

public TreeGrid(TreeStore store,
                ColumnModel cm)
Method Detail

findNode

public TreeGrid.TreeNode findNode(com.google.gwt.user.client.Element target)
Returns the tree node for the given target.

Parameters:
target - the target element
Returns:
the tree node or null if no match

getIconProvider

public ModelIconProvider<M> getIconProvider()
Returns the model icon provider.

Returns:
the icon provider

getStyle

public TreeStyle getStyle()
Returns the tree style.

Returns:
the tree style

getTreeStore

public TreeStore<M> getTreeStore()
Returns the tree's tree store.

Returns:
the tree store

getTreeView

public TreeGridView getTreeView()
Returns the tree's view.

Returns:
the view

isExpanded

public boolean isExpanded(M model)
Returns true if the model is expanded.

Parameters:
model - the model
Returns:
true if expanded

isLeaf

public boolean isLeaf(M model)
Returns true if the model is a leaf node. The leaf state allows a tree item to specify if it has children before the children have been realized.

Parameters:
model - the model
Returns:
the leaf state

setExpanded

public void setExpanded(M model,
                        boolean expand)
Sets the item's expand state.

Parameters:
model - the model
expand - true to expand

setExpanded

public void setExpanded(M model,
                        boolean expand,
                        boolean deep)
Sets the item's expand state.

Parameters:
model - the model
expand - true to expand
deep - true to expand all children recursively

setIconProvider

public void setIconProvider(ModelIconProvider<M> iconProvider)
Sets the tree's model icon provider which provides the icon style for each model.

Parameters:
iconProvider - the icon provider

setView

public void setView(GridView view)
Description copied from class: Grid
Sets the view's grid (pre-render).

Overrides:
setView in class Grid<M extends ModelData>
Parameters:
view - the view

toggle

public void toggle(M model)
Toggles the model's expand state.

Parameters:
model - the model