cancel
Showing results for 
Search instead for 
Did you mean: 

How to create pop up window ?

Former Member
0 Kudos

Hi,

May I know how to create a pop up window in java webdynpro once click on the button ?

Thank you very much.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Create a new window and embed the popup view

create a windows instance

to start the popup:

IWDWindowInfo windowInfo = wdComponentAPI.getComponentInfo().findInWindows("PopUP");

IWDWindow window = wdComponentAPI.getWindowManager().createWindow(windowInfo, true);

window.setWindowPosition(300, 150);

window.open();

wdContext.currentExternalWindowElement().setWindowInstance(window);

to close the popup

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

window.destroy();

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi Eric,

For achiving popup window in web dynpro you have to use IWDConfirmationDialog API's.

You have to use following code inside your button Action method :

-


<b>IWDControllerInfo controllerInfo = wdControllerAPI.getViewInfo().getViewController();

String dialogText = "Some text whatever you want to display on popup";

IWDConfirmationDialog dialog = wdComponentAPI.getWindowManager().createConfirmationWindow( dialogText, controllerInfo.findInEventHandlers("AcceptYES"),"Yes");

dialog.addChoice( controllerInfo.findInEventHandlers("AcceptNO"), " No ");

dialog.open();</b>

-


On the above code I have used Event Handler for 'Yes' and 'No' button which will appear in popup window. That Event handler will invoke regarding the clicking on 'Yes' or 'No'. You can create eventhandler with the help of Method tab of your view. So that it will generate associated method in the implementation tab, there u can write your business logic.

************hope this will help you******************

thanks & regard,

Pankaj

arun_srinivasan
Contributor
0 Kudos

Hi

For Popup

1) Create a value attribute of type com.sap.tc.webdynpro.services.session.api.IWDWindow in the main window.

2) Create a value attribute of the same type above in the popup view.

3) Do a context mapping for the attributes.

4) Type the code given below in the event handler from where you want the window to popup.

Code for opening a popup

IWDWindowInfo wininfo = wdComponentAPI.getComponentInfo() .findInWindows(<Popup window name>);

IWDWindow win = wdComponentAPI.getWindowManager().createWindow(wininfo,true);

win.open();

wdContext.currentContextElement().set<value attribute name>(win);

Code for destroying the popup

Type the code given below in the event handler in the popup window from where you want to close the window.

IWDWindow win = wdContext.currentContextElement().get<value attribute name>;

win.destroy();

For opening a external url

IWDWindow window = wdComponentAPI.getWindowManager().createExternalWindow(

"http://www.google.com","value",false);

window.open();

In NW 2004s open method is deprecated for this you use show instead of open

Refer this thread for this

Hope this helps,

Regards,

Arun

former_member186016
Active Contributor
0 Kudos
Former Member
0 Kudos

chk it