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

Dynamic context - Creation and Model binding

Hi, I would like to know if it is possible to do the following and how to do it:

1- Create a new attribute for a context node that is not defined at design time;

2- Create a new node that is not defined at design time;

3- Bind a model class to a node at runtime;

I searched for answers in this forum and the documentation but I did not find any complete information.

Thanks and regards,

Barthelemy

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Jun 14, 2004 at 11:01 PM

    It is certainly possible.

    Try the following code snippet:

    IWDNodeInfo nodeInfo = wdContext.wdGetAPI().getRootNodeInfo().addChild("TestNode", null, true, true, false, true, false, true, null, null, null);

    //If you want to bind the node to a model node then the

    //second argument to the above method should be the

    //model class

    IWDAttributeInfo testAttrib = wdContext.wdGetAPI().getRootNodeInfo().getChild("TestNode").addAttribute("testAttrib", "ddic:com.sap.dictionary.string");

    IWDNodeElement testNode = wdContext.getChildNode("TestNode", IWDNode.LEAD_SELECTION).getCurrentElement();

    IWDNode testNode2 = wdContext.getChildNode("TestNode", IWDNode.LEAD_SELECTION);

    //Now you can bind testNode with the Model Node

    //You can also set a value to the newly created attribute

    testNode.setAttributeValue("testAttrib", new String("Value"));

    Hope this helps.

    Shakeel

    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.