cancel
Showing results for 
Search instead for 
Did you mean: 

changing window title based on the application

Former Member
0 Kudos

Hi Experts,

I have One window with two applications.

I want to change browser title ( window title ) based on the application from which,it is called.

I wrote the below code in the Init method of comp Controller.

String appName=wdComponentAPI.getApplication().getName();

* String windowTitle="";*

* //Set window title based on the application from which it is called...*

* if(appName.equalsIgnoreCase("ContractorEndDate")){*

* windowTitle="Contractor end date";*

* }else*

* { windowTitle="Deactivate contractor";*

* }*

* IWDWindowInfo wininfo = wdComponentAPI.getComponentInfo().findInWindows("VcTempEndDate");*

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

* ((Window) window).setTitle(windowTitle);*

But Its throughing me the error.

How can I achieve this...

Regards,

Naresh

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Naresh,

try this code in your component Controller


  public void CallWIndow( java.lang.String name )
  {
    //@@begin CallWIndow()
    IWDWindowInfo info = wdComponentAPI.getComponentInfo().findInWindows( "Win_pop");
    IWDWindow window = wdComponentAPI.getWindowManager().createModalWindow( info);
    window.setWindowPosition( WDWindowPos.CENTER);
    window.setWindowSize( 400, 250);
    wdContext.currentContextElement().setWindowTitle( window);
    window.setTitle( name);
    window.show();
    //@@end
  }

set a context element of type String and that would be passed as argument to this function from different contexts and there will be corresponding entries and mapping would be made in those contexts. You can pass the argument according to the URL that you specified.

Regards

Vinod V

Former Member
0 Kudos

Hi,

Why dont you specify the title in the window properties and create seperate windows for your application?

Regards

Ayyapparaj

Former Member
0 Kudos

If every thing is what is the need of creating another window.

For Just to change the title based on the application.

I have done in the same way as you suggested. Its working fine, but Is there any other way to do it.

Regards,

Naresh

Former Member
0 Kudos

Hi,

Problem what i feel here is you cant bind an attribute to the window title property. Thats the reason why i suggested that.

Regards

Ayyapparaj

BeGanz
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hallo,

in NetWeaver CE 7.1 the Web Dynpro Java Runtime API provides a method to set the window title programmatically at runtime:

In the (root component's) window controller implementing the interface view your Web Dynpro appliation points to implement the following code line in the wdDoInit() hook method:

wdControllerAPI.getUI().setTitle("My dynamic window title");

Regards, Bertram

Former Member
0 Kudos

Hi Bertram,

Which SP of CE contains this method?

Regards

Ayyapparaj

BeGanz
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hallo Ayyapparaj,

when wdControllerAPI.getUI() is called within the root-component's window controller (implementing the interface view of your Web Dynpro application) you operate on the application window instance. When you call getUI() in a window controller of an embedded component (implmenting the component interface view) you get back null. When you call this method in a root window controller of a popup window you can dynamically set the popup window title.

This API is first available in NW CE 7.1 (I do not know the exact first Service Pack Stack).

Regards, Bertram