cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic Web Dynpro Project

Former Member
0 Kudos

Noufal,

I am working on a WD app wherein I need to dynamically populate dropdownlists, input fields. Dynamic values are contained in an object that has propertiy values such as id, text (could be a value set), read-only flag, labelid flag etc.....

My issue is depending on the UI element type (dropdownlsit, input field, checkbox etc..) I may have to populate UI element corresponingly. I do not want to yse context nodes to bind values, as I have way too many fields to populate. My question to you is as follows:

1) How do I know the type of the element ?

2) How do I populate the dropdown list ?

3) Show the view manipulation be done only in the wdDoModifyView method only ?

If you have posted code for some of my questions, please paste in your response once again....

Thanks,

Sri

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Can you please give some more details?

Are the UI elements statically defined or do you want to create them programmatically from some configuration data?

Armin

Former Member
0 Kudos

Thanks guy. To keep things simple, I am storing the list of field names a.k.a UI elemnt ids in the vienw context. May be not the best approach, but if it works I am ok.

Regards,

Sri

Former Member
0 Kudos

It is not yet clear to me what you want to do.

Do you want to populate a view programmatically from data in the context?

Can you please elaborate?

Armin

Former Member
0 Kudos

Yes, you are right. I want to populate a view programatically from data in the context. The data for the view, is based on the UI elements in the view. So, in order to get the list of UI elements (of interest to me), I need their element ID's. This I plan to store as values attributes. Rather than traversing the UI element hierarchy and pick'n choose elements I want, I use the approach of storing their Id's as values attributes.

Do let me know if you see any major pit-falls in my approach.

Thanks !

Sri

Former Member
0 Kudos

Sorry, I don't get it.

What means the sentence "The data for the view is based on the UI elements in the view"?

Can you describe the complete use case?

Armin

Former Member
0 Kudos

Armin,

"The data for the view is based on the UI elements in the view" should read as "the data required for populating the UI elements is obtained from buisness rule objects"

Use case: Creating a Material Master Data maintanence app. Business rule for each material master field, have been represented as an XML shema. At runtime rule profile objects are created that supply data to populate in the UI elements.

Also, if possible, please advise the best way to traverse a node consisting of values nodes, and get the value for each attribute in the value node.

Example:

NodeA

--NodeA1

--Node11

--Value1

--NodeA2

--Node21

--Value1

--NodeA3

--Node31

--Value1

Need to be able to read 'Value1' for each node.

Thanks in advance !

Sri

Former Member
0 Kudos

wdcontext.nodenode11element.getelementat(index).getValue1();

wdcontext.nodenode21element.getelementat(index).getValue1();

and so on

Hope you have all the attributes created statically.

If they are being created dynamically

wdcontext.nodenode11element.getelementat(index).getattribute(String);

Hope that helps

Message was edited by: Noufal Kareem

Former Member
0 Kudos

I suggest reading chapter 8.5 of Chris Whealy's book "Inside Web Dynpro for Java".

In this chapter, Chris shows how to traverse an arbitrary context structure and dynamically create a view that displays the context data.

Armin

Former Member
0 Kudos

Armin,

I reviewed the chapter and found it helpful. However, I am not sure if it addresses the issue of accessing the value of a node, the kind I have talked about. Example is as follows.

I have the context structure created dynamically, and it is as follows.

NodeA

-


NodeA1

-


NodeA11

-


Element1

-


Element2

-


Element3

-


NodeA2

-


NodeA21

-


Element1

-


Element2

-


Element3

-


NodeA3

-


NodeA31

-


Element1

-


Element2

-


Element3

One of the earlier responses to my post, I think it was by Noufal, would work if nodes were created at design time.

But noes above are created at runtime.

I have been able to access the node say NodeA11, but still not sure how to access the attribute Element1 or Element2, which ever is the selected element. Keep in mind, these elements are created dynamically, so I cannot access values with statement like

wdContext.currentNodeA11Element().getElement1();

Hope I am making sense. Do let me know how.

Thanks !

Sri

Former Member
0 Kudos

Use the generic context API (IWDNode, IWDNodeElement, IWDAttributeInfo etc.) instead of the generated API.

Example:


IWDNode node = wdContext.getChildNode("NodeA", IWDNode.LEAD_SELECTION);
IWDNodeElement elem = node.getCurrentElement();

See "Inside Web Dynpro", chapter 12.5

Armin

Former Member
0 Kudos

Hi

To add up to the above post you can also get the attribute by specifying the attribute name.

wdContext.getChildNode(nodename,int index).getElementAt(int index).getAttributeValue(String attribute);

Hope that helps.

Regards

Noufal

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi srikanth ,

1, For getting the type of the element use the generic UI element object.getClass()

IWDUIElement a[] = t.getChildren();

for(int i =0;i<a.length;i++){

wdThis.wdGetAPI().getComponent().getMessageManager().reportSuccess(a<i>.getId());

IWDUIElement i1 = (IWDUIElement)view.getElement(a<i>.getId());

wdThis.wdGetAPI().getComponent().getMessageManager().reportSuccess(""+i1.getClass());

}

2. To populate a drop downlist

ISimpleTypeModifiable stmObj =(ISimpleTypeModifiable)wdThis.wdGetAPI().getContext().getModifiableTypeOf(<"attr name which is mapped to drop down">);

IModifiableSimpleValueSet valueSet =(IModifiableSimpleValueSet) stmObj.getSVServices().getModifiableSimpleValueSet();

valueSet.put(id1,id1);

3.Yes ,anything and everything related to UI element properties should be accessed and modified only in wdDoModifyView

Regards

Bharathwaj