Web Dynpro – Pop up a new window
In some case, we need to pop up a new window to show some more data. Here, I will introduce how to pop up a new window using web dynpro Java.
Step 1. Create a new window in your WD component.
Step 2. Embeded a view or viewset in the widow.
Step 3. Create a new value node and value attribute.
This value node is used to store the reference to the window instance. The value attribute should be the type of ‘com.sap.tc.webdynpro.services.session.api.IWDWindow‘.
Step 4. Add code to pop up a new window in an action.
Add below code to your action to show your pop up window.
//show the pop up window IWDWindowInfo windowInfo = wdComponentAPI.getComponentInfo().findInWindows("Download"); IWDWindow myWindow = wdComponentAPI.getWindowManager().createModalWindow(windowInfo); wdContext.currentPopUpElement().setDownLoadWindow(myWindow); myWindow.setWindowSize(300 , 80); myWindow.setWindowPosition(WDWindowPos.CENTER); myWindow.show();
In the pop up window, there is a close button to close current pop up window. You should add below code to the close action.
wdContext.nodePopUp().currentPopUpElement().getDownLoadWindow().destroyInstance();
Now everything is ready. You can use the pop up screen in your own web dynpro applicaiton. Enjoy it:-)
thanks, centering the window was quite simple after reading your post ^_^