Entering content frame

Procedure documentation Managing the ExcelLinkPopup Window Locate the document in its SAP Library structure

This graphic is explained in the accompanying text

Our ExcelExportComp service component also displays a popup window for opening the cached Excel Web resource with a LinkToURL UI element. In NetWeaver ’04, opening and closing popups is based on the following pattern:

...

       1.      The component controller can store a popup window instance in a private member variable of the type IWDWindow.

       2.      The popup window is programmatically created using the IWDWindowManager API and opened using the IWDWindow API within the component controller code.

       3.      The popup window is destroyed within an action event handler of a related view controller.

       4.      To close the popup window within the view controller, the public method closeExcelLinkPopup() exposed by the component controller is called.

       5.      Within the component controller method closeExcelLinkPopup(), the popup window instance is destroyed using the IWDWindow API.

Opening the ExcelLinkPopup Window

The component controller stores a popup window instance in its private member variable excelLinkWindow of the type com.sap.tc.webdynpro.services.session.api.IWDWindow. It is created within the private method openExcelLinkPopup().

 

Component Controller ExcelExportComp.java in Component ExcelComp

//@@begin others

/**

 * Opens new popup window. The popup contains a link to the newly generated,

 * cached Excel file. 

 */

private void openExcelLinkPopup() {

  excelLinkWindow =

      wdComponentAPI.getWindowManager().createModalWindow(

        wdComponentAPI.getComponentInfo().findInWindows("ExcelLinkPopup"));

    excelLinkWindow.setWindowPosition(WDWindowPos.CENTER);

    excelLinkWindow.open();

}

// private member variable for storing instance of opened popup window.  

private IWDWindow excelLinkWindow;

 

//@@end

Closing the ExcelLinkPopup Window

The ExcelLinkPopup window is destroyed within the public component controller method closeExcelLinkPopup().

Component Controller ExcelExportComp.java in Component ExcelComp

//@@begin javadoc:closeExcelLinkPopup()

/**

 * Destroys popup window. To be called in an action event handler of a view

 * controller related to the opened popup window. View controller must have

 * a controller usage declared for invoking this public method of the public

 * component controller API. 

 */

//@@end

public void closeExcelLinkPopup( )

{

  //@@begin closeExcelLinkPopup()

  if (excelLinkWindow != null) {

    excelLinkWindow.destroy();

    excelLinkWindow = null;

  }

  //@@end

}

 

After declaring a usage relation to the component controller within the DisplayExcelView view controller, we can call  the public method closeExcelLinkPopup(). This is done within the event handler for the Close action, which is triggered when pressing the Close button in the DisplayExcelView view layout.

 

View Controller DisplayExcelView.java in Component ExcelComp

//@@begin javadoc:onActionClose(ServerEvent)

/** Declared validating event handler. */

//@@end

public void onActionClose(

  com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )

{

  //@@begin onActionClose(ServerEvent)

  wdThis.wdGetExcelExportCompController().closeExcelLinkPopup();

  //@@end

}

Next Step …

Implementing the Public Service Method exportToExcel2003()

 

Leaving content frame