...
Developers may change the WindowState via either a link or via Java code.
Code Block |
---|
| html |
---|
| html |
---|
title | Changing WindowState via HTML | html |
---|
|
<portlet:actionURL windowState="maximized"/>
|
Code Block |
---|
| java |
---|
| java |
---|
title | Changing 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
Code Block |
---|
| java |
---|
| java |
---|
title | Minimized 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 |
---|
title | Web 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 |
---|
title | Annotation 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>
|