com.smartgwt.client.widgets.tree
Class TreeNode

java.lang.Object
  extended by com.smartgwt.client.core.JsObject
      extended by com.smartgwt.client.core.DataClass
          extended by com.smartgwt.client.core.RefDataClass
              extended by com.smartgwt.client.data.Record
                  extended by com.smartgwt.client.widgets.grid.ListGridRecord
                      extended by com.smartgwt.client.widgets.tree.TreeNode

public class TreeNode
extends ListGridRecord

Every node in the tree is represented by TreeNode object which is an object literal with a set or properties that configure the node.

When a Tree is supplied as data to TreeGrid, you can also set properties from ListGridRecord on the TreeNode (e.g. setting enabled:false on the node).


Field Summary
 
Fields inherited from class com.smartgwt.client.core.JsObject
jsObj
 
Constructor Summary
TreeNode()
           
TreeNode(com.google.gwt.core.client.JavaScriptObject jsObj)
           
TreeNode(java.lang.String name)
          Constructor
TreeNode(java.lang.String name, TreeNode... children)
          Constructor
 
Method Summary
 java.lang.Boolean getCanAcceptDrop()
          Governs whether dragged data (typicaly other treeNodes) may be dropped over this node.
 java.lang.Boolean getCanDrag()
          Governs whether this node can be dragged.
 java.lang.Boolean getEnabled()
          Default property name denoting whether this record is enabled.
 java.lang.String getName()
          Provides a name for the node that is unique among it's immediate siblings, thus allowing a unique path to be used to identify the node, similar to a file system.
static TreeNode getOrCreateRef(com.google.gwt.core.client.JavaScriptObject jsObj)
           
 java.lang.String getTitle()
          The title of the node as it should appear next to the node icon in the Tree.
 void setCanAcceptDrop(java.lang.Boolean canAcceptDrop)
          Governs whether dragged data (typicaly other treeNodes) may be dropped over this node.
 void setCanDrag(java.lang.Boolean canDrag)
          Governs whether this node can be dragged.
 void setChildren(TreeNode[] children)
          For trees with the modelType "children", this property specifies the children of this TreeNode.
 void setEnabled(java.lang.Boolean enabled)
          Default property name denoting whether this record is enabled.
 void setID(java.lang.String id)
          For trees with modelType "parent", this property specifies the unique ID of this node.
 void setIsFolder(boolean isFolder)
          Set to true to explicitly mark this node as a folder.
 void setName(java.lang.String name)
          Provides a name for the node that is unique among it's immediate siblings, thus allowing a unique path to be used to identify the node, similar to a file system.
 void setParentID(java.lang.String parentID)
          For trees with modelType "parent", this property specifies unique parent ID of this node.
 void setTitle(java.lang.String title)
          The title of the node as it should appear next to the node icon in the Tree.
 
Methods inherited from class com.smartgwt.client.widgets.grid.ListGridRecord
getIsSeparator, getLinkText, getSingleCellValue, setIsSeparator, setLinkText, setSingleCellValue
 
Methods inherited from class com.smartgwt.client.data.Record
convertToRecordArray
 
Methods inherited from class com.smartgwt.client.core.RefDataClass
getRef, getRef
 
Methods inherited from class com.smartgwt.client.core.DataClass
doAddHandler, fireEvent, getAttribute, getAttributeAsBoolean, getAttributeAsDate, getAttributeAsDouble, getAttributeAsFloat, getAttributeAsInt, getAttributeAsIntArray, getAttributeAsJavaScriptObject, getAttributeAsMap, getAttributeAsObject, getAttributeAsString, getAttributeAsStringArray, getAttributes, getHandlerCount, getJsObj, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute
 
Methods inherited from class com.smartgwt.client.core.JsObject
isCreated, setJsObj
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TreeNode

public TreeNode()

TreeNode

public TreeNode(com.google.gwt.core.client.JavaScriptObject jsObj)

TreeNode

public TreeNode(java.lang.String name)
Constructor

Parameters:
name - the name

TreeNode

public TreeNode(java.lang.String name,
                TreeNode... children)
Constructor

Parameters:
name - the name
children - the children nodes
Method Detail

getOrCreateRef

public static TreeNode getOrCreateRef(com.google.gwt.core.client.JavaScriptObject jsObj)

setEnabled

public void setEnabled(java.lang.Boolean enabled)
Default property name denoting whether this record is enabled. Property name may be modified for some grid via recordEnabledProperty.

Overrides:
setEnabled in class ListGridRecord
Parameters:
enabled - enabled Default value is null

getEnabled

public java.lang.Boolean getEnabled()
Default property name denoting whether this record is enabled. Property name may be modified for some grid via recordEnabledProperty.

Overrides:
getEnabled in class ListGridRecord
Returns:
Boolean

setCanDrag

public void setCanDrag(java.lang.Boolean canDrag)
Governs whether this node can be dragged. Only has an effect if this node is displayed in a TreeGrid where canDragRecordsOut, canReorderRecords or canReparentNodes is true

Note : This is an advanced setting

Overrides:
setCanDrag in class ListGridRecord
Parameters:
canDrag - canDrag Default value is null

getCanDrag

