cancel
Showing results for 
Search instead for 
Did you mean: 

How to pass title to window at run time in Java WebDynpro

Former Member
0 Kudos

How to pass title of window at run time, while opening the window on click of button in WebDynpro java?

I want to pass Context Attribute to it.

Accepted Solutions (1)

Accepted Solutions (1)

former_member191044
Active Contributor
0 Kudos

Hi Suchita,

this is quite simple if you know what to do:

1. Link your component controller with your main window

2. Use this line:

wdThis.wdGetTestCompWindowController().wdGetAPI().getUI().setTitle("TitleYouWant");

In my case the window is named "TestComp". Just replace that with your window name.

Regards Tobias.

Former Member
0 Kudos

Hi Tobias,

This will set the title for the current Window.

But my case is from my main window on click of a button a pop up window opens and i want to pass context attribute as title to that window.

public void onActionOpenABCWindow(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent  wdEvent)

{

wdThis.wdGetComponentController().openWindow("ABC");

}

From here i want to set the title to the pop up window.

Regards,

Suchita

Former Member
0 Kudos

Dear Suchita,

You can use  IWDWindowViewElement API to set the title.

// bind the context attributes “title” to window property title

attrInfo = wdContext.getContext().getRootNodeInfo().getAttribute("title");

window.bindTitle(attrInfo);

http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/a04870c5-749b-2b10-06ba-d25515ef3...

Thanks & Regards,

Patralekha

former_member191044
Active Contributor
0 Kudos

Ok then try this,

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

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

window.setTitle("YourWindowName")

window.show();

So you can safe the IWDWindow window in a context attribute and just set the title before you show your window again.

Former Member
0 Kudos

Hi Tobias,

That was Perfect piece of code for my scenario.Thanks a lot.

Regards,

Suchita

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Suchita,

use this .

  window.setTitle("pass the dynmaic attribute value here");

Regards,

Anil