cancel
Showing results for 
Search instead for 
Did you mean: 

Open a view in a seperate Window by clicking on LinkToAction

Former Member
0 Kudos

Hi@all,

I want to click on a LinkToAction or a LinkToURL or something else, and open a new small view in a seperate Window. How should I do this.

Best regards

Marcus

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

- Create a window "PopupWindow" in the Web Dynpro Explorer and embed the view to display in the popup.

- Create a context attribute "popup" in the component controller to store the window reference.

In the view controller that opens the window:

- add a context attribute by mapping to component controller attribute "popup"

- add an action "OpenPopup" and in the action handler, write


void onActionOpenPopup(...)
{
  IWDWindow popup = wdContext.currentContextElement().getPopup();
  if (popup == null)
  {
    IWDWindowInfo windowInfo = wdComponentAPI.getComponentInfo().findInWindows("PopupWindow");
    popup = wdComponentAPI.getWindowManager().createModalWindow(windowInfo);
    wdContext.currentContextElement().setPopup(popup);
  }
  popup.show();
}

In the controller of the view inside the popup window,

- add context attribute "popup" by mapping to component controller attribute

- add an action "ClosePopup" with action handler

- add a button or link to close the popup using action "ClosePopup"


void onClosePopup(...)
{
  wdContext.currentContextElement().getPopup().hide();
}

Armin

Former Member
0 Kudos

Hello Armin,

thanks for your Reply.

There are following problems in the code:

public void onActionShowContacts(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
  {
    //@@begin onActionShowContacts(ServerEvent)
    IWDWindow *popup* = wdContext.currentContextElement().getPopup();
    if (popup == null)
    {
    	IWDWindowInfo windowInfo = wdComponentAPI.getComponentInfo().findInWindows("BaseActHomeStationContactWnd");
    	popup = wdComponentAPI.getWindowManager().createModalWindow(windowInfo);
    	wdContext.currentContextElement().*setPopup(popup)*;
    }
    popup.show();

In this code there are this problems:

Type mismatch: cannot convert from boolean to IWDWindow

(I also try it with string, what is my fault??)

The method setPopup(boolean) in the type IPrivatBaseActHomeStationBottomView.IContextElement is not is not applicable for the arguments (IWDWindow).

(I think this belongs to the first mistake)

&

for this code:

public void onActionCloseContact(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
  {
    //@@begin onActionCloseContact(ServerEvent)
    wdContext.currentContextElement().getPopup().hide();
    }

mistake: Cannot invoke hide() on the primitive type boolean

I thank you for Reply.

Best regards

Marcus

former_member201361
Active Contributor
0 Kudos

hi,

Hope u have created a new Window and have enbeded the view which u want to display in the new Window .

In the View (First view , from where u are going to call the New Window ) u have to create a context attribute with type as com.sap.tc.webdynpro.services.session.api.IWDWindow

here the Attribute is WindowInstance.

in the on action method of the link to action give the following code

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

IWDWindow window = wdComponentAPI.getWindowManager().createModalWindow(windowInfo);

//Assignning the window handle to a context variable for later use

wdContext.currentContextElement().setWindowInstance(window);

window.show();

}

thanks and regards,

Fistae

Former Member
0 Kudos

Hi,

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

Type mismatch: cannot convert from boolean to IWDWindow

It should be of type IWDWindow instead of boolean.

This will resolve all errors

Regards

Ayyapparaj

Former Member
0 Kudos

Where did I say the attribute "popup" should be a boolean? I said "to store the window reference" which of course means it should have type IWDWindow.

Armin

Former Member
0 Kudos

Great,

thank you very much Armin.

I solve the problem.

regards

Marcus

Former Member
0 Kudos

Only one more question.

I will show the new window in the center.

I try it with this code in the implementation of the view, which will open the new window:

popup.setWindowPosition(WDWindowPos.CENTER);

It don't works.

Best regards

Marcus

former_member201361
Active Contributor
0 Kudos

hi,

first create a new Window and embed the view which u want to display in the new window and finally use the Window Manager

Here u have to create a context attribute with type as com.sap.tc.webdynpro.services.session.api.IWDWindow

here the Attribute is WindowInstance.

in the on action method of the link to action give the following code

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

IWDWindow window = wdComponentAPI.getWindowManager().createModalWindow(windowInfo);

//Assignning the window handle to a context variable for later use

wdContext.currentContextElement().setWindowInstance(window);

window.show();

}

thanks and regards

Fistae

former_member201361
Active Contributor
0 Kudos

hi,

first create a new Window and embed the view which u want to display in the new window and finally use the Window Manager

in the on action method of the link to action give the following code

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