com.gwtext.client.widgets.tree
Class TreeNode

java.lang.Object
  extended by com.gwtext.client.core.JsObject
      extended by com.gwtext.client.data.Node
          extended by com.gwtext.client.widgets.tree.TreeNode
Direct Known Subclasses:
AsyncTreeNode

public class TreeNode
extends Node

TreeNode class.

See Also:
TreePanel

Field Summary
 
Fields inherited from class com.gwtext.client.data.Node
configJS
 
Fields inherited from class com.gwtext.client.core.JsObject
jsObj
 
Constructor Summary
TreeNode()
          Create a new TreeNode.
TreeNode(java.lang.String text)
          Create a new TreeNode.
TreeNode(java.lang.String text, java.lang.String iconCls)
          Create a new TreeNode.
 
Method Summary
 void addListener(TreeNodeListener listener)
          Adds a TreeNode listener.
 TreeNode cloneNode()
          Clones this TreeNode.
 TreeNode cloneNode(TreeNode config)
          Clones this TreeNode applying the specified configuration to the cloned node.
 void collapse()
          Collapse this node.
 void collapse(boolean deep, boolean anim)
          Collapse this node.
 void collapseChildNodes(boolean deep)
          Collapse all child nodes.
protected  com.google.gwt.core.client.JavaScriptObject create(com.google.gwt.core.client.JavaScriptObject config)
           
protected  Node createNode(com.google.gwt.core.client.JavaScriptObject jsNode)
           
 void destroy()
          Destroy this node.
 void disable()
          Disables this node.
 void enable()
          Enables this node.
 void ensureVisible()
          Ensures all parent nodes are expanded.
 void expand()
          Expand this node.
 void expand(boolean deep, boolean anim)
          Expand this node.
 void expand(boolean deep, boolean anim, Function callback)
          Expand this node.
 void expandChildNodes(boolean deep)
          Expand all child nodes.
 java.lang.String getIconCls()
           
 java.lang.String getText()
          Return the nodes text.
 TreeNodeUI getUI()
          Returns the UI object for this node.
