Interface TreeBox

  • All Superinterfaces:
    GuiElement
    All Known Implementing Classes:
    TreeBoxImpl

    @Deprecated
    public interface TreeBox
    extends GuiElement
    Deprecated.
    Use (@link com.microstrategy.web.app.gui.TreeView} 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() {
               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();
               }
           }
       }
       

    Since:
    MicroStrategy Web 7.5.0
    • Field Detail

      • TREE_COMPONENT_ID

        static final java.lang.String TREE_COMPONENT_ID
        Deprecated.

        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
        Since:
        MicroStrategy Web 8.0.1
        See Also:
        Constant Field Values
    • Method Detail

      • renderTree

        void renderTree​(MarkupOutput out,
                        java.util.Enumeration elements)
        Deprecated.
        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.
      • renderNodes

        void renderNodes​(MarkupOutput out,
                         java.util.Enumeration elements)
        Deprecated.
        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.
      • getProperty

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

        void setProperty​(java.lang.String key,
                         java.lang.Object obj)
        Deprecated.
        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.