com.extjs.gxt.ui.client.widget.tree
Class Tree

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.Container<TreeItem>
                      extended by com.extjs.gxt.ui.client.widget.tree.Tree
All Implemented Interfaces:
Observable, Selectable<TreeItem>, com.google.gwt.event.logical.shared.HasAttachHandlers, com.google.gwt.event.shared.HasHandlers, com.google.gwt.user.client.EventListener, com.google.gwt.user.client.ui.IsWidget
Direct Known Subclasses:
TreeTable

Deprecated. see TreePanel

public class Tree
extends Container<TreeItem>
implements Selectable<TreeItem>

A standard hierarchical tree widget. The tree contains a hierarchy of TreeItems that the user can open, close, and select.

The root item cannot be displayed.

Events:
BeforeAdd : TreeEvent(item, child, index)
Fires before a item is added or inserted. Listeners can cancel the action by calling BaseEvent.setCancelled(boolean).
BeforeRemove : TreeEvent(item, child)
Fires before a item is removed. Listeners can cancel the action by calling BaseEvent.setCancelled(boolean).
BeforeExpand : TreeEvent(item)
Fires before a item is expanded. Listeners can cancel the action by calling BaseEvent.setCancelled(boolean).
BeforeCollapse : TreeEvent(item)
Fires before a item is collapsed. Listeners can cancel the action by calling BaseEvent.setCancelled(boolean).
Add : TreeEvent(item, child, index)
Fires after a item has been added or inserted.
Remove : TreeEvent(tree, item, child)
Fires after a item has been removed.
BeforeSelect : TreeEvent(tree, item)
Fires before a item is selected. Listeners can cancel the action by calling BaseEvent.setCancelled(boolean).
SelectionChange : TreeEvent(tree, selected)
Fires after the tree selection changes.
Expand : TreeEvent(tree, item)
Fires after a item has been expanded.
Collapse : TreeEvent(tree, item)
Fires after a item is collapsed.
CheckChange : TreeEvent(tree, item)
Fires after a check state change.
ContextMenu : TreeEvent(tree)
Fires before the tree's context menu is shown.
KeyPress : TreeEvent(tree, event)
Fires when a key is pressed.
Inherited Events:
BoxComponent Move
BoxComponent Resize
Component Enable
Component Disable
Component BeforeHide
Component Hide
Component BeforeShow
Component Show
Component Attach
Component Detach
Component BeforeRender
Component Render
Component BrowserEvent
Component BeforeStateRestore
Component StateRestore
Component BeforeStateSave
Component SaveState
CSS:
.my-tree (the tree itself)
.my-tree-item-text span (the tree item text)


Nested Class Summary
static class Tree.CheckCascade
          Deprecated. Check cascade enum.
static class Tree.CheckNodes
          Deprecated. Check nodes enum.
static class Tree.Joint
          Deprecated. Joint enum.
 
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
static java.lang.String DEFAULT_TREE_ITEM_ID
          Deprecated.  
static java.lang.String FAST_TREE_ITEM_ID
          Deprecated.  
protected  boolean isViewer
          Deprecated.  
protected  TreeItem root
          Deprecated.  
protected  TreeSelectionModel sm
          Deprecated.  
 
Fields inherited from class com.extjs.gxt.ui.client.widget.Container
attachChildren, enableLayout, layoutExecuted, layoutNeeded, layoutOnAttach, layoutOnChange
 
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
Tree()
          Deprecated. Creates a new single select tree.
 
Method Summary
 void collapseAll()
          Deprecated. Collapses all item's.
protected  ComponentEvent createComponentEvent(com.google.gwt.user.client.Event event)
          Deprecated.  
protected  ContainerEvent createContainerEvent(TreeItem item)
          Deprecated.  
