on 12-01-2006 12:32 PM
I was trying to get the attributes of a value node dynamically. I'v used the code below.
But I didnt get the attributes. I am getting nullpointer exception.
can anybody tell me what is wrong with my code?
Thanks in advance...
final IWDNodeInfo tabNode = wdContext.nodeName().getNodeInfo();
final IStructure structure = tabNode.getStructureType();
int NoOfFlds = 0;
if (null != structure)
NoOfFlds = structure.getNumberOfFields();
else
for (final Iterator i = tabNode.iterateAttributes(); i.hasNext(); i.next() )
NoOfFlds++;
for(int count=0;count<NoOfFlds;count++)
{
String fieldName = tabNode.getStructureType().getField(count).getName();
}
Indu
Hi Indu,
If you want to use Attributes...
final IWDNodeInfo tabNode = wdContext.nodeName().getNodeInfo();
final IStructure structure = tabNode.getStructureType();
int NoOfFlds = 0;
if (null != structure)
NoOfFlds = structure.getNumberOfFields();
else
for (final Iterator i = tabNode.iterateAttributes(); i.hasNext(); )
{
NoOfFlds++;
IWDAttributeInfo attribInfo = (IWDAttributeInfo)i.next();
if( attribInfo != null)
{
String attribName = attribInfo.getName();
}
}
Regards
Abhilash
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Now I am able to acees attributes. Can u tell me how can I assign caption to columns and how to add input fieds to a column? I'v tried using the code
IWDCaption Cap=(IWDCaption)view.createElement(IWDCaption.class,fieldName[count]);
Cap.setText(fieldName[count]);
tabColumn.setHeader((IWDCaption)Cap);
IWDInputField nameText=(IWDInputField)view.createElement(IWDInputField.class,fieldName[count]);
nameText.bindValue(fieldName[count]);
I got one exception like
"com.sap.tc.webdynpro.services.exceptions.CreationFailedException: Cannot create view element implementation com.sap.tc.webdynpro.clientserver.uielib.standard.impl.Caption "
Can u please tell me the reason?
Indu
1.U have to iterate over attributes of contextnode using iterateAttribute() method.
2.Inside the loop create and add column to the table reference.
3.Create Caption and inputfield elements.
IDs of Caption and inputfield elements should be different.U have passed same value in createElement() method of these elements (fieldName[count])
4.Input field's value attribute should be binded to attributeinfo of the value attribute.
5.Use setHeader() and setTableCellEditor() methods to set caption as header and inputfield as tablecell editor of the table column.
Ex :
Iterator it= wdContext.getChildNode("<<NodeName>>",0).getNodeInfo().iterateAttributes();;
while(it.hasNext()){
IWDAttributeInfo aInfo=(IWDAttributeInfo)it.next();
aInfo.getName();
}
Regards, Anilkumar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
76 | |
9 | |
8 | |
7 | |
6 | |
5 | |
5 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.