com.google.gwt.user.cellview.client

## Class CellTreeNodeView<T>

- java.lang.Object
- - com.google.gwt.user.client.ui.UIObject
  - - com.google.gwt.user.cellview.client.CellTreeNodeView<T>

Type Parameters:
  `T` - the type that this view contains

All Implemented Interfaces:
  HasVisibility

    class CellTreeNodeView<T>
    extends UIObject

A view of a tree node.

### Nested Class Summary

Nested Classes
`(package private) static class` `CellTreeNodeView.NodeCellList<C>` The `HasData` used to show children.
`(package private) static interface` `CellTreeNodeView.Template`
`(package private) static class` `CellTreeNodeView.TreeNodeImpl` An implementation of `TreeNode` that delegates to a `CellTreeNodeView`.

### Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject

`UIObject.DebugIdImpl, UIObject.DebugIdImplEnabled`

### Field Summary

Fields
`(package private) CellTreeNodeView.NodeCellList<?>` `listView` The list view used to display the nodes.

### Fields inherited from class com.google.gwt.user.client.ui.UIObject

`DEBUG_ID_PREFIX`

### Constructor Summary

Constructors
Constructor and Description
`CellTreeNodeView(CellTree tree, CellTreeNodeView<?> parent, TreeViewModel.NodeInfo<T> parentNodeInfo, Element elem, T value, CellTree.CellTreeMessages messages)` Construct a `CellTreeNodeView`.

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`(package private) boolean` `belongsToTree(CellTree tree)`
`protected void` `cleanup(boolean destroy)` Unregister the list handler and destroy all child nodes.
`protected boolean` `consumeAnimate()`
`protected <C> CellTreeNodeView<C>` `createTreeNodeView(TreeViewModel.NodeInfo<C> nodeInfo, Element childElem, C childValue, java.lang.Object viewData)` Returns an instance of TreeNodeView of the same subclass as the calling object.
`(package private) Element` `ensureAnimationFrame()` Ensure that the animation frame exists and return it.
`(package private) Element` `ensureChildContainer()` Ensure that the child container exists and return it.
`(package private) Element` `ensureContentContainer()` Ensure that the content container exists and return it.
`protected void` `fireEventToCell(NativeEvent event)` Fire an event to the `AbstractCell`.
`protected Element` `getCellParent()` Returns the element that parents the cell contents of this node.
`int` `getChildCount()`
`CellTreeNodeView<?>` `getChildNode(int childIndex)`
`protected Element` `getImageElement()` Returns the element corresponding to the open/close image.
`(package private) int` `getIndex()` Return the index of this node in its parent.
`(package private) CellTreeNodeView<?>` `getParentNode()` Return the parent node, or null if this node is the root.
`protected Element` `getSelectionElement()` Returns the element that selection styles are applied to.
`(package private) static Element` `getSelectionElement(Element nodeElem)` Returns the element that selection is applied to.
`(package private) Element` `getShowMoreElement()`
`(package private) TreeNode` `getTreeNode()` Get a `TreeNode` with a public API for this node view.
`protected java.lang.Object` `getValueKey()` Returns the key for the value of this node using the parent's implementation of NodeInfo.getKey().
`(package private) int` `indexOf(CellTreeNodeView<?> child)`
`(package private) boolean` `isDestroyed()`
`boolean` `isLeaf()`
`boolean` `isOpen()` Check whether or not this node is open.
`(package private) boolean` `isRootNode()` Check if this node is a root node.
`(package private) boolean` `isSelected()` Check if the value of this node is selected.
`protected <C> void` `onOpen(TreeViewModel.NodeInfo<C> nodeInfo)` Set up the node when it is opened.
`(package private) boolean` `resetFocusOnCell()` Reset focus on this node.
`(package private) void` `setKeyboardSelected(boolean selected, boolean stealFocus)` Select or deselect this node with the keyboard.
`(package private) void` `setKeyboardSelectedStyle(boolean selected)` Add or remove the keyboard selected style.
`boolean` `setOpen(boolean open, boolean fireEvents)` Sets whether this item's children are displayed.
`(package private) void` `setSelected(boolean selected)` Select or deselect this node.
`(package private) void` `showFewer()`
`(package private) void` `showMore()`

### Methods inherited from class com.google.gwt.user.client.ui.UIObject

`addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, onEnsureDebugId, removeStyleDependentName, removeStyleName, resolvePotentialElement, setElement, setElement, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, sinkBitlessEvent, sinkEvents, toString, unsinkEvents`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Field Detail

#### listView

    CellTreeNodeView.NodeCellList<?> listView

The list view used to display the nodes.

### Constructor Detail

#### CellTreeNodeView

    CellTreeNodeView(CellTree tree,
                     CellTreeNodeView<?> parent,
                     TreeViewModel.NodeInfo<T> parentNodeInfo,
                     Element elem,
                     T value,
                     CellTree.CellTreeMessages messages)

Construct a `CellTreeNodeView`.