static Node instance(com.google.gwt.core.client.JavaScriptObject jsObj)
           
 boolean isDisabled()
          True if this node is disabled.
 boolean isExpandable()
          Returns true if this node is expandable.
 boolean isExpanded()
          Returns true if this node is expanded.
 boolean isRendered()
           
 boolean isSelected()
          Returns true if this node is selected.
 void select()
          Triggers selection of this node.
 void setAllowDrag(boolean allowDrag)
          False to make this node undraggable if DD is on (defaults to true).
 void setAllowDrop(boolean allowDrop)
          False if this node cannot be drop on.
 void setChecked(boolean checked)
          True to render a checked checkbox for this node, false to render an unchecked checkbox (defaults to undefined with no checkbox rendered).
 void setCls(java.lang.String cls)
          A CSS class to be added to the node.
 void setDisabled(boolean disabled)
          True to start the node disabled
 void setExpandable(boolean expandable)
          True to mark the node as expandable.
 void setExpanded(boolean expanded)
          True to start the node expanded
 void setHref(java.lang.String href)
          URL of the link used for the node (defaults to #).
 void setHrefTarget(java.lang.String hrefTarget)
          Target frame for the link
 void setIcon(java.lang.String icon)
          The path to an icon for the node.
 void setIconCls(java.lang.String iconCls)
          A css class to be added to the nodes icon element for applying css background images.
 void setSingleClickExpand(boolean singleClickExpand)
          True for single click expand on this node.
 void setText(java.lang.String text)
          The text for this node.
 void setTooltip(QuickTipsConfig qtipConfig)
          Set a Tree node tooltip.
 void setTooltip(java.lang.String qtip)
          Set a Tree node tooltip.
 void toggle()
          Toggles expanded/collapsed state of the node.
 void unselect()
          Triggers deselection of this node.
 
Methods inherited from class com.gwtext.client.data.Node
addListener, appendChild, bubble, cascade, contains, eachChild, equals, findChildBy, getAttribute, getAttributeAsObject, getChildNodes, getDepth, getFirstChild, getId, getJsObj, getLastChild, getNextSibling, getOwnerTree, getParentNode, getPath, getPath, getPreviousSibling, getUserObject, hashCode, indexOf, insertBefore, isAncestor, isFirst, isLast, isLeaf, item, remove, removeChild, replaceChild, setAttribute, setAttribute, setAttribute, setId, setLeaf, setUserObject, sort
 
Methods inherited from class com.gwtext.client.core.JsObject
getProperties, isCreated, setJsObj
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TreeNode

public TreeNode()
Create a new TreeNode.


TreeNode

public TreeNode(java.lang.String text)
Create a new TreeNode.

Parameters:
text - the text / label of the TreeNode

TreeNode

public TreeNode(java.lang.String text,
                java.lang.String iconCls)
Create a new TreeNode.

Parameters:
text - the text / label of the TreeNode
iconCls - the tree node icon CSS class
Method Detail

instance

public static Node instance(com.google.gwt.core.client.JavaScriptObject jsObj)

create

protected com.google.gwt.core.client.JavaScriptObject create(com.google.gwt.core.client.JavaScriptObject config)
Overrides:
create in class Node

createNode

protected Node createNode(com.google.gwt.core.client.JavaScriptObject jsNode)
Overrides:
createNode in class Node

collapse

public void collapse()
Collapse this node.


collapse

public void collapse(boolean deep,
                     boolean anim)
Collapse this node.

Parameters:
deep - true to collapse all children as well
anim - false to disable the default animation

collapseChildNodes

public void collapseChildNodes(boolean deep)
Collapse all child nodes.

Parameters:
deep - true if the child nodes should also collapse their child nodes

destroy

public void destroy()
Destroy this node.


disable

public void disable()
Disables this node.


isDisabled

public boolean isDisabled()
True if this node is disabled.

Returns:
true if disabled

enable

public void enable()
Enables this node.


ensureVisible

public void ensureVisible()
Ensures all parent nodes are expanded.


isRendered

public boolean isRendered()

expand

public void expand()
Expand this node. The tree must be rendered before this method is called.


expand

public void expand(boolean deep,
                   boolean anim)
Expand this node. The tree must be rendered before this method is called.

Parameters:
deep - true to expand all children as well
anim - false to cancel the default animation

expand

public void expand(boolean deep,
                   boolean anim,
                   Function callback)
Expand this node. The tree must be rendered before this method is called.

Parameters:
deep - true to expand all children as well
anim - false to cancel the default animation
callback - a callback to be called when expanding this node completes (does not wait for deep expand to complete)

expandChildNodes

public void expandChildNodes(boolean deep)
Expand all child nodes.

Parameters:
deep - true if the child nodes should also expand their child nodes

getUI

public TreeNodeUI getUI()
Returns the UI object for this node.

Returns:
the TreeNodeUI

isExpanded

public boolean isExpanded()
Returns true if this node is expanded.

Returns:
true if expanded

isSelected

public boolean isSelected()
Returns true if this node is selected.

Returns:
true if selected

select

public void select()
Triggers selection of this node.


getText

public java.lang.String getText()
Return the nodes text.

Returns:
the nodes text

toggle

public void toggle()
Toggles expanded/collapsed state of the node.


unselect

public void unselect()
Triggers deselection of this node.


cloneNode

public TreeNode cloneNode()
Clones this TreeNode.

Returns:
the cloned node

cloneNode

public TreeNode cloneNode(TreeNode config)
Clones this TreeNode applying the specified configuration to the cloned node.

Parameters:
config - the cloned node config
Returns:
the cloned node

addListener

public void addListener(TreeNodeListener listener)
Adds a TreeNode listener.

Parameters:
listener - the listener

setAllowDrag

public void setAllowDrag(boolean allowDrag)
False to make this node undraggable if DD is on (defaults to true).

Parameters:
allowDrag - false to disable drag

setAllowDrop

public void setAllowDrop(boolean allowDrop)
False if this node cannot be drop on.

Parameters:
allowDrop - flase to disable drop

setChecked

public void setChecked(boolean checked)
True to render a checked checkbox for this node, false to render an unchecked checkbox (defaults to undefined with no checkbox rendered).

Parameters:
checked - true for checked checkbox

setCls

public void setCls(java.lang.String cls)
A CSS class to be added to the node.

Parameters:
cls - a CSS class

setDisabled

public void setDisabled(boolean disabled)
True to start the node disabled

Parameters:
disabled - true to start disabled

setExpanded

public void setExpanded(boolean expanded)
True to start the node expanded

Parameters:
expanded - true to start expanded

isExpandable

public boolean isExpandable()
Returns true if this node is expandable.

Returns:
true if expandable

setExpandable

public void setExpandable(boolean expandable)
True to mark the node as expandable. If set to true, the node will always show a plus/minus icon, even when empty

Parameters:
expandable - true to start expandable

setHref

public void setHref(java.lang.String href)
URL of the link used for the node (defaults to #).

Parameters:
href - the node href URL

setHrefTarget

public void setHrefTarget(java.lang.String hrefTarget)
Target frame for the link

Parameters:
hrefTarget - href frame target

setIcon

public void setIcon(java.lang.String icon)
The path to an icon for the node. The preferred way to do this is to use the cls or iconCls attributes and add the icon via a CSS background image.

Parameters:
icon - the node icon

setIconCls

public void setIconCls(java.lang.String iconCls)
A css class to be added to the nodes icon element for applying css background images.

Parameters:
iconCls - the icon CSS class

getIconCls

public java.lang.String getIconCls()

setTooltip

public void setTooltip(java.lang.String qtip)
Set a Tree node tooltip.

Parameters:
qtip - the tooltip

setTooltip

public void setTooltip(QuickTipsConfig qtipConfig)
Set a Tree node tooltip.

Parameters:
qtipConfig - the tooltip configuration

setSingleClickExpand

public void setSingleClickExpand(boolean singleClickExpand)
True for single click expand on this node.

Parameters:
singleClickExpand - true for single click expand

setText

public void setText(java.lang.String text)
The text for this node.

Parameters:
text - the nodes text / label