protected  void createRootItem()
          Deprecated.  
 void expandAll()
          Deprecated. Expands all item's.
 boolean expandPath(java.lang.String path)
          Deprecated. Expands a specified path.
 TreeItem findItem(com.google.gwt.user.client.Element element)
          Deprecated. Returns the tree whose element or child elements match the passed target.
 int getAllItemCount()
          Deprecated. Returns the total number of items contained in the tree excluding the root item.
 java.util.List<TreeItem> getAllItems()
          Deprecated. Returns all tree item's contained by the tree.
 boolean getAnimate()
          Deprecated. Returns true if animations are enabled.
 boolean getCheckable()
          Deprecated. Returns true if check boxs are enabled.
 java.util.List<TreeItem> getChecked()
          Deprecated. Returns a list of id's for all checked items.
 Tree.CheckNodes getCheckNodes()
          Deprecated. Returns the child nodes value.
 Tree.CheckCascade getCheckStyle()
          Deprecated. The check style value.
 Menu getContextMenu()
          Deprecated. Returns the component's context menu.
 int getIndentWidth()
          Deprecated. Returns the indent width.
 TreeItem getItem(int index)
          Deprecated. Returns the item at the given index or null if index out of bounds.
 TreeItem getItemById(java.lang.String id)
          Deprecated. Returns the item by id.
 java.lang.String getItemIconStyle()
          Deprecated. see TreeStyle.getLeafIconStyle()
 java.lang.String getItemSelector()
          Deprecated. Returns the item selector.
 java.lang.String getNodeIconStyle()
          Deprecated. see TreeStyle.getNodeCloseIconStyle()
 java.lang.String getOpenNodeIconStyle()
          Deprecated. see TreeStyle.getNodeOpenIconStyle()
 TreeItem getRootItem()
          Deprecated. Returns the tree's root item.
 TreeItem getSelectedItem()
          Deprecated. Returns the selected item.
 java.util.List<TreeItem> getSelectedItems()
          Deprecated. Returns the selected items.
 Style.SelectionMode getSelectionMode()
          Deprecated.  
 TreeSelectionModel getSelectionModel()
          Deprecated. Returns the tree's selection model.
 TreeStyle getStyle()
          Deprecated. Returns the tree's style.
 java.lang.String getTreeItemPartId()
          Deprecated. Returns the tree item part id.
 void onComponentEvent(ComponentEvent ce)
          Deprecated. Any events a component receives will be forwarded to this method.
protected  void onFocus(ComponentEvent ce)
          Deprecated.  