Parameters:
  `tree` - the parent `CellTreeNodeView`
  `parent` - the parent `CellTreeNodeView`
  `parentNodeInfo` - the `TreeViewModel.NodeInfo` of the parent
  `elem` - the outer element of this `CellTreeNodeView`
  `value` - the value of this node
  `messages` - translation messages

### Method Detail

#### getSelectionElement

    static Element getSelectionElement(Element nodeElem)

Returns the element that selection is applied to.

Parameters:
  `nodeElem` - the element that represents the node
Returns:
  the cell parent within the node

#### getChildCount

    public int getChildCount()

#### getChildNode

    public CellTreeNodeView<?> getChildNode(int childIndex)

#### isLeaf

    public boolean isLeaf()

#### isOpen

    public boolean isOpen()

Check whether or not this node is open.

Returns:
  true if open, false if closed

#### setOpen

    public boolean setOpen(boolean open,
                           boolean fireEvents)

Sets whether this item's children are displayed.

Parameters:
  `open` - whether the item is open
  `fireEvents` - true to fire events if the state changes
Returns:
  true if successfully opened, false otherwise.

#### cleanup

    protected void cleanup(boolean destroy)

Unregister the list handler and destroy all child nodes.

Parameters:
  `destroy` - true to destroy this node

#### consumeAnimate

    protected boolean consumeAnimate()

#### createTreeNodeView

    protected <C> CellTreeNodeView<C> createTreeNodeView(TreeViewModel.NodeInfo<C> nodeInfo,
                                                         Element childElem,
                                                         C childValue,
                                                         java.lang.Object viewData)

Returns an instance of TreeNodeView of the same subclass as the calling object.

Type Parameters:
  `C` - the data type of the node's children
Parameters:
  `nodeInfo` - a NodeInfo object describing the child nodes
  `childElem` - the DOM element used to parent the new TreeNodeView
  `childValue` - the child's value
  `viewData` - view data associated with the node
Returns:
  a TreeNodeView of suitable type

#### fireEventToCell

    protected void fireEventToCell(NativeEvent event)

Fire an event to the `AbstractCell`.

Parameters:
  `event` - the native event

#### getCellParent

    protected Element getCellParent()

Returns the element that parents the cell contents of this node.

#### getImageElement

    protected Element getImageElement()

Returns the element corresponding to the open/close image.

Returns:
  the open/close image element

#### getSelectionElement

    protected Element getSelectionElement()

Returns the element that selection styles are applied to. The element includes the open/close image and the rendered value and spans the width of the tree.

Returns:
  the selection element

#### getValueKey

    protected java.lang.Object getValueKey()

Returns the key for the value of this node using the parent's implementation of NodeInfo.getKey().

#### onOpen

    protected <C> void onOpen(TreeViewModel.NodeInfo<C> nodeInfo)

Set up the node when it is opened.

Type Parameters:
  `C` - the child data type of the node
Parameters:
  `nodeInfo` - the `TreeViewModel.NodeInfo` that provides information about the child values

#### belongsToTree

    boolean belongsToTree(CellTree tree)

#### ensureAnimationFrame

    Element ensureAnimationFrame()

Ensure that the animation frame exists and return it.

Returns:
  the animation frame

#### ensureChildContainer

    Element ensureChildContainer()

Ensure that the child container exists and return it.

Returns:
  the child container

#### ensureContentContainer

    Element ensureContentContainer()

Ensure that the content container exists and return it.

Returns:
  the content container

#### getIndex

    int getIndex()

Return the index of this node in its parent.

#### getParentNode

    CellTreeNodeView<?> getParentNode()

Return the parent node, or null if this node is the root.

#### getShowMoreElement

    Element getShowMoreElement()

#### getTreeNode

    TreeNode getTreeNode()

Get a `TreeNode` with a public API for this node view.

Returns:
  the `TreeNode`

#### indexOf

    int indexOf(CellTreeNodeView<?> child)

#### isDestroyed

    boolean isDestroyed()

#### isRootNode

    boolean isRootNode()

Check if this node is a root node.

Returns:
  true if a root node

#### isSelected

    boolean isSelected()

Check if the value of this node is selected.

Returns:
  true if selected, false if not

#### resetFocusOnCell

    boolean resetFocusOnCell()

Reset focus on this node.

Returns:
  true of the cell takes focus, false if not

#### setKeyboardSelected

    void setKeyboardSelected(boolean selected,
                             boolean stealFocus)

Select or deselect this node with the keyboard.

Parameters:
  `selected` - true if selected, false if not
  `stealFocus` - true to steal focus

#### setKeyboardSelectedStyle

    void setKeyboardSelectedStyle(boolean selected)

Add or remove the keyboard selected style.

Parameters:
  `selected` - true if selected, false if not

#### setSelected

    void setSelected(boolean selected)

Select or deselect this node.

Parameters:
  `selected` - true to select, false to deselect

#### showFewer

    void showFewer()

#### showMore

    void showMore()