Show TOC Start of Content Area

Procedure documentation Creating a Web Dynpro Page Layout  Locate the document in its SAP Library structure

To create a Web Dynpro page layout, create a Web Dynpro project with a component that defines the following:

      Implemented Interfaces: IPageLayout, which is defined in pb_api.

      Views: A single view defines the elements on the page, including the location of each layout container. A layout container is an area in the layout that can contain one or more iViews, and each container is indicated by a ViewContainerUIElementelement.

      Used Components: For each layout container, a component usage of type ILayoutContainer, which is defined in pb_api.

      Windows: A window that contains the view.

The following shows the Web Dynpro Explorer for a Web Dynpro project (wdlayout) that defines a page layout (Tab):

This graphic is explained in the accompanying text

In addition, the following are also defined in the component interface controller:

      Context: LayoutData context attribute, which contains information about the page.

      Public Methods: setContainer() method, which is called whenever the Page Builder needs to render one of the containers. You must implement this method.

Prerequisites

      You have permission to the pb_api development component and the EP-WDC software component.

Procedure

...

       1.      Create a Web Dynpro development component.

       2.      Set a dependency to the pb_api development component (located in the EP-WDC software component).

       3.      Create a new component.

A view, window and interface view are automatically created. Delete the interface view.

       4.      Implement the IPageLayout component interface definition as follows:

                            a.      Right-click Implemented Interfaces and select Add.

The Implement Component Interfaces window is displayed.

This graphic is explained in the accompanying text

                            b.      Click Add, select the IPageLayout interface, and click OK.

IPageLayout is now displayed as an implemented interface. The component interface view of IPageLayout is displayed, as well as the window implementing it (which is the window that was automatically created for the component).

This graphic is explained in the accompanying text

                            c.      Click Finish.

The Implementation Results window is displayed, which shows all the windows, interface views, methods and other objects that will be added to the project as a result of implementing IPageLayout.

When you expand the object tree, the following is displayed:

This graphic is explained in the accompanying text

                            d.      Click OK.

       5.      Modify the component’s view to create the desired layout by doing the following:

       Add a ViewContainerUIElementelement for each container that you want to create in the layout.

       Include other elements that you want displayed on pages with this layout.

       6.      Add ILayoutContainercomponent usages, as follows:

                            a.      Right-click Used Components and select Add Used Component. The New Web Dynpro Component Usage dialog is displayed.

                            b.      In the Name textbox, enter a name for the used component.

                            c.      Next to the Used Web Dynpro Component textbox, click Browse and select ILayoutContainer.

                            d.      Click Finish.

Add a component usage for each ViewContainerUIElement element that you added to the view.

       7.      For each component usage added in the previous step, declare its component interface controller as a required controller in the component controller, as follows:

                            a.      In the Required Controllers section of the Properties tab of the component controller, click Add.

                            b.      Select the component interface controller of the component usages, and then click OK. The component usage is also selected.

This graphic is explained in the accompanying text

       8.      Open the component’s window. In each ViewContainerUIElement element in the view, do the following:

                            a.      Right-click and select Embed view.

                            b.      Select Embed Interface View of a Component Interface and click Next.

                            c.      Select LayoutContainerInterfaceView from the ILayoutContainer component that you created for the current ViewContainerUIElementcontrol (in the previous step).

                            d.      Click Finish.

       9.      Implement the setContainer() method in the component controller. This method is called each time the Page Builder needs to render a container in the layout.

The following is the method signature:

public void setContainer(
    java.lang.String
containerClassName,
    java.lang.String
containerDeployObject,
  
 java.lang.String containerId,
  
 com.sap.portal.pb.data.IPBContainerData ContainerData )

The following describes the parameters passed into the setContainer() method:

Parameter

Description

containerClassName

The name of the class that implements ILayoutContainer for rendering the iViews in a container.

containerDeployObject

The name of the development component that contains the ILayoutContainer class.

containerId

The ID of the ViewContainerUIElement control (layout container) to be rendered.

ContainerData

Information about the page, such as the iViews to be rendered.

The following is a typical implementation:

// Check which container is being rendered

if(containerId.equals("ViewContainerUIElement")) {

  

    // Create the iView renderer for this container.

    wdThis.wdGetMyCol1ComponentUsage()
        .createComponent(containerClassName
, containerDeployObject);

    

    // Get access to the used component methods

    IExternalILayoutContainer container  = wdThis.wdGetMyCol1Interface();

 

    // Render iViews in the container.

    container.renderIviews(containerId , ContainerData);

}

// Repeat the process for each container

else if(containerId.equals("ViewContainerUIElement2")) {

    wdThis.wdGetMyCol2ComponentUsage()
        .createComponent(containerClassName
, containerDeployObject);

    IExternalILayoutContainer container  = wdThis.wdGetMyCol2Interface();

    container.renderIviews(containerId , ContainerData);

}

return;

The container ID (containerID) is the ID of the ViewContainerUIElement element.

The method wdGetMyCol1ComponentUsage() returns the ILayoutContainer used component called MyCol1.

The method wdGetMyCol2ComponentUsage() returns the ILayoutContainer used component called MyCol2.

   10.      Create an archive from the development component and deploy it.

Result

The new layout (full component name, including package name) is listed under the development component in the Web Dynpro Application Repository in the portal.

 

 

 

End of Content Area