0 Replies Latest reply on Jan 24, 2008 10:25 AM by Phil Eberle

    Different ViewId depending on WindowState?

    Phil Eberle Newbie


      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?