Class TreeNode
- java.lang.Object
-
- com.microstrategy.web.app.gui.TreeNode
-
- All Implemented Interfaces:
java.lang.Comparable
public class TreeNode extends java.lang.Object implements java.lang.ComparableThe
TreeNodeis the class used by theTreeBoxto identify a single node.Users create an
ArrayofTreeNodeobjects and pass the correspondingEnumerationto theTreeBox. The enumeration represents a single level in a hierarchal tree.The
TreeNodeclass is also used by theTreeViewto identify a single node.In either case users populate the TreeView with TreeNodes to render a tree. The TreeView has a root node by default to which the user can add more TreeNodes as children which themselves can have children and thus renprest a tree structure.
For each node, the user needs to specify:
- Its display name (as displayed by the browser).
- Its ID (to uniquely identify the node).
- The associated
WebEvent(to expand the node). - If it's a leaf (those nodes that are leaf may not be expanded).
When a node is expanded, the associated
WebEventis executed using the iFrame technology. With this, the tree can be dynamically populated without refreshing the whole page.- Since:
- MicroStrategy Web 7.5.0
- See Also:
and com.microstrategy.web.app.gui.TreeView
-
-
Constructor Summary
Constructors Constructor Description TreeNode()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidaddChild(int index, TreeNode child)this method adds a child node at a specifc index positionvoidaddChild(TreeNode child)voidaddExtraArgument(java.lang.String key, java.lang.String value)booleancanMultiSelect()Determines if this node can be used in multiselection or not.intcompareTo(java.lang.Object obj)booleanequals(java.lang.Object o)HashListextraArguments()Function that returns aHashListobject, that will represent a set of {argument key, argument value} pairs.TreeNodegetChild(int i)intgetChildCount()java.lang.StringgetCssClass()java.lang.StringgetDisplayName()Function that returns the name the text that will be displayed in the tree node.java.lang.StringgetID()Function that returns the ID of the tree node.intgetLevel()Deprecated.Add children to the TreeNode using (@link TreeNode#addChild(TreeNode)} to get multiple levels.java.lang.StringgetNodeImage()Function that gets the image used to represent the tree node.TreeNodegetParent()booleangetSelected()booleangetShouldRenderIcon()intgetType()Deprecated.You should assign the "tp" attribute directly as part of the extraArguments.booleangetUseIFrame()Indicates whether the instance uses IFrames for its link.java.lang.StringgetValue()Deprecated.You should assign the "val" attribute directly as part of the extraArguments.WebEventgetWebEvent()Function that returns theWebEventobject associated with the tree node.booleanhasChildren()inthashCode()booleanisExpanded()Function that specifies whether the tree node is expanded or collapsed.booleanisLeaf()Function that specifies whether the tree node is a leaf or not.voidremoveChild(java.lang.String id)voidsetCssClass(java.lang.String value)This sets a css style name for the image that is associated with this tree node.voidsetDisplayName(java.lang.String displayName)Function that sets the name that will be displayed in the tree node.voidsetExpanded(boolean expanded)Function that sets whether the tree is expanded or collapsed.voidsetID(java.lang.String id)Function that sets the ID of the tree node.voidsetLeaf(boolean leaf)Function that sets whether the tree node is a leaf or not.voidsetLevel(int level)Deprecated.Add children to the TreeNode using (@link TreeNode#addChild(TreeNode)} to get multiple levels.voidsetMultiSelect(boolean value)Determines if this node can be used in multiselection or not.voidsetNodeImage(java.lang.String imagePath)Function that sets the image used to represent the tree node.voidsetParent(TreeNode parent)voidsetSelected(boolean selected)voidsetShouldRenderIcon(boolean displayIcon)voidsetType(int type)Deprecated.You should assign the "tp" attribute directly as part of the extraArguments.voidsetUseIFrame(boolean value)Sets whether a ReportFrameElement should use IFrames in its output.voidsetValue(java.lang.String value)Deprecated.You should assign the "val" attribute directly as part of the extraArguments.voidsetWebEvent(WebEvent event)Function that sets theWebEventobject associated with the tree node.voidsortChildren()
-
-
-
Method Detail
-
getShouldRenderIcon
public boolean getShouldRenderIcon()
-
setShouldRenderIcon
public void setShouldRenderIcon(boolean displayIcon)
-
setLevel
@Deprecated public void setLevel(int level)
Deprecated.Add children to the TreeNode using (@link TreeNode#addChild(TreeNode)} to get multiple levels.Function that sets the level of indentation of the tree node in the tree.- Parameters:
level- number that specifies the indentation of the tree node in the tree.
-
getLevel
@Deprecated public int getLevel()
Deprecated.Add children to the TreeNode using (@link TreeNode#addChild(TreeNode)} to get multiple levels.Function that returns the level of indentation of the tree node in the tree.- Returns:
- the level of indentation of the tree node in the tree.
-
setDisplayName
public void setDisplayName(java.lang.String displayName)
Function that sets the name that will be displayed in the tree node.- Parameters:
displayName- the name to display in the tree.
-
getDisplayName
public java.lang.String getDisplayName()
Function that returns the name the text that will be displayed in the tree node.- Returns:
- text displayed in the tree node.
-
setValue
@Deprecated public void setValue(java.lang.String value)
Deprecated.You should assign the "val" attribute directly as part of the extraArguments.Function that sets the value of the tree node.- Parameters:
value- the value of the tree node.
-
addExtraArgument
public void addExtraArgument(java.lang.String key, java.lang.String value)- Since:
- MicroStrategy Web 9.0.0
-
getValue
@Deprecated public java.lang.String getValue()
Deprecated.You should assign the "val" attribute directly as part of the extraArguments.Function that returns the value of the tree node.- Returns:
- the value of the tree node.
-
setID
public void setID(java.lang.String id)
Function that sets the ID of the tree node.- Parameters:
id- the ID of the tree node.
-
getID
public java.lang.String getID()
Function that returns the ID of the tree node.- Returns:
- the ID of the tree node.
-
setType
@Deprecated public void setType(int type)
Deprecated.You should assign the "tp" attribute directly as part of the extraArguments.Function that sets the type of object represented by the tree node.- Parameters:
type- the type of object represented by the tree node.
-
getType
@Deprecated public int getType()
Deprecated.You should assign the "tp" attribute directly as part of the extraArguments.Function that returns the type of object represented by the tree node.- Returns:
- the type of object represented by the tree node.
-
isExpanded
public boolean isExpanded()
Function that specifies whether the tree node is expanded or collapsed.- Returns:
- whether the tree node is expanded or collapsed.
-
setExpanded
public void setExpanded(boolean expanded)
Function that sets whether the tree is expanded or collapsed.- Parameters:
expanded- specifies whether the tree is expanded or collapsed.
-
isLeaf
public boolean isLeaf()
Function that specifies whether the tree node is a leaf or not.- Returns:
- whether the tree node is a leaf or not.
-
setLeaf
public void setLeaf(boolean leaf)
Function that sets whether the tree node is a leaf or not.- Parameters:
leaf- specifies whether the tree node is a leaf or not.
-
extraArguments
public HashList extraArguments()
Function that returns aHashListobject, that will represent a set of {argument key, argument value} pairs. For example, if the user wants to add an argument to represent whether the node is locked or not, then the key will be the argument name "locked" and the value will be an Integer object representing whether is locked or not.- Returns:
- a
HashListobject with the extra arguments used by the tree node.
-
setWebEvent
public void setWebEvent(WebEvent event)
Function that sets theWebEventobject associated with the tree node.- Parameters:
event- theWebEventobject associated with the tree node.
-
getWebEvent
public WebEvent getWebEvent()
Function that returns theWebEventobject associated with the tree node.- Returns:
- the
WebEventobject associated with the tree node.
-
getNodeImage
public java.lang.String getNodeImage()
Function that gets the image used to represent the tree node.- Returns:
- the image used to represent the tree node.
-
setNodeImage
public void setNodeImage(java.lang.String imagePath)
Function that sets the image used to represent the tree node.- Parameters:
imagePath- the image used to represent the tree node.
-
setMultiSelect
public void setMultiSelect(boolean value)
Determines if this node can be used in multiselection or not.- Parameters:
value- iftrue, this node can be used for multiselection.- Since:
- MicroStrategy Web 8.0.1
-
canMultiSelect
public boolean canMultiSelect()
Determines if this node can be used in multiselection or not.- Returns:
- if
true, this node can be used for multiselection. - Since:
- MicroStrategy Web 8.0.1
-
setUseIFrame
public void setUseIFrame(boolean value)
Sets whether a ReportFrameElement should use IFrames in its output.- Parameters:
value- true if IFrrames are enabled.- Since:
- MicroStrategy Web 8.0.1
-
getUseIFrame
public boolean getUseIFrame()
Indicates whether the instance uses IFrames for its link. If useIFrame has not been explicitly set, it will always use iFrame for nodes and not use iFrame for leafs.- Returns:
trueif it uses IFrames.- Since:
- MicroStrategy Web 8.0.1
-
setCssClass
public void setCssClass(java.lang.String value)
This sets a css style name for the image that is associated with this tree node. Please note that inorder to use this css style, the nodeImage has to be set using the setNodeImage method. Otherwise the class attribute is not rendered- Parameters:
value-- Since:
- MicroStrategy Web 9.0.0
-
getCssClass
public java.lang.String getCssClass()
- Since:
- MicroStrategy Web 9.0.0
-
addChild
public void addChild(TreeNode child)
- Since:
- MicroStrategy Web 9.0.0
-
addChild
public void addChild(int index, TreeNode child)this method adds a child node at a specifc index position- Parameters:
child- TreeNode the child tree node to be addedindex- int the index of the position where we want the child node to be placed among its siblings- Since:
- MicroStrategy Web 9.0.0
-
removeChild
public void removeChild(java.lang.String id)
-
sortChildren
public void sortChildren()
- Since:
- MicroStrategy Web 9.0.0
-
getChild
public TreeNode getChild(int i)
- Since:
- MicroStrategy Web 9.0.0
-
setParent
public void setParent(TreeNode parent)
- Since:
- MicroStrategy Web 9.0.0
-
getParent
public TreeNode getParent()
- Since:
- MicroStrategy Web 9.0.0
-
getChildCount
public int getChildCount()
- Since:
- MicroStrategy Web 9.0.0
-
hasChildren
public boolean hasChildren()
- Since:
- MicroStrategy Web 9.0.0
-
compareTo
public int compareTo(java.lang.Object obj)
- Specified by:
compareToin interfacejava.lang.Comparable- Since:
- MicroStrategy Web 9.0.0
-
setSelected
public void setSelected(boolean selected)
- Since:
- MicroStrategy Web 9.0.0
-
getSelected
public boolean getSelected()
- Since:
- MicroStrategy Web 9.0.0
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
-