public java.lang.Boolean getCanDrag()
Governs whether this node can be dragged. Only has an effect if this node is displayed in a TreeGrid where canDragRecordsOut, canReorderRecords or canReparentNodes is true

Overrides:
getCanDrag in class ListGridRecord
Returns:
Boolean

setCanAcceptDrop

public void setCanAcceptDrop(java.lang.Boolean canAcceptDrop)
Governs whether dragged data (typicaly other treeNodes) may be dropped over this node. Only has an effect if this node is displayed in a TreeGrid where canAcceptDroppedRecords, canReorderRecords or canReparentNodes is true.

Note : This is an advanced setting

Overrides:
setCanAcceptDrop in class ListGridRecord
Parameters:
canAcceptDrop - canAcceptDrop Default value is null

getCanAcceptDrop

public java.lang.Boolean getCanAcceptDrop()
Governs whether dragged data (typicaly other treeNodes) may be dropped over this node. Only has an effect if this node is displayed in a TreeGrid where canAcceptDroppedRecords, canReorderRecords or canReparentNodes is true.

Overrides:
getCanAcceptDrop in class ListGridRecord
Returns:
Boolean

setName

public void setName(java.lang.String name)
Provides a name for the node that is unique among it's immediate siblings, thus allowing a unique path to be used to identify the node, similar to a file system. See Tree.getPath(com.smartgwt.client.widgets.tree.TreeNode).

If the nameProperty is not set on a given node, the id will be used instead. If this is also missing, Tree.getName(com.smartgwt.client.widgets.tree.TreeNode) and Tree.getPath(com.smartgwt.client.widgets.tree.TreeNode) will auto-generate a unique name for you. Thus names are not required, but if the dataset you are using already has usable names for each node, using them can make APIs such as Tree.find(java.lang.String) more useful. Alternatively, if your dataset has unique ids consider providing those as id.

If a value is provided for value of the nameProperty of a node (e.g. node.name) is not a string, it will be converted to a string by the Tree via ""+value.

This property is also used as the default title for the node (see Tree.getTitle(com.smartgwt.client.widgets.tree.TreeNode)) if title is not specified.

Note: the name of this property can be changed by setting nameProperty.

Parameters:
name - name Default value is null, but see below

getName

public java.lang.String getName()
Provides a name for the node that is unique among it's immediate siblings, thus allowing a unique path to be used to identify the node, similar to a file system. See Tree.getPath(com.smartgwt.client.widgets.tree.TreeNode).

If the nameProperty is not set on a given node, the id will be used instead. If this is also missing, Tree.getName(com.smartgwt.client.widgets.tree.TreeNode) and Tree.getPath(com.smartgwt.client.widgets.tree.TreeNode) will auto-generate a unique name for you. Thus names are not required, but if the dataset you are using already has usable names for each node, using them can make APIs such as Tree.find(java.lang.String) more useful. Alternatively, if your dataset has unique ids consider providing those as id.

If a value is provided for value of the nameProperty of a node (e.g. node.name) is not a string, it will be converted to a string by the Tree via ""+value.

This property is also used as the default title for the node (see Tree.getTitle(com.smartgwt.client.widgets.tree.TreeNode)) if title is not specified.

Note: the name of this property can be changed by setting nameProperty.

Returns:
String

setTitle

public void setTitle(java.lang.String title)
The title of the node as it should appear next to the node icon in the Tree. If left unset, the value of name is used by default. See the description in Tree.getTitle(com.smartgwt.client.widgets.tree.TreeNode) for full details.

Note: the name of this property can be changed by setting titleProperty.

Parameters:
title - title Default value is null

getTitle

public java.lang.String getTitle()
The title of the node as it should appear next to the node icon in the Tree. If left unset, the value of name is used by default. See the description in Tree.getTitle(com.smartgwt.client.widgets.tree.TreeNode) for full details.

Note: the name of this property can be changed by setting titleProperty.

Returns:
String

setID

public void setID(java.lang.String id)
For trees with modelType "parent", this property specifies the unique ID of this node. The unique ID of a node, together with the unique ID of its parent (see parentId) is used by Tree.linkNodes(com.smartgwt.client.widgets.tree.TreeNode[]) to link a list of nodes into a tree.

Note: the name of this property can be changed by setting idField.

Parameters:
id - id Default value is null

setParentID

public void setParentID(java.lang.String parentID)
For trees with modelType "parent", this property specifies unique parent ID of this node. The unique ID of a node, together with the unique ID of its parent is used by Tree.linkNodes(com.smartgwt.client.widgets.tree.TreeNode[]) to link a list of nodes into a tree.

Note: the name of this property can be changed by setting parentIdField.

Parameters:
parentId - parentId Default value is null

setIsFolder

public void setIsFolder(boolean isFolder)
Set to true to explicitly mark this node as a folder. See Tree.isFolder(com.smartgwt.client.widgets.tree.TreeNode) for a full description of how the Tree determines whether a node is a folder or not.

Note: the name of this property can be changed by setting isFolderProperty.

Parameters:
isFolder - isFolder Default value is null

setChildren

public void setChildren(TreeNode[] children)
For trees with the modelType "children", this property specifies the children of this TreeNode.

Note: the name of this property can be changed by setting childrenProperty

Parameters:
children - children Default value is null