Class TreeNode
- All Implemented Interfaces:
HasHandlers
- Direct Known Subclasses:
GroupNode
,NavItem
,PaletteNode
When a Tree is supplied as TreeGrid.data
to TreeGrid
, you can also set properties from ListGridRecord
on the TreeNode (e.g. setting ListGridRecord.enabled
:false
on the node).
-
Field Summary
Fields inherited from class com.smartgwt.client.core.RefDataClass
id
Fields inherited from class com.smartgwt.client.core.DataClass
factoryCreated, factoryProperties
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionGoverns whether dragged data (typically othertreeNode
s) may be dropped over this node.Governs whether this node can be dragged.Default property name denoting whether this record is enabled.getIcon()
This Property allows the developer to customize the icon displayed next to a node.Developers may customize the padding between the folder or leaf node icon and the text content of the tree cell for individual nodes.getName()
Provides a name for the node that is unique among its immediate siblings, thus allowing a unique path to be used to identify the node, similar to a file system.static TreeNode
getOrCreateRef
(JavaScriptObject jsObj) For folder nodes showing custom icons (set viaicon
), this property allows the developer to specify on a per-node basis whether a drop state icon should be displayed when the user drop-hovers over this folder.
Setnode.showDropIcon
to true to show the drop state icon, or false to suppress this.
If not specified, this behavior is determined byTreeGrid.showCustomIconDrop
for this node.For folder nodes showing custom icons (set viaicon
), this property allows the developer to specify on a per-node basis whether an open state icon should be displayed when the folder is open.For folder nodes showing custom icons (set viaicon
), this property allows the developer to specify on a per-node basis whether a selected state icon should be displayed when the folder is open.getTitle()
The title of the node as it should appear next to the node icon in theTree
.setCanAcceptDrop
(Boolean canAcceptDrop) Governs whether dragged data (typically othertreeNode
s) may be dropped over this node.setCanDrag
(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.setEnabled
(Boolean enabled) Default property name denoting whether this record is enabled.This Property allows the developer to customize the icon displayed next to a node.setIconPadding
(Integer iconPadding) Developers may customize the padding between the folder or leaf node icon and the text content of the tree cell for individual nodes.void
For trees withmodelType
"parent", this property specifies the unique ID of this node.void
setIsFolder
(boolean isFolder) Set totrue
to explicitly mark this node as a folder.void
Provides a name for the node that is unique among its immediate siblings, thus allowing a unique path to be used to identify the node, similar to a file system.void
setParentID
(String parentID) For trees with modelType "parent", this property specifies unique parent ID of this node.setShowDropIcon
(Boolean showDropIcon) For folder nodes showing custom icons (set viaicon
), this property allows the developer to specify on a per-node basis whether a drop state icon should be displayed when the user drop-hovers over this folder.
Setnode.showDropIcon
to true to show the drop state icon, or false to suppress this.
If not specified, this behavior is determined byTreeGrid.showCustomIconDrop
for this node.setShowOpenIcon
(Boolean showOpenIcon) For folder nodes showing custom icons (set viaicon
), this property allows the developer to specify on a per-node basis whether an open state icon should be displayed when the folder is open.setShowSelectedIcon
(Boolean showSelectedIcon) For folder nodes showing custom icons (set viaicon
), this property allows the developer to specify on a per-node basis whether a selected state icon should be displayed when the folder is open.The title of the node as it should appear next to the node icon in theTree
.Methods inherited from class com.smartgwt.client.widgets.grid.ListGridRecord
get_baseStyle, get_canEdit, get_canRemove, getBackgroundComponent, getCanExpand, getCanSelect, getCustomStyle, getDetailDS, getEmbeddedComponent, getEmbeddedComponentFields, getEmbeddedComponentPosition, getIncludeInSummary, getIsGridSummary, getIsGroupSummary, getIsSeparator, getLinkText, getShowRollOver, getSingleCellValue, set_baseStyle, set_canEdit, set_canRemove, setBackgroundComponent, setCanExpand, setCanSelect, setCustomStyle, setDetailDS, setEmbeddedComponent, setEmbeddedComponentFields, setEmbeddedComponentPosition, setIncludeInSummary, setIsGridSummary, setIsGroupSummary, setIsSeparator, setLinkText, setShowRollOver, setSingleCellValue
Methods inherited from class com.smartgwt.client.data.Record
convertToRecordArray, copyAttributes, copyAttributesInto, getAttributeAsRecordArray, getAttributeAsRecordList, getPaletteDefaults, isARecord, toMap
Methods inherited from class com.smartgwt.client.core.RefDataClass
getRef, getRef, internalSetID
Methods inherited from class com.smartgwt.client.core.DataClass
applyFactoryProperties, doAddHandler, fireEvent, getAttribute, getAttributeAsBoolean, getAttributeAsBoolean, getAttributeAsDate, getAttributeAsDouble, getAttributeAsDoubleArray, getAttributeAsElement, getAttributeAsFloat, getAttributeAsInt, getAttributeAsIntArray, getAttributeAsJavaScriptObject, getAttributeAsLong, getAttributeAsMap, getAttributeAsObject, getAttributeAsRecord, getAttributeAsString, getAttributeAsStringArray, getAttributes, getHandlerCount, isFactoryCreated, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttributeAsJavaObject, setFactoryCreated
-
Constructor Details
-
TreeNode
public TreeNode() -
TreeNode
-
TreeNode
Constructor- Parameters:
name
- the name
-
TreeNode
Constructor- Parameters:
name
- the namechildren
- the children nodes
-
-
Method Details
-
getOrCreateRef
-
setCanAcceptDrop
Governs whether dragged data (typically othertreeNode
s) may be dropped over this node. Only has an effect if this node is displayed in aTreeGrid
whereTreeGrid.canAcceptDroppedRecords
,TreeGrid.canReorderRecords
orTreeGrid.canReparentNodes
is true.Note : This is an advanced setting
- Overrides:
setCanAcceptDrop
in classListGridRecord
- Parameters:
canAcceptDrop
- New canAcceptDrop value. Default value is null- Returns:
TreeNode
instance, for chaining setter calls
-
getCanAcceptDrop
Governs whether dragged data (typically othertreeNode
s) may be dropped over this node. Only has an effect if this node is displayed in aTreeGrid
whereTreeGrid.canAcceptDroppedRecords
,TreeGrid.canReorderRecords
orTreeGrid.canReparentNodes
is true.- Overrides:
getCanAcceptDrop
in classListGridRecord
- Returns:
- Current canAcceptDrop value. Default value is null
-
setCanDrag
Governs whether this node can be dragged. Only has an effect if this node is displayed in aTreeGrid
whereTreeGrid.canDragRecordsOut
,TreeGrid.canReorderRecords
orTreeGrid.canReparentNodes
istrue
.Note : This is an advanced setting
- Overrides:
setCanDrag
in classListGridRecord
- Parameters:
canDrag
- New canDrag value. Default value is null- Returns:
TreeNode
instance, for chaining setter calls
-
getCanDrag
Governs whether this node can be dragged. Only has an effect if this node is displayed in aTreeGrid
whereTreeGrid.canDragRecordsOut
,TreeGrid.canReorderRecords
orTreeGrid.canReparentNodes
istrue
.- Overrides:
getCanDrag
in classListGridRecord
- Returns:
- Current canDrag value. Default value is null
-
setEnabled
Default property name denoting whether this record is enabled. Property name may be modified for some grid viaListGrid.recordEnabledProperty
.- Overrides:
setEnabled
in classListGridRecord
- Parameters:
enabled
- New enabled value. Default value is null- Returns:
TreeNode
instance, for chaining setter calls- See Also:
-
getEnabled
Default property name denoting whether this record is enabled. Property name may be modified for some grid viaListGrid.recordEnabledProperty
.- Overrides:
getEnabled
in classListGridRecord
- Returns:
- Current enabled value. Default value is null
- See Also:
-
setIcon
This Property allows the developer to customize the icon displayed next to a node. Setnode.icon
to the URL of the desired icon to display and it will be shown instead of the standardTreeGrid.nodeIcon
for this node.
Note that ifshowOpenIcon
and/orshowDropIcon
is true for this node, customized icons for folder nodes will be appended with theTreeGrid.openIconSuffix
orTreeGrid.dropIconSuffix
suffixes on state change as with the standardTreeGrid.folderIcon
for this treeGrid. Also note that for custom folder icons, theTreeGrid.closedIconSuffix
will never be appended.You can change the name of this property by setting
TreeGrid.customIconProperty
. -
getIcon
This Property allows the developer to customize the icon displayed next to a node. Setnode.icon
to the URL of the desired icon to display and it will be shown instead of the standardTreeGrid.nodeIcon
for this node.
Note that ifshowOpenIcon
and/orshowDropIcon
is true for this node, customized icons for folder nodes will be appended with theTreeGrid.openIconSuffix
orTreeGrid.dropIconSuffix
suffixes on state change as with the standardTreeGrid.folderIcon
for this treeGrid. Also note that for custom folder icons, theTreeGrid.closedIconSuffix
will never be appended.You can change the name of this property by setting
TreeGrid.customIconProperty
.- Returns:
- Current icon value. Default value is null
- See Also:
-
setIconPadding
Developers may customize the padding between the folder or leaf node icon and the text content of the tree cell for individual nodes.You can change the name of this property by setting
TreeGrid.iconPaddingProperty
Note : This is an advanced setting
- Parameters:
iconPadding
- New iconPadding value. Default value is null- Returns:
TreeNode
instance, for chaining setter calls
-
getIconPadding
Developers may customize the padding between the folder or leaf node icon and the text content of the tree cell for individual nodes.You can change the name of this property by setting
TreeGrid.iconPaddingProperty
- Returns:
- Current iconPadding value. Default value is null
-
setName
Provides a name for the node that is unique among its immediate siblings, thus allowing a unique path to be used to identify the node, similar to a file system. SeeTree.getPath()
.If the nameProperty is not set on a given node, the
id
will be used instead. If this is also missing,Tree.getName()
andTree.getPath()
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 asTree.find()
more useful. Alternatively, if your dataset has unique ids consider providing those asid
.If a value provided for 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()
) iftitle
is not specified.Note: the name of this property can be changed by setting
Tree.nameProperty
.- Parameters:
name
- New name value. Default value is null, but see below- See Also:
-
getName
Provides a name for the node that is unique among its immediate siblings, thus allowing a unique path to be used to identify the node, similar to a file system. SeeTree.getPath()
.If the nameProperty is not set on a given node, the
id
will be used instead. If this is also missing,Tree.getName()
andTree.getPath()
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 asTree.find()
more useful. Alternatively, if your dataset has unique ids consider providing those asid
.If a value provided for 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()
) iftitle
is not specified.Note: the name of this property can be changed by setting
Tree.nameProperty
.- Returns:
- Current name value. Default value is null, but see below
- See Also:
-
setShowDropIcon
For folder nodes showing custom icons (set viaicon
), this property allows the developer to specify on a per-node basis whether a drop state icon should be displayed when the user drop-hovers over this folder.
Setnode.showDropIcon
to true to show the drop state icon, or false to suppress this.
If not specified, this behavior is determined byTreeGrid.showCustomIconDrop
for this node.You can change the name of this property by setting
TreeGrid.customIconDropProperty
.Note : This is an advanced setting
- Parameters:
showDropIcon
- New showDropIcon value. Default value is false- Returns:
TreeNode
instance, for chaining setter calls- See Also:
-
getShowDropIcon
For folder nodes showing custom icons (set viaicon
), this property allows the developer to specify on a per-node basis whether a drop state icon should be displayed when the user drop-hovers over this folder.
Setnode.showDropIcon
to true to show the drop state icon, or false to suppress this.
If not specified, this behavior is determined byTreeGrid.showCustomIconDrop
for this node.You can change the name of this property by setting
TreeGrid.customIconDropProperty
.- Returns:
- Current showDropIcon value. Default value is false
- See Also:
-
setShowOpenIcon
For folder nodes showing custom icons (set viaicon
), this property allows the developer to specify on a per-node basis whether an open state icon should be displayed when the folder is open. Setnode.showOpenIcon
to true to show the open state icons, or false to suppress this.
If not specified, this behavior is determined byTreeGrid.showCustomIconOpen
for this node.You can change the name of this property by setting
TreeGrid.customIconOpenProperty
.Note : This is an advanced setting
- Parameters:
showOpenIcon
- New showOpenIcon value. Default value is false- Returns:
TreeNode
instance, for chaining setter calls- See Also:
-
getShowOpenIcon
For folder nodes showing custom icons (set viaicon
), this property allows the developer to specify on a per-node basis whether an open state icon should be displayed when the folder is open. Setnode.showOpenIcon
to true to show the open state icons, or false to suppress this.
If not specified, this behavior is determined byTreeGrid.showCustomIconOpen
for this node.You can change the name of this property by setting
TreeGrid.customIconOpenProperty
.- Returns:
- Current showOpenIcon value. Default value is false
- See Also:
-
setShowSelectedIcon
For folder nodes showing custom icons (set viaicon
), this property allows the developer to specify on a per-node basis whether a selected state icon should be displayed when the folder is open. Setnode.showSelectedIcon
to true to show the selected state icons, or false to suppress this.
If not specified, this behavior is determined byTreeGrid.showCustomIconSelected
for this node.You can change the name of this property by setting
TreeGrid.customIconSelectedProperty
.Note : This is an advanced setting
- Parameters:
showSelectedIcon
- New showSelectedIcon value. Default value is false- Returns:
TreeNode
instance, for chaining setter calls- See Also:
-
getShowSelectedIcon
For folder nodes showing custom icons (set viaicon
), this property allows the developer to specify on a per-node basis whether a selected state icon should be displayed when the folder is open. Setnode.showSelectedIcon
to true to show the selected state icons, or false to suppress this.
If not specified, this behavior is determined byTreeGrid.showCustomIconSelected
for this node.You can change the name of this property by setting
TreeGrid.customIconSelectedProperty
.- Returns:
- Current showSelectedIcon value. Default value is false
- See Also:
-
setTitle
The title of the node as it should appear next to the node icon in theTree
. If left unset, the value ofname
is used by default. See the description inTree.getTitle()
for full details.Note: the name of this property can be changed by setting
Tree.titleProperty
.- Parameters:
title
- New title value. Default value is null- Returns:
TreeNode
instance, for chaining setter calls- See Also:
-
getTitle
The title of the node as it should appear next to the node icon in theTree
. If left unset, the value ofname
is used by default. See the description inTree.getTitle()
for full details.Note: the name of this property can be changed by setting
Tree.titleProperty
.- Returns:
- Current title value. Default value is null
- See Also:
-
setID
For trees withmodelType
"parent", this property specifies the unique ID of this node. The unique ID of a node, together with the unique ID of its parent (seeparentId
) is used byTree.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
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 byTree.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 totrue
to explicitly mark this node as a folder. SeeTree.isFolder(com.smartgwt.client.widgets.tree.TreeNode)
for a full description of how theTree
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
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
-