protected  void onRender(com.google.gwt.user.client.Element target, int index)
          Deprecated. Subclasses must override and ensure setElement is called for lazy rendered components.
 void onSelectChange(TreeItem item, boolean select)
          Deprecated. Called when the visual state of a item is changed.
 boolean removeAll()
          Deprecated. Removes all the container's items.
 void setAnimate(boolean animate)
          Deprecated. Sets whether expand /collapse should be animated (defaults to true).
 void setCheckable(boolean checkable)
          Deprecated. Sets whether checkboxes are used in the tree.
 void setCheckNodes(Tree.CheckNodes checkNodes)
          Deprecated. Sets which tree items will display a check box (defaults to BOTH).
 void setCheckStyle(Tree.CheckCascade checkStyle)
          Deprecated. Sets the cascading behavior for check tree (defaults to PARENTS).
 void setContextMenu(Menu menu)
          Deprecated. Sets the component's context menu.
 void setIndentWidth(int indentWidth)
          Deprecated. Sets the number of pixels child items are indented.
 void setItemIconStyle(java.lang.String itemImageStyle)
          Deprecated. see TreeStyle.setLeafIconStyle(String)
 void setItemSelector(java.lang.String itemSelector)
          Deprecated. Sets the CSS selector used to retrieve tree items after bulk rendering (defaults to '.x-tree-item').
 void setNodeIconStyle(java.lang.String nodeIconStyle)
          Deprecated. see TreeStyle.setNodeCloseIconStyle(String)
 void setOpenNodeIconStyle(java.lang.String openNodeIconStyle)
          Deprecated. see TreeStyle.setNodeOpenIconStyle(String)
 void setSelectedItem(TreeItem item)
          Deprecated. Selects the item.
 void setSelectedItems(java.util.List<TreeItem> items)
          Deprecated. Selects the items.
 void setSelectionMode(Style.SelectionMode mode)
          Deprecated. Sets the table's selection mode.
 void setSelectionModel(TreeSelectionModel sm)
          Deprecated. Sets the tree's selection model.
 void setTreeItemPartId(java.lang.String treeItemPartId)
          Deprecated. Sets the part id used to obtain new tree item ui instances (defaults to "tree.item.default".
 
Methods inherited from class com.extjs.gxt.ui.client.widget.Container
add, adjustIndex, adopt, disable, doAttachChildren, doDetachChildren, doLayout, doLayout, enable, getItemByItemId, getItemCount, getItems, getLayout, getLayoutTarget, getWidget, indexOf, insert, isLayoutNeeded, iterator, layout, layout, notifyHide, notifyShow, onAfterLayout, onAttach, onBeforeLayoutExcecuted, onInsert, onLayoutExcecuted, onRemove, orphan, remove, remove, removeAll, scrollIntoView, setLayout, setLayoutNeeded, setLayoutOnChange, wrapWidget
 
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, onResize, 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.extjs.gxt.ui.client.widget.Component
addAttachable, addListener, addPlugin, addStyleName, addStyleOnOver, addWidgetListener, applyState, assertAfterRender, assertPreRender, beforeRender, blur, clearState, createObservable, createStyles, disableContextMenu, disableEvents, disableTextSelection, el, enableEvents, fireEvent, fireEvent, fireEvent, fly, focus, frame, getAriaSupport, getBaseStyle, getBorders, getData, getElement, getFocusEl, getFocusSupport, getHideMode, getId, getItemId, getListeners, getModel, getObservable, getPlugins, getState, getStateId, getTabIndex, getTitle, getToolTip, getWindowResizeDelay, hasListeners, hasListeners, hide, hideToolTip, initState, isDisabledEvents, isDisableTextSelection, isEnabled, isMasked, isMonitorWindowResize, isRendered, isStateful, isVisible, isVisible, mask, mask, mask, onBrowserEvent, onDetach, onDetachHelper, onDisable, onEnable, onEnsureDebugId, onHideContextMenu, onLoad, onRightClick, onShowContextMenu, onWindowResize, previewEvent, recalculate, removeAllListeners, removeAttachagle, removeFromParent, removeListener, removeStyleName, removeStyleOnOver, removeSwallow, removeToolTip, removeWidgetListener, render, render, repaint, saveState, setAriaRole, setAriaState, setAriaSupport, setBorders, setData, setEl, setElement, setElement, setEnabled, setFiresEvents, setHideMode, setId, setIntStyleAttribute, setItemId, setModel, setMonitorWindowResize, setParent, setStateful, setStateId, setStyleAttribute, setStyleName, setTabIndex, setTitle, setToolTip, setToolTip, setVisible, setWindowResizeDelay, setZIndex, show, sinkEvents, swallowEvent, swallowEvent, toString, unframe, unmask
 
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

DEFAULT_TREE_ITEM_ID

public static final java.lang.String DEFAULT_TREE_ITEM_ID
Deprecated. 
See Also:
Constant Field Values

FAST_TREE_ITEM_ID

public static final java.lang.String FAST_TREE_ITEM_ID
Deprecated. 
See Also:
Constant Field Values

isViewer

protected boolean isViewer
Deprecated. 

root

protected TreeItem root
Deprecated. 

sm

protected TreeSelectionModel sm
Deprecated. 
Constructor Detail

Tree

public Tree()
Deprecated. 
Creates a new single select tree.

Method Detail

getItemSelector

public java.lang.String getItemSelector()
Deprecated. 
Returns the item selector.

Returns:
the item selector

setItemSelector

public void setItemSelector(java.lang.String itemSelector)
Deprecated. 
Sets the CSS selector used to retrieve tree items after bulk rendering (defaults to '.x-tree-item').

Parameters:
itemSelector - the item selector

collapseAll

public void collapseAll()
Deprecated. 
Collapses all item's.


expandAll

public void expandAll()
Deprecated. 
Expands all item's.


expandPath

public boolean expandPath(java.lang.String path)
Deprecated. 
Expands a specified path. A path can be retrieved from a tree item with TreeItem.getPath().

Parameters:
path - the path to expand
Returns:
true if all paths expanded

findItem

public TreeItem findItem(com.google.gwt.user.client.Element element)
Deprecated. 
Returns the tree whose element or child elements match the passed target.

Overrides:
findItem in class Container<TreeItem>
Parameters:
element - the target element
Returns:
the matching tree item or null if no match

getAllItemCount

public int getAllItemCount()
Deprecated. 
Returns the total number of items contained in the tree excluding the root item.

Returns:
the total item count

getAllItems

public java.util.List<TreeItem> getAllItems()
Deprecated. 
Returns all tree item's contained by the tree.

Returns:
all tree item's

getAnimate

public boolean getAnimate()
Deprecated. 
Returns true if animations are enabled.

Returns:
the animate state

getCheckable

public boolean getCheckable()
Deprecated. 
Returns true if check boxs are enabled.

Returns:
the checkbox state

getChecked

public java.util.List<TreeItem> getChecked()
Deprecated. 
Returns a list of id's for all checked items.

Returns:
the list of checked id's

getCheckNodes

public Tree.CheckNodes getCheckNodes()
Deprecated. 
Returns the child nodes value.

Returns:
the child nodes value

getCheckStyle

public Tree.CheckCascade getCheckStyle()
Deprecated. 
The check style value.

Returns:
the check style

getContextMenu

public Menu getContextMenu()
Deprecated. 
Description copied from class: Component
Returns the component's context menu.

Overrides:
getContextMenu in class Component
Returns:
the context menu

getIndentWidth

public int getIndentWidth()
Deprecated. 
Returns the indent width.

Returns:
the indent width

getItem

public TreeItem getItem(int index)
Deprecated. 
Description copied from class: Container
Returns the item at the given index or null if index out of bounds.

Overrides:
getItem in class Container<TreeItem>
Parameters:
index - the index
Returns:
the item

getItemById

public TreeItem getItemById(java.lang.String id)
Deprecated. 
Returns the item by id.

Parameters:
id - the id of the element to return
Returns:
the item

getItemIconStyle

public java.lang.String getItemIconStyle()
Deprecated. see TreeStyle.getLeafIconStyle()

Returns the item icon style.

Returns:
the icon style

getNodeIconStyle

public java.lang.String getNodeIconStyle()
Deprecated. see TreeStyle.getNodeCloseIconStyle()

Returns the node icon style.

Returns:
the icon style

getOpenNodeIconStyle

public java.lang.String getOpenNodeIconStyle()
Deprecated. see TreeStyle.getNodeOpenIconStyle()

Returns the open node icon style.

Returns:
the icon style

getRootItem

public TreeItem getRootItem()
Deprecated. 
Returns the tree's root item. The root item cannot be displayed.

Returns:
the root item

getSelectedItem

public TreeItem getSelectedItem()
Deprecated. 
Returns the selected item.

Specified by:
getSelectedItem in interface Selectable<TreeItem>
Returns:
the item

getSelectedItems

public java.util.List<TreeItem> getSelectedItems()
Deprecated. 
Returns the selected items.

Specified by:
getSelectedItems in interface Selectable<TreeItem>
Returns:
the selected items

getSelectionMode

public Style.SelectionMode getSelectionMode()
Deprecated. 

getSelectionModel

public TreeSelectionModel getSelectionModel()
Deprecated. 
Returns the tree's selection model.

Returns:
the selection model

getStyle

public TreeStyle getStyle()
Deprecated. 
Returns the tree's style.

Returns:
the tree style

getTreeItemPartId

public java.lang.String getTreeItemPartId()
Deprecated. 
Returns the tree item part id.

Returns:
the part id

onComponentEvent

public void onComponentEvent(ComponentEvent ce)
Deprecated. 
Description copied from class: Component
Any events a component receives will be forwarded to this method. Subclasses should override as needed. The Component.onBrowserEvent(com.google.gwt.user.client.Event) method should not be overridden or modified.

Overrides:
onComponentEvent in class Component
Parameters:
ce - the base event

onFocus

protected void onFocus(ComponentEvent ce)
Deprecated. 

onSelectChange

public void onSelectChange(TreeItem item,
                           boolean select)
Deprecated. 
Description copied from interface: Selectable
Called when the visual state of a item is changed.

Specified by:
onSelectChange in interface Selectable<TreeItem>
Parameters:
item - the item
select - the select state

removeAll

public boolean removeAll()
Deprecated. 
Description copied from class: Container
Removes all the container's items.

Overrides:
removeAll in class Container<TreeItem>
Returns:
true if all items where removed

setAnimate

public void setAnimate(boolean animate)
Deprecated. 
Sets whether expand /collapse should be animated (defaults to true).

Parameters:
animate - the animate state

setCheckable

public void setCheckable(boolean checkable)
Deprecated. 
Sets whether checkboxes are used in the tree.

Parameters:
checkable - true for checkboxes

setCheckNodes

public void setCheckNodes(Tree.CheckNodes checkNodes)
Deprecated. 
Sets which tree items will display a check box (defaults to BOTH).

Valid values are:

Parameters:
checkNodes - the child nodes value

setCheckStyle

public void setCheckStyle(Tree.CheckCascade checkStyle)
Deprecated. 
Sets the cascading behavior for check tree (defaults to PARENTS).

Valid values are:

Parameters:
checkStyle - the child style

setContextMenu

public void setContextMenu(Menu menu)
Deprecated. 
Description copied from class: Component
Sets the component's context menu.

Overrides:
setContextMenu in class Component
Parameters:
menu - the context menu

setIndentWidth

public void setIndentWidth(int indentWidth)
Deprecated. 
Sets the number of pixels child items are indented. Default value is 18.

Parameters:
indentWidth - the indent width

setItemIconStyle

public void setItemIconStyle(java.lang.String itemImageStyle)
Deprecated. see TreeStyle.setLeafIconStyle(String)

Sets the global icon style for leaf tree items. Individual tree items can override this value by setting the the item's icon style.

Parameters:
itemImageStyle - the image style

setNodeIconStyle

public void setNodeIconStyle(java.lang.String nodeIconStyle)
Deprecated. see TreeStyle.setNodeCloseIconStyle(String)

The global icon style for tree items with children (defaults to 'tree-folder'). Individual tree items can override this value by setting the the item's icon style.

Parameters:
nodeIconStyle - the node icon style

setOpenNodeIconStyle

public void setOpenNodeIconStyle(java.lang.String openNodeIconStyle)
Deprecated. see TreeStyle.setNodeOpenIconStyle(String)

Sets the global icon style for expanded tree items (defaults to 'tree-folder-open'). Individual tree items can override this value by setting the the item's icon style.

Parameters:
openNodeIconStyle - the open node icon style

setSelectedItem

public void setSelectedItem(TreeItem item)
Deprecated. 
Description copied from interface: Selectable
Selects the item. Any existing selections are cleared.

Specified by:
setSelectedItem in interface Selectable<TreeItem>
Parameters:
item - the item to select

setSelectedItems

public void setSelectedItems(java.util.List<TreeItem> items)
Deprecated. 
Description copied from interface: Selectable
Selects the items. Only the first item is selected for single-select. Any existing selections are cleared.

Specified by:
setSelectedItems in interface Selectable<TreeItem>
Parameters:
items - the items to select

setSelectionMode

public void setSelectionMode(Style.SelectionMode mode)
Deprecated. 
Sets the table's selection mode.

Parameters:
mode - the selection mode

setSelectionModel

public void setSelectionModel(TreeSelectionModel sm)
Deprecated. 
Sets the tree's selection model.

Parameters:
sm - the tree selection model

setTreeItemPartId

public void setTreeItemPartId(java.lang.String treeItemPartId)
Deprecated. 
Sets the part id used to obtain new tree item ui instances (defaults to "tree.item.default".

Parameters:
treeItemPartId - the tree item part id

createComponentEvent

protected ComponentEvent createComponentEvent(com.google.gwt.user.client.Event event)
Deprecated. 
Overrides:
createComponentEvent in class BoxComponent

createContainerEvent

protected ContainerEvent createContainerEvent(TreeItem item)
Deprecated. 
Overrides:
createContainerEvent in class Container<TreeItem>

createRootItem

protected void createRootItem()
Deprecated. 

onRender

protected void onRender(com.google.gwt.user.client.Element target,
                        int index)
Deprecated. 
Description copied from class: Component
Subclasses must override and ensure setElement is called for lazy rendered components.

Overrides:
onRender in class Component
Parameters:
target - the target element
index - the insert location