cancel
Showing results for 
Search instead for 
Did you mean: 

building a webdybpro tree

lakshmi_narayana2
Active Participant
0 Kudos

I need to build a webdynpro tree from a hierarchy structure in the backend.

Am able to recursively build the tree in my java stand alone program successfully from the backend.

But when am trying to map the same into webdynpro am not able to view any nodes (either the parent or any of the child nodes).Am getting a javascript error on the screen

error description is: Invalid procedure call or argument.

Thanks in advance

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Steve,

Could you provide exact stack trace?

Also when posting to SDN place Java code inside "["code"]" "["/code"]" block (without quotes around [ and ]) and replace <b>//comments"</b> with <b>/* comments */</b>

Valery Silaev

EPAM Systems

http://www.NetWeaverTeam.com

Former Member
0 Kudos

How does your view context look like and how did you bind the Tree, TreeNodeType, TreeItemType properties to this context?

Armin

lakshmi_narayana2
Active Participant
0 Kudos

I started building the tree using recursive tree example/tuorial as i need my tree to work in a simialr way. So the context / binding i haven't changed anything.

Pl let me know in detail how can i modify them according to my tree structure.

Thanks

Former Member
0 Kudos

Can you shortly describe which context nodes/attributes you use, what their properties are and how you have bound UI element properties to them?

Armin

lakshmi_narayana2
Active Participant
0 Kudos

Armin

Can i have your email id so that i can send you my tree project as well my java program

Former Member
0 Kudos

Well no, because I am answering all these SDN questions from my private notebook without NWDS etc.

Armin

lakshmi_narayana2
Active Participant
0 Kudos

My Context goes like this

Context

treeNode(Value Node)

childNode(recursivenode)

hasChildren

iconSource

ignoreAction

isExpanded

text

textOfSelectedNode

properties for treeNode

cardinality:0...n

collectionType:list

initializedSelection:true

selection:0..1

singleton:true

properties for childnode

repeatedNode:TreeView.treeNode

The following is my TreeView.java code

package com.sap.tut.wd.tree;

import java.util.ArrayList;

import java.util.List;

import java.util.StringTokenizer;

import a2i.common.CatalogData;

import a2i.common.WebTreeNode;

import a2i.generated.WebTreeNodeArray;

import com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDTreeNodeType;

import com.sap.tc.webdynpro.services.sal.localization.api.IWDResourceHandler;

import com.sap.tut.wd.tree.wdp.IPrivateTreeView;

public class TreeView

{

/**

  • Logging location.

*/

private static final com.sap.tc.logging.Location logger =

com.sap.tc.logging.Location.getLocation(TreeView.class);

static

{

//@@begin id

String id = "$Id$";

//@@end

com.sap.tc.logging.Location.getLocation("ID.com.sap.tc.webdynpro").infoT(id);

}

private final IPrivateTreeView wdThis;

private final IPrivateTreeView.IContextNode wdContext;

private final com.sap.tc.webdynpro.progmodel.api.IWDViewController wdControllerAPI;

private final com.sap.tc.webdynpro.progmodel.api.IWDComponent wdComponentAPI;

public TreeView(IPrivateTreeView wdThis)

{

this.wdThis = wdThis;

this.wdContext = wdThis.wdGetContext();

this.wdControllerAPI = wdThis.wdGetAPI();

this.wdComponentAPI = wdThis.wdGetAPI().getComponent();

}

public void wdDoInit()

{

//@@begin wdDoInit()

wdComponentAPI.getMessageManager().reportWarning("into init method");

catalog = new CatalogData();

WebTreeNode treeNode = null;

try{

catalog.Login("10.1.83.72", 2015, "Admin","adidas", "English [US]", 10, 30, 50000,null);

treeNode = catalog.GetHierarchy("Organisation Unit Hierarchy",0);

int nodeId = treeNode.GetID();

WebTreeNodeArray nodeArray = treeNode.GetChildren();

IPrivateTreeView.ITreeNodeNode rootNode = wdContext.nodeTreeNode();

IPrivateTreeView.ITreeNodeElement level1Node = null;

if(nodeArray.GetSize()>0)

{

for(int i=0;i<nodeArray.GetSize();i++)

{

WebTreeNode childNode = nodeArray.GetWebTreeNodeAt(i);

level1Node.setText(childNode.GetValue());

level1Node.setIsExpanded(true);

this.drillDownTree(childNode, level1Node);

}

}

catalog.Logout();

}catch(Exception e){

e.printStackTrace();

}

}

public void wdDoExit()

{

//@@begin wdDoExit()

//@@end

}

public static void wdDoModifyView(IPrivateTreeView wdThis, IPrivateTreeView.IContextNode wdContext, com.sap.tc.webdynpro.progmodel.api.IWDView view, boolean firstTime)

{

//@@begin wdDoModifyView

if (firstTime) {

IWDTreeNodeType treeNode =

(IWDTreeNodeType) view.getElement("TheNode");

treeNode.mappingOfOnAction().addSourceMapping(

"path",

"selectedElement");

treeNode.mappingOfOnLoadChildren().addSourceMapping(

"path",

"element");

}

//@@end

}

//@@begin javadoc:onActionSelect(ServerEvent)

/** Declared validating event handler. */

//@@end

public void onActionSelect(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent, com.sap.tut.wd.tree.wdp.IPrivateTreeView.ITreeNodeElement selectedElement )

{

//@@begin onActionSelect(ServerEvent)

wdContext.currentContextElement().setTextOfSelectedNode(selectedElement.getText());

//@@end

}

//@@begin javadoc:onActionLoadChildren(ServerEvent)

/** Declared validating event handler. */

//@@end

public void onActionLoadChildren(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent, com.sap.tut.wd.tree.wdp.IPrivateTreeView.ITreeNodeElement element )

{

//@@begin onActionLoadChildren(ServerEvent)

this.wdDoInit();

//@@end

}

//@@begin others

private CatalogData catalog;

private int selectedNodeID;

// private void addChildren(IPrivateTreeView.ITreeNodeElement parent) {

private void drillDownTree(WebTreeNode childNode, com.sap.tut.wd.tree.wdp.IPrivateTreeView.ITreeNodeElement element)

{

WebTreeNodeArray nodeArray = childNode.GetChildren();

WebTreeNodeArray nodeArray1 = null;

String str=null;

if(nodeArray.GetSize()>0)

{

//str = childNode.GetValue();

System.out.println(" "+childNode.GetValue());

for(int i=0;i<nodeArray.GetSize();i++)

{

WebTreeNode innerChildNode = nodeArray.GetWebTreeNodeAt(i);

if(innerChildNode.GetChildren().GetSize()>0)

{

drillDownTree(innerChildNode,element);

}

else

{

System.out.println(" " + innerChildNode.GetValue());

element.setText(innerChildNode.GetValue());

}

}

}

}

//@@end

}

Hope the above helps you identifying the poblem.

thanks