Interface TreeBox

  • All Superinterfaces:
    All Known Implementing Classes:

    public interface TreeBox
    extends GuiElement
    Use (@link} instead of this to render a tree view.
    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(com.microstrategy.web.beans.MarkupOutput, java.util.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(com.microstrategy.web.beans.MarkupOutput, java.util.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. EnumCartProperties.TREE_NAME: a unique name that identifies the tree.
      2. EnumCartProperties.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() {
           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.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();

    MicroStrategy Web 7.5.0
    • Field Detail


        static final java.lang.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
        MicroStrategy Web 8.0.1
        See Also:
        Constant Field Values
    • Method Detail

      • renderTree

        void renderTree​(MarkupOutput out,
                        java.util.Enumeration elements)
        Creates and register a tree. It also populate its root elements. Use the first time a tree is generated.
        out - MarkupOutput where to write the output
        elements - An Enumeration of TreeNode objects.
      • renderNodes

        void renderNodes​(MarkupOutput out,
                         java.util.Enumeration elements)
        Function that renders the nodes of a tree box, given the enumeration of TreeNodes objects.
        out - MarkupOutput instance where to write the output of the method.
        elements - Enumeration of TreeNode objects.
      • getProperty

        java.lang.Object getProperty​(java.lang.String key)
        Function that returns value for a given Tree's property.
        key - name of property
        Objest value held by property
      • setProperty

        void setProperty​(java.lang.String key,
                         java.lang.Object obj)
        Function used for setting Tree properties. Key is the name of the property and obj its value.
        key - name of property
        obj - property's value.