on 09-12-2007 8:31 AM
Hi,
can any one tell me the code to create value node & value attributes dynamically and also how to do context mapping dynamically?
thanks & regards,
vila
dynamic context mapping
dynamically create attributes using the following method,
IWDNodeInfo cbOptions = wdContext.getNodeInfo().addChild("cbOpt"+count, null, true, true, false, false, false, true, null, null, null);
cbOptions.addAttribute("opt"+critEle.getQuest_Critid(), "ddic:com.sap.dictionary.string");
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Vila..
Dynamic creation..
IWDTransparentContainer rootElement = (IWDTransparentContainer)view.getRootElement();
IWDNodeInfo tabNode=wdContext.getNodeInfo().addChild("Tab_Node",null,true,true,true,false,true,false,null,null,null);
IWDAttributeInfo tabAttrib_Name=tabNode.addAttribute("Name","ddic:com.sap.dictionary.string");
IWDAttributeInfo tabAttrib_Add=tabNode.addAttribute("Address","ddic:com.sap.dictionary.string");
IWDTable tab=(IWDTable)view.createElement(IWDTable.class,"Dyntable");
IWDAttributeInfo attrib1=tabNode.getAttribute("Name");
IWDAttributeInfo attrib2=tabNode.getAttribute("Address");
tab.bindDataSource(tabNode);
tab.setCompatibilityMode(WDTableCompatibilityMode.AUTO);
tab.setDesign(WDTableDesign.ALTERNATING);
IWDTableColumn tabColumn1=(IWDTableColumn)view.createElement(IWDTableColumn.class,"NameCol");
IWDTableColumn tabColumn2=(IWDTableColumn)view.createElement(IWDTableColumn.class,"AddressCol");
IWDCaption nameCap=(IWDCaption)view.createElement(IWDCaption.class,"nameCap");
nameCap.setText("Name");
tabColumn1.setHeader((IWDCaption)nameCap);
IWDCaption addCap=(IWDCaption)view.createElement(IWDCaption.class,"addCap");
addCap.setText("Address");
tabColumn2.setHeader((IWDCaption)addCap);
IWDInputField nameText=(IWDInputField)view.createElement(IWDInputField.class,"nameText");
nameText.bindValue(attrib1);
tabColumn1.setTableCellEditor((IWDTableCellEditor)nameText);
IWDInputField addText=(IWDInputField)view.createElement(IWDInputField.class,"addText");
addText.bindValue(attrib2);
tabColumn2.setTableCellEditor((IWDTableCellEditor)addText);
tab.addColumn(tabColumn1);
tab.addColumn(tabColumn2);
tab.createLayoutData(IWDRowHeadData.class);
tab.setWidth("300");
IWDNode dynTabNode=(IWDNode)wdContext.getChildNode("Tab_Node",0);
for(int i=0; i<5;i++)
{
IWDNodeElement dynTabElem=(IWDNodeElement)dynTabNode.createElement();
dynTabElem.setAttributeValue("Name","Karthik");
dynTabElem.setAttributeValue("Address","Chennai");
dynTabNode.addElement(dynTabElem);
}
rootElement.addChild(tab);
// you should create one action for the table lead selection
IWDAction tabact=(IWDAction)wdThis.wdGet<Actionname>();
tab.setOnLeadSelect(tabact);
Hop this will help..
Regards,
GS
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Vila,
Code to create dynamic node and attribute
value attributes and value nodes can be dynamically created in the controller context, the interface IWDNodeInfo provides the following methods:
· addAttribute( java.lang.String name, java.lang.String dataType)
· addAttribute( java.lang.String name,
· com.sap.dictionary.runtime.IDataType dataType)
· addChild( java.lang.String name,
java.lang.Class elementClass,
boolean singleton,
boolean mandatory,
boolean multiple,
boolean mandatorySelection,
boolean multipleSelection,
boolean initializeLeadSelection,
java.lang.String dataType,
IWDNodeCollectionSupplier supplier,
IWDNodeCollectionDisposer disposer)
e.g for creation of child node:
IWDNodeInfo node = wdContext.getNodeInfo().addChild(
"DynamicNode",
null,
true,
true,
false,
false,
false,
true,
null,
null,
null);
Regards,
Smruti
Message was edited by:
Armin Reichert
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
88 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.