Versions Compared

Key

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

...

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

Code Block
htmlhtml
titleChanging WindowState via HTML
html
    <portlet:actionURL windowState="maximized"/>
java
Code Block
java
titleChanging WindowState via Java
java
    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

java
Code Block
java
titleMinimized Handler Interceptor
java
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
xmlxml
titleWeb Flow Interceptor Configuration
xml
<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
xmlxml
titleAnnotation Based Controller Configuration
xml
<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>