4 Replies Latest reply on Apr 26, 2006 2:37 PM by cpage cpage

    MyFaces portlet and windowstate ?

    cpage cpage Novice

      hello,

      I'm developping MyFaces Portlets.

      but i have some problems with the windowstate of my jsf pages.

      in the navigation rules, we can set which pages to render from what outcome, but it is not possible to parameter their windowstate.

      I have made a ViewSelector to set a maximized view page when i put the maximize button.

      but for all other pages, i don't know how to achieve it.


      my first idea is a naming rule:
      all pages which have to be render in windowstate maximize, i call them myPage_WSMAX.

      and in process action method, i set the windowstate to maximized if i find a page named xxx_WSMAX.

      it's very dirty i know, but for the moment i haven't found anything else !!

      thanks for help !!

      lionel



        • 1. Re: MyFaces portlet and windowstate ?
          Steve Moyer Newbie

          I'm also just starting with JSF based portlets but can say that I'm not having this problem. The Portal takes care of rendering everything with the correct WindowState before your Portlet is actually called. If you click the "maximize" control, the Portal rerenders the page with the appropriate layout and passes control into your render methods to create the content of the window.

          You should only need to grab the WindowState during the JSF processing if you're rendering different output depending on the space allocated to the window. You can do this within your JSF file with the following snippet (which only shows the current WindowState ... insert your own logic to decide how to use it):

          <%@ taglib uri="http://java.sun.com/portlet" prefix="p"%>
          <p:defineObjects/>
          <%=renderResponse.getWindowState()%>
          


          The taglib and defineObjects lines must both occur before you try to access any of the Portlet's objects. If you're trying to programatically change WindowState, I believe that you'll need to complete that code in the Portlet class (before any rendering starts).

          Am I misunderstanding your problem?

          • 2. Re: MyFaces portlet and windowstate ?
            cpage cpage Novice

            it is not really my problem :p

            because i don't want to change the content of the page depending on the windowstate but i want to change the entire page.

            if portlet is in state normal: i render page1.jsp
            if portlet is in state maximized: i render page2.jsp
            (=> i realised this with a DefaultViewSelector)

            then, i can have a commandbutton on my page "page1.jsp".
            if i click on it, i have to go to the page "page3.jsp" (navigation rules) and this page have to render in state maximized.

            the only way to change the windowstate is in the Actionresponse (actionresponse.setWindowState(...))

            but i don't think it is the good way to do this.

            • 3. Re: MyFaces portlet and windowstate ?
              Roy Russo Master

              So subclass the MyFaceGenericPortlet, and add this logic to your new render method.

              • 4. Re: MyFaces portlet and windowstate ?
                cpage cpage Novice

                 

                "roy.russo@jboss.com" wrote:
                So subclass the MyFaceGenericPortlet, and add this logic to your new render method.


                yes, this is what i have done.

                i override the render method and also, the processaction method, to access the actionresponse.setWindowState.

                i get the name of the view_ID (the name of my jsf page) and with my naming rule I set the windowstate.


                i just looking for other way to realise that, properly ! :D

                thanks ;)