Skip to Content
author's profile photo Former Member
Former Member

Is it possible to add/change a ViewContainerUIElement during runtime?

Hi all,

i want to add/change the content of a ViewContainerUIElement (VCUI) during runtime, but it doesn't work as expected (or hoped;). What i got working so far for an <b>already exising</b> VCUI is:

1. Find the IWDViewContainerInfo for the VCUI

2. If no default view usage exists, create an embedded view usage and set is as default.

3. Set the component usage to the IWDComponentUsageInfo requested.

4. Set the view to the IWDViewUsageInfo of the interface view, which should be the content of the VCUI.

This doesn't work, if it's done after the wdDoInit()s of the controller hierarchy has been processed. The component, which is represented by the usage, is deleted and recreated, but the visual representation doesn't get updated (e.g. no changes on the display) if it's done in an action handler for example. Why? If i change the component usage (cloned component usage) nothing happens too.

Even more problems arise, if i try to add a new VCUI. The steps are pretty the same as before, what is done additionally (and prior the steps above) is:

1. Creating a IWDViewContainerInfo from the IWDViewInfo of the "parent" view.

2. Creating a IWDViewContainerAssignmentInfo from the view usage of the "parent" view

3. Setting the created IWDViewContainerInfo as view container in the assignment.

4. Create the VCUI, set the view container name to the name of the created IWDViewContainerInfo and add the VCUI to an arbitrary container in the parent view.

But this doesn't work, i'm getting:

java.lang.NullPointerException

at com.sap.tc.webdynpro.clientimpl.html.uielib.standard.uradapter.ViewContainerUIElementAdapter.getContent(ViewContainerUIElementAdapter.java:98)

What is wrong? What am i missing?

Thanks in advance.

Stefan

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Sep 02, 2004 at 06:40 PM

    "I know this music" (c) 5th Element

    Hi Stefan,

    For part one -- yes, this problem is known for me. As a workaround, I create more complex window layout: I place some empty "Launcher" view with single link to actual view, modify content of actual view from Custom Controller and finally fire plug from "Launcher" wdDoInit.

    So far so good, but recently I found that it is possible to manipulate view content even from view's wdDoInit method. However, I do not have ViewContainerUIElement-s inside of view.

    For second part I have to contact one of our developers. More details tomorrow.

    VS

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Valery,

      this would be great, i'm banging my head at the wall for 2 days now (with some minor breaks of course;)

      I solved every problem i had so far but i'm not able to get this UI element to work when i want.

      BTW, i do not need any plugs (no workarounds) so far to display nearly any interface view in nearly any view area at any time by calling simple API methods (and without leaving the WD/IWD API). The only exception is VCUI. So maybe i can pay something back later.

      Regards

      Stefan

  • Posted on Nov 19, 2004 at 03:25 PM

    Hi,

    I had the same problem with

    "java.lang.NullPointerException at com.sap.tc.webdynpro.clientimpl.html.uielib.standard.uradapter.ViewContainerUIElementAdapter.getContent(ViewContainerUIElementAdapter.java:98)"

    when I included ViewUsages dynamically in an action handler (outside wdDoInit()).

    The code below fixed that problem.

    This code creates a new OutboundPlug for the embedding view with the embedded view as target and fires the plug.

    <i>// Create OutboundPlug

    IWDOutboundPlugInfo outboundPlug = embedderViewInfo.createOutboundPlug();

    //Create navigation link

    rootViewUsage.createNavigationTarget(outboundPlug.getName(), interfaceViewUsage, "Default");

    // fire navigation link

    wdThis.wdGetAPI().firePlug(outboundPlug, Collections.EMPTY_MAP);

    </i>

    I hope I could help you. Probably you don't need the information anymore, but perhaps anybody else has the same problem.

    Regards, Alex

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Alex,

      thanks for your help. I've forgotten to post the solution for this problem by myself, sorry.

      You're right, the only possibility to get this working seems to be telling the view manager about the change in view composition by firing a plug to the changed target. Since i wanted to implement a generic target container, i created a slightly more complex view composition with the target container and a dummy view, which serves as an echo view (outbound to echo -> inbound to changed target).

      Best regards

      Stefan

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.