public interface

TreeBox

implements GuiElement
com.microstrategy.web.app.gui.TreeBox
Known Indirect Subclasses

This interface is deprecated.
Use (@link com.microstrategy.web.app.gui.TreeView} instead of this to render a tree view.

Class Overview

The TreeBox GuiElement is designed to create a hierarchical tree that can be dynamically populated using WebEvents.
It receives an enumeration of TreeNode objects. Each TreeNode contains its display information as well as the event to trigger when the node is selected, or in the case when the node is not a leaf, the event that will retrieve its content.
Noticed that Events to expand a node will automatically be submitted through the iFrame using javascript.
The TreeBox provides two render methods:

  • renderTree(MarkupOutput, Enumeration) it creates and register a new tree and populates its root nodes with the Enumeration it receives. This method should be used the first time the tree is generated.
  • renderNodes(MarkupOutput, Enumeration): it just generates the content of the child nodes. This method should be used when updating the tree through the iFrame. When this is the case, make sure the content is enclosed by a div with id "divTreeWait".

    There are two properties that a user may specify for this element:
    1. TREE_NAME: a unique name that identifies the tree.
    2. CART_INDEX: the index of this tree within the page.

    When using this GuiElement, make sure the links to the following files are included in the final HTML output:
    • javascript/DHTML.js
    • javascript/treev3.js
    • style/mstr/tree.css

    The following provides an example of a FolderBean Transform that uses a TreeBox for object browsing:

     public class FolderTreeTransform extends AbstractFolderTransform {
         private TreeBox _tree;
    
         public FolderTreeTransform() {
             super();
         }
    
         public void renderList(MarkupOutput out, WebDisplayUnits children) {
             if (isIFrameRequest()) {
                 getTree().renderNodes(out, getTreeNodes(children));
             } else {
                 getTree().renderTree(out, getTreeNodes(children));
             }
         }
    
         protected Enumeration getTreeNodes(WebDisplayUnits children) {
             Hashtable nodes = new Hashtable();
    
             for (int i = 0;i < children.size(); i++) {
                 TreeNode node = new TreeNode();
                 WebDisplayUnit object = children.get(i);
    
                 node.setDisplayName(object.getDisplayName());
                 node.setID(object.getID());
                 node.setType(object.getDisplayUnitType());
                 node.setWebEvent(getEvent(object));
                 node.setLeaf(object.getDisplayUnitType() != EnumDSSXMLObjectTypes.DssXmlTypeFolder);
    
                 nodes.put(node.getID(), node);
             }
    
             return nodes.elements();
         }
    
         protected WebEvent getEvent(WebDisplayUnit unit) {
             WebEvent __result = getFolderBean().getWebEvent(EnumFolderBeanEvents.FOLDER_EVENT_BROWSE);
    
             if (__result != null) {
                 __result.setArgumentValue(EnumFolderBeanEvents.FOLDER_EVENT_ARGUMENT_FOLDER_ID, unit.getID());
             }
    
             return __result;
         }
    
         protected TreeBox getTree() {
             if (_tree == null) {
                 _tree = GuiElementFactory.getInstance().newTreeBox(getAppContext());
             }
    
             return _tree;
         }
    
         public String getID() {
             if (isIFrameRequest()) {
                 return TreeBox.TREE_COMPONENT_ID;
             } else {
                 return super.getID();
             }
         }
     }
     

Summary

Constants
String TREE_COMPONENT_ID

ID used by the tree for the content that needs to be updated.

Public Methods
abstract Object getProperty(String key)
Function that returns value for a given Tree's property.
abstract void renderNodes(MarkupOutput out, Enumeration elements)
Function that renders the nodes of a tree box, given the enumeration of TreeNodes objects.
abstract void renderTree(MarkupOutput out, Enumeration elements)
Creates and register a tree.
abstract void setProperty(String key, Object obj)
Function used for setting Tree properties.
[Expand]
Inherited Methods
From interface com.microstrategy.web.app.gui.GuiElement

Constants

public static final String TREE_COMPONENT_ID

ID used by the tree for the content that needs to be updated. Transforms generating content for a Tree iframe request need to use this as their own ID.

* Value: divTreeWait

Constant Value: "divTreeWait"

Public Methods

public abstract Object getProperty (String key)

Function that returns value for a given Tree's property.

Parameters
key name of property
Returns
  • Objest value held by property

public abstract void renderNodes (MarkupOutput out, Enumeration elements)

Function that renders the nodes of a tree box, given the enumeration of TreeNodes objects.

Parameters
out MarkupOutput instance where to write the output of the method.
elements Enumeration of TreeNode objects.

public abstract void renderTree (MarkupOutput out, Enumeration elements)

Creates and register a tree. It also populate its root elements. Use the first time a tree is generated.

Parameters
out MarkupOutput where to write the output
elements An Enumeration of TreeNode objects.

public abstract void setProperty (String key, Object obj)

Function used for setting Tree properties. Key is the name of the property and obj its value.

Parameters
key name of property
obj property's value.