public class

TreeNode

extends Object
implements Comparable<T>
java.lang.Object
   ↳ com.microstrategy.web.app.gui.TreeNode

Class Overview

The TreeNode is the class used by the TreeBox to identify a single node.

Users create an Array of TreeNode objects and pass the corresponding Enumeration to the TreeBox. The enumeration represents a single level in a hierarchal tree.

The TreeNode class is also used by the TreeView to 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 WebEvent is executed using the iFrame technology. With this, the tree can be dynamically populated without refreshing the whole page.

Summary

Public Constructors
TreeNode()
Public Methods
void addChild(int index, TreeNode child)
this method adds a child node at a specifc index position
void addChild(TreeNode child)
void addExtraArgument(String key, String value)
boolean canMultiSelect()
Determines if this node can be used in multiselection or not.
int compareTo(Object obj)
boolean equals(Object o)
HashList extraArguments()
Function that returns a HashList object, that will represent a set of {argument key, argument value} pairs.
TreeNode getChild(int i)
int getChildCount()
String getCssClass()
String getDisplayName()
Function that returns the name the text that will be displayed in the tree node.
String getID()
Function that returns the ID of the tree node.
int getLevel()
This method is deprecated. Add children to the TreeNode using (@link TreeNode#addChild(TreeNode)} to get multiple levels.
String getNodeImage()
Function that gets the image used to represent the tree node.
TreeNode getParent()
boolean getSelected()
boolean getShouldRenderIcon()
int getType()
This method is deprecated. You should assign the "tp" attribute directly as part of the extraArguments.
boolean getUseIFrame()
Indicates whether the instance uses IFrames for its link.
String getValue()
This method is deprecated. You should assign the "val" attribute directly as part of the extraArguments.
WebEvent getWebEvent()
Function that returns the WebEvent object associated with the tree node.
boolean hasChildren()
int hashCode()
boolean isExpanded()
Function that specifies whether the tree node is expanded or collapsed.
boolean isLeaf()
Function that specifies whether the tree node is a leaf or not.
void removeChild(String id)
void setCssClass(String value)
This sets a css style name for the image that is associated with this tree node.
void setDisplayName(String displayName)
Function that sets the name that will be displayed in the tree node.
void setExpanded(boolean expanded)
Function that sets whether the tree is expanded or collapsed.
void setID(String id)
Function that sets the ID of the tree node.
void setLeaf(boolean leaf)
Function that sets whether the tree node is a leaf or not.
void setLevel(int level)
This method is deprecated. Add children to the TreeNode using (@link TreeNode#addChild(TreeNode)} to get multiple levels.
void setMultiSelect(boolean value)
Determines if this node can be used in multiselection or not.
void setNodeImage(String imagePath)
Function that sets the image used to represent the tree node.
void setParent(TreeNode parent)
void setSelected(boolean selected)
void setShouldRenderIcon(boolean displayIcon)
void setType(int type)
This method is deprecated. You should assign the "tp" attribute directly as part of the extraArguments.
void setUseIFrame(boolean value)
Sets whether a ReportFrameElement should use IFrames in its output.
void setValue(String value)
This method is deprecated. You should assign the "val" attribute directly as part of the extraArguments.
void setWebEvent(WebEvent event)
Function that sets the WebEvent object associated with the tree node.
void sortChildren()
[Expand]
Inherited Methods
From class java.lang.Object
From interface java.lang.Comparable

Public Constructors

public TreeNode ()

Public Methods

public void addChild (int index, TreeNode child)

this method adds a child node at a specifc index position

Parameters
index int the index of the position where we want the child node to be placed among its siblings
child TreeNode the child tree node to be added

public void addChild (TreeNode child)

public void addExtraArgument (String key, String value)

public boolean canMultiSelect ()

Determines if this node can be used in multiselection or not.

Returns
  • if true, this node can be used for multiselection.

public int compareTo (Object obj)

public boolean equals (Object o)

public HashList extraArguments ()

Function that returns a HashList object, 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 HashList object with the extra arguments used by the tree node.

public TreeNode getChild (int i)

public int getChildCount ()

public String getCssClass ()

public String getDisplayName ()

Function that returns the name the text that will be displayed in the tree node.

Returns
  • text displayed in the tree node.

public String getID ()

Function that returns the ID of the tree node.

Returns
  • the ID of the tree node.

public int getLevel ()

This method is 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.

public String getNodeImage ()

Function that gets the image used to represent the tree node.

Returns
  • the image used to represent the tree node.

public TreeNode getParent ()

public boolean getSelected ()

public boolean getShouldRenderIcon ()

public int getType ()

This method is 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.

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
  • true if it uses IFrames.

public String getValue ()

This method is 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.

public WebEvent getWebEvent ()

Function that returns the WebEvent object associated with the tree node.

Returns
  • the WebEvent object associated with the tree node.

public boolean hasChildren ()

public int hashCode ()

public boolean isExpanded ()

Function that specifies whether the tree node is expanded or collapsed.

Returns
  • whether the tree node is expanded or collapsed.

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.

public void removeChild (String id)

public void setCssClass (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

public void setDisplayName (String displayName)

Function that sets the name that will be displayed in the tree node.

Parameters
displayName the name to display in the tree.

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.

public void setID (String id)

Function that sets the ID of the tree node.

Parameters
id the ID of the tree node.

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.

public void setLevel (int level)

This method is 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.

public void setMultiSelect (boolean value)

Determines if this node can be used in multiselection or not.

Parameters
value if true, this node can be used for multiselection.

public void setNodeImage (String imagePath)

Function that sets the image used to represent the tree node.

Parameters
imagePath the image used to represent the tree node.

public void setParent (TreeNode parent)

public void setSelected (boolean selected)

public void setShouldRenderIcon (boolean displayIcon)

public void setType (int type)

This method is 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.

public void setUseIFrame (boolean value)

Sets whether a ReportFrameElement should use IFrames in its output.

Parameters
value true if IFrrames are enabled.

public void setValue (String value)

This method is 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.

public void setWebEvent (WebEvent event)

Function that sets the WebEvent object associated with the tree node.

Parameters
event the WebEvent object associated with the tree node.

public void sortChildren ()