com.microstrategy.web.app.gui.TreeBox |
![]() |
This interface is 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(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".TREE_NAME
: a unique name that identifies the tree.
CART_INDEX
: the index of this tree within the page.
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(); } } }
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 | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
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
Function that returns value for a given Tree's property.
key | name of property |
---|
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. |
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. |
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. |