on 01-17-2006 7:22 PM
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
How does your view context look like and how did you bind the Tree, TreeNodeType, TreeItemType properties to this context?
Armin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.