Skip to Content
avatar image
Former Member

Dynamic creation of ComponentUsage

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Best Answer
    May 15, 2007 at 01:15 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 14, 2007 at 02:46 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      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

  • May 14, 2007 at 02:48 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 16, 2007 at 09:23 AM

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

    Thomas

    Add comment
    10|10000 characters needed characters exceeded