on 09-27-2004 4:10 PM
Hi,
I am trying to create & fill a Context dynamically.
But I can' able to add more than one element to the root node.
Please find the code below.
/*Creation of ValueNode and attribute */
IWDNodeInfo childNode = wdContext.wdGetAPI().getRootNodeInfo().addChild("Child", null, true, true, true, true, false, false, null, null, null);
IWDNode n= wdContext.getChildNode("Child",wdContext.LEAD_SELECTION);
IWDAttributeInfo at1=childNode.addAttribute("Attrib1","com.sap.dictionary.string");
/* Populating the above created context */
IWDNodeElement testNodeEle = wdContext.getChildNode("Child", IWDNode.LEAD_SELECTION).createElement();
testNodeEle.setAttributeValue("Attrib1","Value1");
wdContext.getChildNode("Child",IWDNode.LEAD_SELECTION).addElement(testNodeEle);
IWDNodeElement testNodeEle1 = wdContext.getChildNode("Child", IWDNode.LEAD_SELECTION).createElement();
testNodeEle1.setAttributeValue("Attrib1","Value2");
wdContext.getChildNode("Child",IWDNode.LEAD_SELECTION).addElement(testNodeEle1);
In the above code I am trying to add two elements to the root node.But it always adding one element only.
I feel the problem with creating root node.Please let me know the solution.
Thanks & Regards
Anilkumar
Hi,
Please find the code below where i am creating and binding the Table dynamically.
detailgroup.destroyAllChildren();
int id=0;
IWDTable table=(IWDTable)myView.createElement(IWDTable.class,"table");
ResultSetMetaData metaData=rs.getMetaData();
int columnCount=metaData.getColumnCount();
IWDNodeInfo nodeinfo=wdContext.getNodeInfo();
wdContext.invalidate();
IWDNodeInfo childNode = wdContext.wdGetAPI().getRootNodeInfo().addChild("Child", null, true, true, true, true, false, false, null, null, null);
IWDNode n= wdContext.getChildNode("Child",wdContext.LEAD_SELECTION);
for(int count=1;count<=columnCount;count++)
{
IWDAttributeInfo at1=childNode.addAttribute(metaData.getColumnName(count),"com.sap.dictionary.string");
IWDTableColumn column=(IWDTableColumn)myView.createElement(IWDTableColumn.class,metaData.getColumnName(count));
IWDCaption colHeader=(IWDCaption)myView.createElement(IWDCaption.class,metaData.getColumnName(count) + id);
colHeader.setText(metaData.getColumnName(count));
column.setHeader(colHeader);
IWDTextView txtview=(IWDTextView)myView.createElement(IWDTextView.class,"txtView"+id);
txtview.bindText(at1);
IWDTableCellEditor editor=(IWDTableCellEditor)txtview;
column.setTableCellEditor(editor);
table.addColumn(column);
id++;
}
detailgroup.addChild(table);
Regards
Anilkumar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I am binding the node to a table.But i am getting only one row in the table.
Please let me know how to do this in a simpler way.
Thanks & Regards
Anilkumar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Two simplifications: wdContext.wdGetAPI().getRootNodeInfo() is wdContext again. Also, once you have found your node and stored it in n, you do not need to call wdContext.getChildNode("Child"...) again and again.
About your problem: Binding a table to the node has to be done dynamically, too. What does your code in wdDoModifyView look like?
Regards, Uwe
Hello Anilkumar,
your code is correct (although unnecessarily complicated).
I've taken it into a project of mine and observed that "Child" contained two elements afterwards. How do you come to the assumption that it only contains one element?
Regards, Uwe
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.