on 02-08-2007 5:44 PM
Hi all,
I need to retrieve the path of an attribute to dynamically map it to a UI element.
How can I get the attribute or the node path without leading window name???
Please help!
Stefano!
+ MyNode
+ -- MyAttribute
wdContext.nodeMyNode().getNodeInfo().getAttribute(I<Controller>Element.MY_ATTRIBUTE);
Armin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Armin,
I haven't the nodeMyNode() method because the context is created at runtime.
Are u sure that I can use the following statement:
InputField.bindValue(wdContext.nodeMyNode().getNodeInfo().getAttribute(I<Controller>Element.MY_ATTRIBUTE));
The InputField.bindValue() method expect a string with the reference like "MyNode.MyAttribute", does the getAttribute() return this?
thank you again,
Stefano
here is example for text view:
IWDNodeInfo nodeInfo = wdContext.getChildNode("MyNode",IWDNode.LEAD_SELECTION).getNodeInfo();
IWDTextView tvEditor = (IWDTextView) view.createElement(IWDTextView.class, null);
tvEditor.bindText(nodeInfo.getAttribute("<ATTRIBUTE NAME>"));
for the input filed the same.
I've tryed this but it seems it doesn't work.
It seems that the getChildNode() method returns null...
Here is my code:
public void wdDoInit()
{
...
//Create Parent node
IWDNodeInfo Parent = wdContext.getNodeInfo().addChild("ParentNode",null,true,true,false,false,false,true,null,null,null);
//Create Parent attributes
Parent.addAttribute("Attr1","com.sap.dictionary.string");
Parent.addAttribute("Attr2","com.sap.dictionary.string");
//Create child node
IWDNodeInfo Child = wdContext.getNodeInfo().getChild("ParentNode").addChild("Child",null,true,true,false,false,false,true,null,null,null);
//Create Child attributes
Child.addAttribute("Attr1","com.sap.dictionary.string");
Child.addAttribute("Attr2","com.sap.dictionary.string");
...
public static void wdDoModifyView(IPrivateRequestView wdThis, ..., boolean firstTime)
{
if (firstTime) {
IWDNodeInfo nodeInfo = wdContext.getChildNode("ChildNode",IWDNode.LEAD_SELECTION).getNodeInfo();
IWDInputField InputField = (IWDInputField) view.createElement(IWDInputField.class, "InputFieldAttr1");
InputField.bindValue(nodeInfo.getAttribute("Attr1"));
...
Where I'm wrong?
Hi Armin,
my application receive context structure from an adaptive RFC model and build the context accordingly, the code I've inserted is just an example of which instructions I've used to build the context node and subnode.
At runtime I don't know which is the exact context structure because it is builded dynamically, the only thing that I know is the name of the node that contains the attribute that I have to map.
"Child" node could be a subnode of "Parent" or could be a parent itself or moreover the child of a child2... The only thing that I know at runtime is that my node is named "Child" and that it contains my attribute.
Sorry for the misunderstanding. Any suggestions?
Use IterateChildren method to iterate over child nodes
Iterator it =wdContext.getNodeInfo().iterateChildren();
while(it.hasNext())
{
IWDNodeInfo nodeInfo=(IWDNodeInfo)it.next();
wdComponentAPI.getMessageManager().reportSuccess(nodeInfo.getName());
Iterator it1=nodeInfo.iterateChildren();
while(it1.hasNext())
{
IWDNodeInfo nodeInfo1=(IWDNodeInfo)it1.next();
wdComponentAPI.getMessageManager().reportSuccess(nodeInfo1.getName());
}
}
Armin,
Can you help me sort out this problem?
I created a SearchResults context node in component controller and ResultView controller as well at design time and context mapping them at design time. Now at runtime, I created two attributes and setAttributeValue to this two attributes in component Controller, how can I map these two attributes to ResultView in runtime, so that I can get data and display them on View.
many thanks in advance
Andy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
24 | |
11 | |
9 | |
7 | |
6 | |
5 | |
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.