cancel
Showing results for 
Search instead for 
Did you mean: 

dialog, + problem in storing window instance in context

Former Member
0 Kudos

Hello Friends,

I am trying to implement a dialog as defiend in PDF doc ( Dialog Boxes in Web Dynpro Applications ) http://209.85.129.104/search?q=cache:fA--oXHmRTEJ:https://www.sdn.sap.com/irj/servlet/prt/portal/prt...dialogsboxeinwebdynproapplications&hl=en&ct=clnk&cd=1

In this document, he mentioned how to store the instance of the dialog window in context in order to destroy later on:

wdContext.currentPopupElement().setWindowInstance(window);

( I have also created the value node popup and its value attribue WindowInstance of type IWDWindow , but when I use this line of code, i.e wdContext.currentPopupElement().setWindowInstance(window);, I got null pointer exception,

if I comment this line, I can open the window dialog, ( which atleast make me confirm that my window obj is not null ) dont know why I am getting this exception ...

Any idea....

Regards,

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Thanks sumit for your clarification and Armin for your resonse ...

Regards,

Former Member
0 Kudos

Now instead of this:

wdContext.currentPopupElement().setWindowInstance(window);

I used this.

wdContext.createPopupElement().setWindowInstance(window);

I did not get the null pointer exception on this line, however when i try to retrieve the instance like this:

IWDWindow window = wdContext.currentPopupElement().getWindowInstance();

Got null pointer exception ?

any idea why I am getting null pointer exception ?

Regards,

Former Member
0 Kudos

Just add a context attribute "popupWindow" at the context root node and use

IWDWindow popup = ...; // create popup window
wdContext.currentContextElement().setPopupWindow(popup);

and

IWDWindow popup = wdContext.currentContextElement().getPopupWindow();

Armin

Former Member
0 Kudos

I tried this what you mentioned , but did not worked ....

I have now set the cardinality from 0...n to 1..1, and it works,,,,, dont know the reason...

Do u know why it works out while changing the cardinality...

Regards,

Former Member
0 Kudos

No, you didn't try what I mentioned. You used a separate node that contains this attribute and obviously did not set its cardinalities to 1:1 such that

- there was no element inside that node

- no element was selected

which explains the NPE.

Armin

Former Member
0 Kudos

ofcourse I tried already what you mentiond !!!!!

what is NPE stands for ?

SHAH H

Former Member
0 Kudos

NPE = NullPointerException.

Please read my previous post again carefully.

Armin

Former Member
0 Kudos

Hi Shah,

NPE stands for NullPointerException. Apart from that there r 2 ways to do the thing , u were trying.

1. U create windowInstance attribute in root context directly, in that case u don't have to set the cardinality explicitly, what armin mentioned.

2. U can create a node & inside that u can create ur windowInstance attribute, in that case u have to set the cardinality 1:1 , bcos when u access current<node>Element, it has to be initialized. what u have done.

regards

Sumit

Former Member
0 Kudos

Correct, and

3. As the popup is closed from an action handler of another view (e.g a view inside the popup containing a "Close" button), the context attribute must be created in a common controller (component or custom controller) and mapped from the view that openes the popup and from the view that contains the close-action.

Armin