Skip to Content
author's profile photo Former Member
Former Member

WDTree Dyn Control


I need to develop a dynamically growing tree control in WAS 6.3.

Is this possible WDTree Dyn Control ? If so, could anybody help on this ?

Also can I manually do the coding for inserting a WD control instead of using the control using the wizards. This is to understand the code pieces behind the dynpro technology.



Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Sep 18, 2003 at 02:31 PM

    Hello Sharafudheen,

    we will introduce an enhanced documentation on Dynamic Programming with Web Dynpro via SDN or via a new version of the Sneak Preview edition (where this topic will be included in the help) in a couple of weeks. Please stay tuned!

    You can use dynamic controls within Web Dynpro. You also could do manual coding - but restrictions apply in order to allow synchronisation with the visual model. You will have more details on this once we have completed and released the documentation.



    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 19, 2003 at 01:35 PM

    Hi Sharafudheen,

    here's a little example for you which combines a tree created at designtime and a tree created at runtime in one TransparentContainer:

    1. Create a View named "RecursiveTreeView"

    2. In the View context define a Value Node "TreeNode" with a Value Attribute "text" and a Recursion Node "Child". It's important that you type these names correctly, since the Context paths will later be used for the data binding of the dynamic tree at runtime. The "repeatedNode" property of "Child" must be linked to its parent node "RecursiveTreeView.TreeNode".

    3. Layout and Data-Binding:

    Use "MatrixLayout" for the RootUIElementContainer.

    Insert a Button with text "Create second dynamic tree" and onAction "CreateDynamicTree". Use "MatrixHeadData" for the "layoutData" property of the button.

    Insert a TransparentContainer named "TreeContainer" with "GridLayout" and 2 columns. Use also "MatrixHeadData" for the "layoutData" property of the container.

    Insert a tree (the static one) named "RecursiveTree" into the transparent container. Set the "dataSource" of the tree to "RecursiveTreeView.TreeNode" and the "rootText" to what you like.

    Add a TreeNodeType child to the tree named "RecNode". The dataSource of the node is also "RecursiveTreeView.TreeNode", the text should be bound to "RecursiveTreeView.TreeNode.text".

    4. Implementation. Insert the following code snippets into the Implementation of RecursiveTreeView (You can see where to insert looking at the @@begin tags):

    //@@begin wdDoInit()

    IPrivateRecursiveTreeView.ITreeNodeElement level1element;

    for (int i = 0; i < 2; i++) {

    level1element = wdContext.createTreeNodeElement();

    level1element.setText("Node " + i);


    for (int j = 0; j < 4; j++) {

    IPrivateRecursiveTreeView.ITreeNodeElement level2element = level1element.nodeChild().createTreeNodeElement();

    level2element.setText("SubNode " + i + "." + j);


    for (int k = 0; k < 6; k++) {

    IPrivateRecursiveTreeView.ITreeNodeElement level3element = level2element.nodeChild().createTreeNodeElement();

    level3element.setText("SubNode " + i + "." + j + "." + k);






    //@@begin wdDoModifyView

    if (wdContext.currentContextElement().getCreateDynamicTree()) {

    // Disable button to avoid second creation.


    IWDButton createButton = (IWDButton) view.getElement("CreateTreeButton");


    // Create tree and node type and bind node to tree

    IWDTree tree = (IWDTree) view.createElement(IWDTree.class, "DynRecursiveTree");

    IWDTreeNodeType treeNode = (IWDTreeNodeType) view.createElement(IWDTreeNodeType.class, "DynRecursiveTreeNode");



    tree.setRootText("Dynamic recursive tree");

    // Layout like static one

    IWDGridData treeLayoutData = (IWDGridData) tree.createLayoutData(IWDGridData.class);



    // Bind like static one



    // Add to right side of container.

    IWDTransparentContainer container = (IWDTransparentContainer) view.getElement("TreeContainer");




    //@@begin onActionCreateDynamicTree(ServerEvent)

    // Set flag to create tree on the next wdDoModifyView hook.



    5. Build and deploy. If i didn't miss something, you should see the button and static tree. Clicking the button creates the dynamic tree, which shares the same context than the static one and disables the button. Congratulations, you created your first dynamic tree at runtime.



    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.