AquaLogic .NET Portlet Toolkit WSRP Development Guide

     Previous Next  Open TOC in new window   View as PDF - New Window  Get Adobe Reader - New Window
Content starts here

Implementing WSRP Portlet Window States Using the .NET Portlet Toolkit

To access or update window state for a WSRP portlet, use the PortletInfo.WindowState property in the .NET Portlet API.

Window state defines how much markup a portlet should generate. There are 4 “standard” window states defined in the WSRP 1.0 specification:
  • wsrp:normal
  • wsrp:minimized
  • wsrp:maximized
  • wsrp:solo
In WLP and ALI, these window states are implemented by changing the screen real estate provided to the portlet. All WSRP-compliant portlets must support the wsrp:normal window state. To support additional window states, configure the portlet as described below. Producers can also support “custom” window states, defined as a URI.

Two steps are required to implement multiple window states in a portlet:

  1. Configure the supported window states in the wsrp-producer.xml file.

    The supported window states for each portlet are specified in the wsrp-producer.xml configuration file as children of the <supports> element as shown in the example below. For a custom window state, the description may either be included in-line in the <supports> element or as part of a top-level <custom-window-state> definition.

    If the <supports> element contains multiple mime-type elements, the window state support applies to each of the mime-types included. To specify different window states on a per mime-type basis, add multiple <supports> elements to the portlet definition, each with a different mime-type. If the same mime-type is listed more than once, an exception is thrown.
    Note: If the <window-state> element is omitted, the portlet is assumed to support all standard WSRP window states. If wsrp:* is specified, it implies all of the standard wsrp: values. Support for “wsrp:normal” is always assumed, even if it is not explicitly indicated.
    						<description lang="en">shows just the header for the portlet</window-state>
    		<description lang="en">shows just the header for the portlet</description>
  2. Implement the window state in the portlet code.

    A portlet can access the window state via the PortletInfo.WindowState property during any portlet request, but may only change the current window state during a performBlockingInteraction (typically, an ASP.NET form postback). The new window state is returned in the response to the WSRP Consumer. If the WSRP Consumer does not understand the window state returned by a portlet, it can ignore it. If the WSRP Consumer requests a window state that the portlet does not understand, the WSRP Producer will map to wsrp:normal.

    protected void returnButton_Click(object sender, EventArgs e)
    	//set the window state back to wsrp:view
    	WSRPPortletContext.Current.Portlet.WindowState = "wsrp:view";
    protected void Page_PreRender(object sender, EventArgs e)
    	PortletInfo portlet = WSRPPortletContext.Current.Portlet;
    		if (portlet.WindowState == "wsrp:maximize" || portlet.WindowState == "wsrp:solo")
    			maximizeButton.Visible = false;
    			returnButton.Visible = true;
    		else if (portlet.WindowState == "wsrp:view")
    			maximizeButton.Visible = true;
    			returnButton.Visible = false;

  Back to Top      Previous Next