Skip to Content
0
Former Member
Jan 03, 2008 at 04:50 AM

dynamically created attribute not bound

16 Views

hi ,

I hv an application where the attributes are accessed from a backend java file.

i hv created a new attribute :

#----


//create a label

IWDLabel hp= (IWDLabel)view.createElement(IWDLabel.class,"hpage");

hp.setText("HOME PAGE");

theGroup.addChild(hp);

//create an input field

IWDInputField homepage= (IWDInputField)view.createElement(IWDInputField.class,"hp");

IWDAttributeInfo attr=(IWDAttributeInfo)wdContext.getNodeInfo().getAttribute("HomePage");

homepage.bindValue(attr.getName());

theGroup.addChild(homepage);

-


#

and i hv bound it as:

#----


public void wdDoInit()

{

IWDNodeInfo node =wdContext.getNodeInfo().addChild(

"DynamicNode", null,true, true,false,false, false,true,null,null,null);

//“Create“ backend connection to SomeBackEnd.java

SomeBackEnd theBackend = new SomeBackEnd()

// loop through all fields of the Object[] fields containing the

// FieldDescriptors

for (int index = 0; index < theBackend.getNumberFields(); index++) {

// ... and simply create the required context attribute

SomeBackEnd.FieldDescriptor fld = theBackend.getField(index);

node.addAttribute(fld.getName(), fld.getType());

}

  • wdContext.getNodeInfo().addAttribute("HomePage","com.sap.dictionary.string");*

wdContext.currentContextElement().setVisible(WDVisibility.NONE);

}

-


#

bt when i click on save btn iget the following output:

HOME PAGE:DataAttributeInfo(DynamicView.HomePage)

even if i leave it blank or enter some data.

i hv written the following code in save btn:

#----


Object obj=wdContext.getNodeInfo().getAttribute("HomePage");

if(obj==null)

obj="<NULL>";

result = "Your data was successfully saved:" + "\n\r";

result = result + "HOME PAGE" + " :" + obj.toString()+"\n";

#----