cancel
Showing results for 
Search instead for 
Did you mean: 

Manually create Text Edit boxes

Former Member
0 Kudos

Hi,

I would like to dynamically create the editable text boxes as I received the context element structure of type and value. Each Type represents a Label in the view while each Value represents the IWDTextEdit (which can be displayed the database value and allows user changes)

can help?

Thank you.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

See also Chris Whealy, "Inside Web Dynpro for Java", chapter 10.8.

Armin

Former Member
0 Kudos

Hi,

You can use code similar to the one given below. in wdDoModifyView method of view (view controller).

// container

IWDTransparentContainer container1= (IWDTransparentContainer) view.getElement("Container1");

// context to be used for label name and editor value

IWDAttributeInfo newLblAttrInfo = wdContext.nodeTableData().getNodeInfo().getAttribute("new");

IWDAttributeInfo newEditorAttrInfo = wdContext.nodeTableText().getNodeInfo().getAttribute("value");

//creating label

IWDTextView label1 = (IWDTextView)view.createElement(IWDTextView.class, "label1");

label1.bindText(newLblAttrInfo);

// creating editor

IWDInputField editor1 = (IWDInputField)view.createElement(IWDInputField.class,"editor");

editor1.bindValue(newEditorAttrInfo);

//adding it in container

container1.addChild(label1);

container1.addChild(editor1);

Here "Container1" is the id of already created TransparentContainer where the elements to be placed. "Value" and new are the value attribute name of value node TableData and TableText. These are just sample names names and will be different for you. Please use accordingly.

Hope it helps.

Former Member
0 Kudos

Hi,

can newEditAttrInfo be displayable and editable when it is from Request_xxxx when it bind with IWDInputField ?

Former Member
0 Kudos

It will be editable. Make sure which ever context you use, irrespective of whether it is model or value node attribute, it should have data. if it doesnt and the input field is not editable, insert a blank data in that and check. You can also set readonly property to tru or false based on your requirment.

if you go through webdynpro for java book, you will get more clarity.

Hope it helps

Former Member
0 Kudos

Hi,

I don't have the book. : (

If i have multiple of that attribute which each has the field "type" (string) and other field "value" (double)

how do i do the binding?

currently i cannot make it work with this:

// container

IWDTransparentContainer container1= (IWDTransparentContainer) view.getElement("Container1");

for (int i =0; i < wdContext.nodeParameter().size(); i++) {

// context to be used for label name and editor value

IWDAttributeInfo newLblAttrInfo = wdContext.nodeParameter().getNodeInfo().getAttribute("Type");

IWDAttributeInfo newEditorAttrInfo = wdContext.nodeParameter().getNodeInfo().getAttribute("Value");

//creating label

IWDTextView label1 = (IWDTextView)view.createElement(IWDTextView.class, "label"+i);

label1.bindText(newLblAttrInfo);

// creating editor

IWDInputField editor1 = (IWDInputField)view.createElement(IWDInputField.class,"editor"+i);

editor1.bindValue(newEditorAttrInfo);

//adding it in container

container1.addChild(label1);

container1.addChild(editor1);

}

How do i iterate to get IWDAttributeInfo from wdContext ?

Thanks

Former Member
0 Kudos

Hi,

Following is the code to iterate


Iterator itr = wdContext.nodeParameter().getNodeInfo().iterateAttributes();
	  while(itr.hasNext())
	  {
		  IWDAttributeInfo attributeInfo = (IWDAttributeInfo)itr.next();
	  }

Regards

Ayyapparaj

Former Member
0 Kudos

How to iterate the IWDNode?

as currently i have this :

Context root

---> passengerList (singleton)

--> passenger (singleton)

-


> passenger ID

-


> passenger name

-


> passenger address

and have this as the data

passenger id: 001

passenger name: name1

passenger address: addr 1

passenger id: 002

passenger name: name2

passenger address: addr 2

Former Member
0 Kudos

Hi,

I have the Passenger node with fields "checkType" and "value" where the value of the "checkType" can be "name", "address" and "no"

and the value of the "value" field is the actual value of the name, address and the no.

I have around three Passenger node and I want to display them as followed:

no : 1

name: name1

address: address1

no: 2

name: name 2

address: address2

no: 3

name: name 3

address: address3

where address can be changed.

However the following code will displayed all with the same entry.

no : 1

name: name1

address: address1

no : 1

name: name1

address: address1

no : 1

name: name1

address: address1

Can help? Thanks


if (firstTime) {
  IWDTransparentContainer container = (IWDTransparentContainer) view.getElement("container");
 if (!wdContext.nodePassengers().isEmpty()) {
   for (int i = 0; i < wdContext.nodePassenger().size(); i++){
	IWDAttributeInfo labelAttrInfo = wdContext.nodePassenger().getNodeInfo().getAttribute("CheckType");
	IWDAttributeInfo textAttrInfo = wdContext.nodePassenger().getNodeInfo().getAttribute("Value");
				  
	 IWDTextView label = (IWDTextView) view.createElement(IWDTextView.class, "Label"+i);				  
	label.bindText(labelAttrInfo);
				  
	IWDInputField textEdit = (IWDInputField) view.createElement(IWDInputField.class, "Value"+i);
	textEdit.bindValue(textAttrInfo);
				  
        container.addChild(label);
        container.addChild(textEdit);
 }//endIf
}// endFor
 }