[jboss-user] [JBoss Portal] - Different ViewId depending on WindowState?

ebephil do-not-reply at jboss.com
Thu Jan 24 10:25:30 EST 2008


Hi,

I was trying to display a different page in my portlet depending on the window state. If the window state is normal, I want to display view.xhtml, if the window state is maximized, I want to display maximized.xhtml.

I am using the JSR-301 PortletBridge with RF 3.1.3 on JBP 2.6.3. So I thought of a quick hack: I override GenericFacesPortlet's getDefaultViewId() method and, depending on the window state, return a different id:

	public String getDefaultViewId(PortletRequest request, PortletMode mode) {
  | 
  | 		if (request.getWindowState().equals(WindowState.MAXIMIZED)) {
  | 			return this.getPortletConfig().getInitParameter(
  | 					Bridge.DEFAULT_VIEWID + "." + mode.toString() + "."
  | 							+ request.getWindowState());
  | 		}
  | 
  | 		return this.getPortletConfig().getInitParameter(
  | 				Bridge.DEFAULT_VIEWID + "." + mode.toString());
  | 	}

It doesn't quite work, however.

If I maximize my portlet, the method is called twice. The first time, it returns my viewId as expected. The second time, however, it returns the normal viewId. So I end up with the default behavior, it just displays the defaultViewId.view instead of my defaultViewId.view.maximized.

That leads me to my final question: Why doesn't it work? :)

I understand that it is called twice because a change of the window state is only allowed in an actionRequest. But why doesn't the renderRequest know about the window state anymore?

Regards
Phil

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4123058#4123058

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4123058



More information about the jboss-user mailing list