Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

Developers may change the WindowState via either a link or via Java code.

Code Block
html
html
titleChanging WindowState via HTMLhtml
    <portlet:actionURL windowState="maximized"/>
Code Block
java
java
titleChanging WindowState via Javajava
    actionResponse.setWindowState(WindowState.MAXIMIZED);

...

Spring Web-Flow and the Annotation Driven controllers do not have any special handling for the MINIMIZED WindowState. This means the default behavior is the portlets render normally whenever they are minimized. To address this a HandlerInterceptor to skip rendering when minimized. The handler interceptor to accomplish this is listed below along with the Spring Bean's configuration snippets for both WebFlow and Annotation Based Controllers

Code Block
java
java
titleMinimized Handler Interceptorjava
package org.jasig.portlet.web;

import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
import javax.portlet.WindowState;

import org.springframework.web.portlet.handler.HandlerInterceptorAdapter;

public class MinimizedStateHandlerInterceptor extends HandlerInterceptorAdapter {

    @Override
    public boolean preHandleRender(RenderRequest request, RenderResponse response, Object handler) throws Exception {
        if (WindowState.MINIMIZED.equals(request.getWindowState())) {
            return false;
        }
        
        return true;
    }
}
Code Block
xml
xml
titleWeb Flow Interceptor Configurationxml
<bean id="portletModeHandlerMapping" class="org.springframework.web.portlet.handler.PortletModeHandlerMapping">
    <property name="interceptors"><bean class="org.jasig.portlet.web.MinimizedStateHandlerInterceptor"/></property>
    <property name="portletModeMap">
        <map>
            <entry key="view">
                <bean class="org.jasig.portal.portlets.flow.ParamaterizableFlowHandler">
                    <property name="flowId" value="my-application-flow" />
                </bean>
            </entry>
        </map>
    </property>
</bean>
Code Block
xml
xml
titleAnnotation Based Controller Configurationxml
<context:annotation-config/>
<context:component-scan base-package="org.jasig.portlet.web"/>

<bean class="org.springframework.web.portlet.mvc.annotation.DefaultAnnotationHandlerMapping">
    <property name="interceptors"><bean class="org.jasig.portlet.web.MinimizedStateHandlerInterceptor"/></property>
</bean>