Adding the list to a Pod

Now that the list is populated we insert it into the body of our Pod.

The addContent(...) method provides the mechanism for adding our Pod content. The method accepts as it's first parameter either a org.w3c.Node or a WidgetDocumentBuilder object (which internally is converted to a Node using the getWidgetRootNode operator of the WidgetDocumentBuilder object).

The second parameter is a configuration for a Renderer that will create the HTML for our Pod content. The RendererConfig object specifies the type of configuration (Style or Domain) and name of a renderer configuration entry. Configuring renderers is covered in detail in the Curam Widget Development Guide.

Table 1. PodBuilder.addContent(...) parameters
param type descrption
content Node | WidgetDocumentBuilder The Node object is appended to the instance of org.w3c.Document that was passed to the constructor of the PodBuilder.
rendererConfig RendererConfig

The RendererConfig object nominates the Renderer that will process the content parameter.

Figure 1. Adding the list to the Pod
026      RendererConfig contentRenderer = new RendererConfig(
027          RendererConfigType.STYLE, "single-list");
028      moviesPod.addContent(myFavouriteMovies, contentRenderer);

The movies Pod uses the ListBodyRenderer which is invoked using a Style configuration called "single-list". On line 28 we add the list widget with the renderer configuration for a list to the body of the Pod.

The Pod is now complete. The content of our movies list is defined in the ListBuilder object which is added to our Pod. The ListBodyRenderer will generate the HTML table which will be appended to out Pod body.