cancel
Showing results for 
Search instead for 
Did you mean: 

How to open a single WD Component in a popup window?

bernd_speckmann
Contributor
0 Kudos

Hi,

I want to open a WD component in a popup window but don't know how. I have searched this forum without a result.

The following situation:

DC1 (main DC) with a button to open the popup

DC2 (popup DC)

How can I open DC2 in a popup window without destroying DC1 in a way like

if (!DC1.hasActiveComponent()) {
mainR_Usage.createComponent("my.comp.DC2","my.comp/comp~DC2~wd");
}

...

and of course how can I destroy the DC2-popup from DC1?

The general problem is not to open a popup window inside DC1. The problem is to open DC2 as a popup!

Thanks ahead

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Bernd,

You can try this:

1.Create a context attribute of the type IWDWindow in your view/Component Controller of DC2, say 'PopupWindow'

2.Create a method in your DC2, say

openPopup()

{

IWDWindowInfo winInfo = (IWDWindowInfo)wdComponentAPI.getComponentInfo().findInWindows("DC2Window");

IWDWindow popup= (IWDWindow)wdComponentAPI.getWindowManager().createModalWindow(winInfo);

wdContext.currentPopupElement().setPopupAttribute(popup);

popup.setTitle("Hello, this is DC2");

popup.setWindowSize(600,500);

popup.setWindowPosition(100,100);

popup.show();

+// Save WindowIsnstance in Context

wdContext.currentContextElement().setPopUpWindow(window);+

}

3.Expose this method in your Interface controller so that it is available to be called by DC1

4.in your DC1 you can call this method

if((!DC1.hasActiveComponent())

{

wdThis.wdGetDC2ComponentUsage().createComponent();

wdThis.wdGetDC2Interface().openPopup();

}

5.This should open the popup window from DC2.

6. You can have a close button or any other event on the view contained in this window itself. On click of this button you can retrive the window instance stored in the context and destroy it.

e.g we have an action assigned to a Close button. this will be in the view from the window you are trying to open as a popup.

onActionCloseWindow()

{

IWDWindow window = wdContext.currentContextElement().getPopUpWindow();

window.destroyInstance();

}

this should close yourr popup window.

Regards,

Ajay

Edited by: Ajay Patil on Jul 6, 2010 10:27 PM

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Bernd Speckmann ,

You can get the url of the deployed webdynpro application using this.

WDURLGenerator.getApplicationURL(deployableObjectPart, urlParameters);

For futher explanations for generating url you can refer this blog.

/people/vishwas.madhuvarshi3/blog/2008/09/05/inter-application-navigation-across-dcsprojects-in-web-dynpro-java

Use this url while opening the popup window.

Revert back in case of problems.

Best Wishes

Idhaya R

bernd_speckmann
Contributor
0 Kudos

Thanks for your answer.

From DC1 I want to open a popup this way:


IWDWindowInfo winInfo = (IWDWindowInfo)wdComponentAPI.getComponentInfo().findInWindows("DC2Window");	  
	  IWDWindow popup= (IWDWindow)wdComponentAPI.getWindowManager().createModalWindow(winInfo);	  
	  wdContext.currentPopupElement().setPopupAttribute(popup);	  
	  popup.setTitle("Hello, this is DC2");
	  popup.setWindowSize(600,500);
	  popup.setWindowPosition(100,100);
	  popup.show(); 

The Problem is how to get the WindowInfo of DC2 to create my popup...

Any further help would be appreciated...

Bernd