cancel
Showing results for 
Search instead for 
Did you mean: 

Opening Component1 View from Component2 View

Former Member
0 Kudos

Hello All,

In my scenario i have a project with 2 components (<b>Component1</b> & <b>Component2</b>) a component interface <b>CompABInterface</b> and a single application <b>ApplMain</b> to launch the application.

<b>Component1</b> has <b>StartView</b> & <b>Component2</b> has <b>ResultView</b>.

<b>Q1.</b> I need to navigate from <b>StartView (Main window)</b> to <b>ResultView (Popup)</b>. The StartView should not close when ResultView is opened. What steps should be followed to achieve this ?

<b>Q2.</b> Also i want to provide a Close button to close the Popup (ResultView).

I tried to go through various threads for solution to this problem but m confused :-(.

Regards,

Aayush

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi All,

Aayush is working on a version which is not yet released to customers !!!

In normal case we use eventing to close the popup window which is little differet in the new version.This doesn't make any sense to discuss here.

I have provided the solution .

Regards, Anilkumar

Former Member
0 Kudos

Hello Anilkumar,

Thanks a lot.

Hello All - By creating an attribute of type IWDWindow in the context and using that attribute for storing/retrieving current window instance the problem was solved.

Regards,

Aayush

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Aayush

1. Create a button in StartView

2. Create a action and associate it to the button in the start view

3. Create a context attribute (winInstance) of type "com.sap.tc.webdynpro.services.session.api.IWDWindow" (Create this in the component interface compABInterface). Add this interface controller to both the views (start and result view)

4. Embed the result view in a separate window.

5. Write a code in the action created to open a window.

IWDWindowInfo winInfo = wdComponentAPI.getComponentInfo().findInWindows(<window name>);

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

wdContext.wdGetCompABInterfaceController().setWinInstance(window);

window.open();

6. Have a close button in the result view. In the action of close button get the instance of the window from the context as follows

IWDWindow window = wdContext.wdGetCompABInterfaceController().getWinInstance();

window.close();

Note :- If you want to pass values from start view to result view then you can create context attributes in theinterface controller and set it in the start view and access the same in the result view.

Regards

NagaKishore V

aayush_dubey3
Explorer
0 Kudos

Hello Nagakishore,

The method

wdGetCompABInterfaceController()

is not available in the close button action.

Regards,

Aayush

Former Member
0 Kudos

Hi,

Go to view's properties .. there add the controller s you need !

Former Member
0 Kudos

hello Aayush,

1. first for a popup u need u creat a new window(PopupWindow) in Component1. add the Component2 interface in "used webdynpro components".

2. embed the ResultView in this new window and select the last option while embeding the view. u communicate with the second component through component interface, (hope u know how to do that).

3. in the second component interface create a node and set its "isInput" true. inside this node u can create attributes like window etc that could be mapped accross the controllers, interfaces and views, also these attributes are used to pass values from one component to another.

4. create a button in StartView (Popup) and write the code to open a popup window (hope u know that).

5. create a close window button in ResultView and write the code to close.

note: first u should know how to open and close a popup window that are in the same component.

regards,

Piyush.

former_member182372
Active Contributor
0 Kudos

Hello,

> 4. create a button in StartView (Popup) and write the

> code to open a popup window (hope u know that).

> 5. create a close window button in ResultView and

> write the code to close.

Some doubts about this approach. How can you close window without having reference to IWDWindow? And if you open window from StartView you will have reference in StartView but not in ResultView. You can pass reference through context or you can use events.

Another approach - create methods "open" and "close" in InterfaceController of Component2, which you can easly access from StartView.

1) Declare

  //@@begin others
  private WebDynproWindow wnd;
  //@@end

2)

  public void open( )
  {
    //@@begin open()

	if ( null == wnd || wnd.isDestroyed() )
	{
		IWDComponent     component     = wdThis.wdGetAPI().getComponent();
		IWDComponentInfo componentInfo = component.getComponentInfo();
	
		_windowInfo        = componentInfo.findInWindows("ComponentWindow");

		wnd = (WebDynproWindow)wdComponentAPI.getWindowManager().createWindow(_windowInfo, true);
	}
	
	wnd.open();    
    //@@end
  }

3)

  public void close( )
  {
    //@@begin close()
	if ( wnd.isOpen() ) 
	{
		wnd.close();
		wnd.destroy();
		wnd = null;
	}
    //@@end
  }

From ResultView`s action handler (for Close button) you can call close method. You also can store wnd variable in context (which is good practice).

best regards, Maksim R.

Former Member
0 Kudos

hi

1) make a button in the start view and write an action to open a pop up window.

2)add the interface view of result view to the pop up window in the start view.

3) to close the pop up use : window.destroy();

regards

vln