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

Context Mapping a dynamically created node?


How can I create two dynamic Context nodes, one in ViewController and the other in Component Controller and finally create a context mapping between them.

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Oct 13, 2005 at 06:58 AM

    Hi MK,

    Giving you a sample code for the same :

    <b>creating a node & attribute in the component controller</b>

    // create a method in the component, write this code in it & call the method from the view

    IWDNodeInfo NodeInfo = wdContext.getNodeInfo().addChild("comp_dyn_Node",null,true,true,false,false,false,true,null,null,null);

    wdComponentAPI.getMessageManager().reportSuccess("Created a node ::"+NodeInfo.getName());

    IWDAttributeInfo info = NodeInfo.addAttribute("comp_dyn_Attr" , "");

    wdComponentAPI.getMessageManager().reportSuccess("Created an attribute ::"+info.getName());

    <b>Creating & mapping a node & attribute in the view</b>

    IWDNodeInfo NodeInfo = wdContext.getNodeInfo().addMappedChild("view_dyn_Node",null,true,true,false,null,false,true);

    IWDNodeInfo comp_node_info = wdThis.wdGetDynamic_mappingController().wdGetContext().getNodeInfo().getChild("comp_dyn_Node");

    wdComponentAPI.getMessageManager().reportSuccess("Created a node ::"+NodeInfo.getName());

    wdComponentAPI.getMessageManager().reportSuccess("getting the component node ::"+comp_node_info.getName());


    IWDAttributeInfo info = NodeInfo.addMappedAttribute("view_dyn_Attr",".Dynamic_mapping.comp_dyn_Node.comp_dyn_Attr");

    wdComponentAPI.getMessageManager().reportSuccess("Created an attribute ::"+info.getName());

    wdContext.getChildNode("view_dyn_Node",wdContext.getLeadSelection()).getCurrentElement().setAttributeValue("view_dyn_Attr","Test Value for dynamically created node mapping");

    wdComponentAPI.getMessageManager().reportSuccess("Reading from the new attribute ::"+wdContext.getChildNode("view_dyn_Node",wdContext.getLeadSelection()).getCurrentElement().getAttributeValue("view_dyn_Attr"));

    wdComponentAPI.getMessageManager().reportSuccess("Reading from the component attribute ::"+wdThis.wdGetDynamic_mappingController().wdGetContext().getChildNode("comp_dyn_Node",wdContext.getLeadSelection()).getCurrentElement().getAttributeValue("comp_dyn_Attr"));

    Hope this helps,

    Best Regards,


    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.