Skip to Content
avatar image
Former Member

Tree UI element init. gives NullPointerException

I am new to WebDynPro.

I am working with Netweaver Studio version 2.0.14

I am trying to use a Tree UI element.

The tree element(context) has recursive node and 4 attributes. The UI element has been binded to context.

I have coded following init method to initialize the tree element.

IPrivateTreeCom1View.ITreeNodeElement nodeelement;

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

{

nodeelement = wdContext.createTreeNodeElement();

nodeelement.setText("Node:");

nodeelement.setLevel(1);

nodeelement.setHasChildren(true);

nodeelement.setIgnoreAction(false);

wdContext.nodeTreeNode().addElement(nodeelement);

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

{

IPrivateTreeCom1View.ITreeNodeElement level2element = nodeelement.nodeChild().createTreeNodeElement();

level2element.setText("Level 2 element"+j);

level2element.setLevel(2);

level2element.setHasChildren(true);

nodeelement.nodeChild().addElement(level2element);

}

When I try to run the application it throws following exception

The initial exception that caused the request to fail, was:

java.lang.NullPointerException

at com.sap.tc.webdynpro.clientserver.uielib.standard.uradapter.TreeAdapter$Nodes.next(TreeAdapter.java:1326)

at com.sap.tc.ur.renderer.ie6.TreeRenderer.renderTreeNodeFragment(TreeRenderer.java:2335)

at com.sap.tc.ur.renderer.ie6.TreeRenderer.renderTreeFragment(TreeRenderer.java:673)

at com.sap.tc.ur.renderer.ie6.TreeRenderer.render(TreeRenderer.java:69)

at com.sap.tc.webdynpro.clientimpl.html.renderer.uielements.base.RenderManager.render(RenderManager.java:434)

... 44 more

Please help.

Suresh Yadav

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

6 Answers

  • Best Answer
    avatar image
    Former Member
    Jun 15, 2007 at 06:25 AM
    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Mar 09, 2007 at 08:05 AM

    Hi,

    Please check if you have added TreeNodeType UI element in your view and you have binded all the properties to that TreeNodeType properly.

    Because for Tree UI to work, you will need TreeNodeType created inside your Tree UI.

    Regards,

    Mausam

    Message was edited by:

    Mausam Kakkad

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Mar 09, 2007 at 09:36 AM

    Verify if Tree.dataSource and TreeNodeType.dataSource are bound to the context node providing the tree data (not the recursive subnode).

    Context:

    TreeNode

    -- Attribute1

    -- Child (recursive subnode)

    UI element:

    Tree

    -- TreeNodeType

    Tree.dataSource = TreeNode

    TreeNodeType.dataSource = TreeNode

    TreeNodeType.text = TreeNode.Attribute1

    Armin

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jun 15, 2007 at 06:54 AM

    Hi,

    The Problem is in the Tree UI Element Properties.

    <b>You have not set the DataSource of the Tree UI Element to the Node which contains Attributes and Recursive Node. If it is not set it will show error.</b>

    (The DataSource Properties of Tree and TreeNodeType must be bound to the context).

    Regards

    Satish Kumar SV

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jun 15, 2007 at 05:39 AM

    I had not bind the TreeNodeType.dataSource with the context that provided the tree data.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 13, 2007 at 02:02 PM

    I haven't added the TreeNodeType UI element and hence also didn't bind it to the context.

    Add comment
    10|10000 characters needed characters exceeded