cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic creation of ComponentUsage

Former Member
0 Kudos

Hi people,

I want to reuse a view (ViewA) in different views (ViewB, ViewC, ViewD).ViewA has a quite complex logic, so it is necessary to outsource this view. Not only the logic, but also the count of UIElements and contextelements is quite large, for this I don't want to implement this part redundant in the views A, C and D.

I have to use ViewA in a table in the TablePopin UIElement. Every line of the table should have its own instance of ViewA. Is that possible?

My idea is it, to put the view in an own component. For every tableline I need an instance of the componentUsage. My problem is now, that I'm not able to create at runtime a ComponentUsage and at designtime I don't know how many instances I need. Is it possible in webdynpro to create dynamic instances of ComponentUsage?

If you know an other way, that prevents me from implementing the view and its logic more times, please tell me!

Thanks in advance,

Thomas Morandell

Accepted Solutions (1)

Accepted Solutions (1)

BeGanz
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Thomas,

just for clarification. Principally it is possible in Web Dynpro to dynamically create new component usages of the same type like an existing, statically declared one. This means after having defined a component usage of type ISomeComp (component interface definition) you can dynamically create new component usages which all point to the same component interface definition ISomeComp:

wdThis.wdGetISomeCompUsage().createComponentUsageOfSameType();

But this dynamic creation approach implies, that you must also embed the component interface view of this component usage to the view composition dynamically; and this is (unfortunately) quite cumbersome and complicated based on the existing Web Dynpro Java API (it is not yet optimized for a simple dynamic view composition modification.

Additionally, like Valery pointed out, the dynamic creation of new component usages is not compatible with table popins.

Regards, Bertram

Answers (3)

Answers (3)

Former Member
0 Kudos

Thanks for your help... I choose the way of binding my context to the detailview.

Thomas

former_member186016
Active Contributor
0 Kudos

Hi,

Following thread have info of how to create instances of Component Usages dynamically.

/message/195024#195024 [original link is broken]

Regards,

Ashwani Kr Sharma

Message was edited by:

Ashwani Kr Sharma

Former Member
0 Kudos

Thomas,

API docs explicitly mentions that it's impossible to use several expanded tablePopin-s with embeded interface view of component usages.

The only workaround is to have only one TablePopin expanded (i.e. it's necessary to collapse previous one). This way there are no problems at all -- one ComponentUsage is sufficient.

Valery Silaev

SaM Solutions

http://www.sam-solutions.net

Former Member
0 Kudos

Thank you Valery,

I have planned to have only one expanded Popin. If I understood you, then I have to load data of my outsourced view every time the leadselection of the table changes (?). If data in the outsourced view were changed, I need to save them in the NodeElement. Correct?

Which events should I use to load/save the data of the outsourced view?

Regards,

Thomas

Former Member
0 Kudos

Thomas,

I'd rather suggest you to try context mapping. Create node 0..n both in Master (table) component controller and in Child (details pop-in) components. Then map contexts between usages.

This way Child component will display lead selected element of master context and all synchronization will be done automatically. Sure, this way your popin must display only lead selected element.

Otherwise you must do either manual synchronization and lead selection tracking or try to play with IWDNodeCollectionDisposer (should be set for IWDNodeInfo).

Valery Silaev

SaM Solutions

http://www.sam-solutions.net