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
idFields inherited from class com.smartgwt.client.core.DataClass
factoryCreated, factoryProperties -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGoverns whether dragged data (typically othertreeNodes) 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 TreeNodegetOrCreateRef(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.showDropIconto true to show the drop state icon, or false to suppress this.
If not specified, this behavior is determined byTreeGrid.showCustomIconDropfor 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 othertreeNodes) may be dropped over this node.setCanDrag(Boolean canDrag) Governs whether this node can be dragged.voidsetChildren(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.voidFor trees withmodelType"parent", this property specifies the unique ID of this node.voidsetIsFolder(boolean isFolder) Set totrueto explicitly mark this node as a folder.voidProvides 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.voidsetParentID(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.showDropIconto true to show the drop state icon, or false to suppress this.
If not specified, this behavior is determined byTreeGrid.showCustomIconDropfor 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, setSingleCellValueMethods inherited from class com.smartgwt.client.data.Record
convertToRecordArray, copyAttributes, copyAttributesInto, getAttributeAsRecordArray, getAttributeAsRecordList, getPaletteDefaults, isARecord, toMapMethods inherited from class com.smartgwt.client.core.RefDataClass
getRef, getRef, internalSetIDMethods 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 othertreeNodes) may be dropped over this node. Only has an effect if this node is displayed in aTreeGridwhereTreeGrid.canAcceptDroppedRecords,TreeGrid.canReorderRecordsorTreeGrid.canReparentNodesis true.Note : This is an advanced setting
- Overrides:
setCanAcceptDropin classListGridRecord- Parameters:
canAcceptDrop- New canAcceptDrop value. Default value is null- Returns:
TreeNodeinstance, for chaining setter calls
-
getCanAcceptDrop
Governs whether dragged data (typically othertreeNodes) may be dropped over this node. Only has an effect if this node is displayed in aTreeGridwhereTreeGrid.canAcceptDroppedRecords,TreeGrid.canReorderRecordsorTreeGrid.canReparentNodesis true.- Overrides:
getCanAcceptDropin 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 aTreeGridwhereTreeGrid.canDragRecordsOut,TreeGrid.canReorderRecordsorTreeGrid.canReparentNodesistrue.Note : This is an advanced setting
- Overrides:
setCanDragin classListGridRecord- Parameters:
canDrag- New canDrag value. Default value is null- Returns:
TreeNodeinstance, for chaining setter calls
-
getCanDrag
Governs whether this node can be dragged. Only has an effect if this node is displayed in aTreeGridwhereTreeGrid.canDragRecordsOut,TreeGrid.canReorderRecordsorTreeGrid.canReparentNodesistrue.- Overrides:
getCanDragin 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:
setEnabledin classListGridRecord- Parameters:
enabled- New enabled value. Default value is null- Returns:
TreeNodeinstance, 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:
getEnabledin 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.iconto the URL of the desired icon to display and it will be shown instead of the standardTreeGrid.nodeIconfor this node.
Note that ifshowOpenIconand/orshowDropIconis true for this node, customized icons for folder nodes will be appended with theTreeGrid.openIconSuffixorTreeGrid.dropIconSuffixsuffixes on state change as with the standardTreeGrid.folderIconfor this treeGrid. Also note that for custom folder icons, theTreeGrid.closedIconSuffixwill 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.iconto the URL of the desired icon to display and it will be shown instead of the standardTreeGrid.nodeIconfor this node.
Note that ifshowOpenIconand/orshowDropIconis true for this node, customized icons for folder nodes will be appended with theTreeGrid.openIconSuffixorTreeGrid.dropIconSuffixsuffixes on state change as with the standardTreeGrid.folderIconfor this treeGrid. Also note that for custom folder icons, theTreeGrid.closedIconSuffixwill 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.iconPaddingPropertyNote : This is an advanced setting
- Parameters:
iconPadding- New iconPadding value. Default value is null- Returns:
TreeNodeinstance, 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
idwill 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()) iftitleis 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
idwill 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()) iftitleis 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.showDropIconto true to show the drop state icon, or false to suppress this.
If not specified, this behavior is determined byTreeGrid.showCustomIconDropfor 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:
TreeNodeinstance, 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.showDropIconto true to show the drop state icon, or false to suppress this.
If not specified, this behavior is determined byTreeGrid.showCustomIconDropfor 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.showOpenIconto true to show the open state icons, or false to suppress this.
If not specified, this behavior is determined byTreeGrid.showCustomIconOpenfor 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:
TreeNodeinstance, 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.showOpenIconto true to show the open state icons, or false to suppress this.
If not specified, this behavior is determined byTreeGrid.showCustomIconOpenfor 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.showSelectedIconto true to show the selected state icons, or false to suppress this.
If not specified, this behavior is determined byTreeGrid.showCustomIconSelectedfor 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:
TreeNodeinstance, 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.showSelectedIconto true to show the selected state icons, or false to suppress this.
If not specified, this behavior is determined byTreeGrid.showCustomIconSelectedfor 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 ofnameis 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:
TreeNodeinstance, 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 ofnameis 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 totrueto explicitly mark this node as a folder. SeeTree.isFolder(com.smartgwt.client.widgets.tree.TreeNode)for a full description of how theTreedetermines 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
-