8 Replies Latest reply on Aug 12, 2010 4:38 PM by antoine_h

    dynamic Portlet titles using RenderResponse.setTitle()

    j.harm

      Hi,

       

      I tried to set the portlet title dynamically using RenderResponse.setTitle(String). GateIn does not show the title in the portlet window bar. GenericPortlet calls the method RenderResponse.setTitle(String) with the result of the method GenericPortlet.getTitle(RenderRequest). Thus, overriding the method getTitle(RenderRequest) does not work either.

       

      Kind regards,

      Joerg

        • 1. Re: dynamic Portlet titles using RenderResponse.setTitle()
          trong.tran

          Yes, it does not work because GateIn does not use the preferred title set by the portlet for showing in the window bar.

           

          the Portlet Specification says "It is up to the portal/portlet-container to use the preferred title set by the portlet". so it has been chosen for GateIn

          • 2. Re: dynamic Portlet titles using RenderResponse.setTitle()
            hoang_to

            You could examine the UIPortlet.gtmpl  and the class UIPortlet for more detail on how portlet title is retrieved/used

            • 3. Re: dynamic Portlet titles using RenderResponse.setTitle()
              antoine_h

              From JBoss Portal : this could be done by changing the renderer of the window that show the portlet.

               

              I have not look closely how the rendering of the portlet/window is done with GateIn. So I don't know if you can make it this way with GateIn, with your custom renderer that would use the proper title.

              but this is the way it would be best to do it : minimal change, for your customization.

               

              Antoine
              JBoss Portal and GateIn (JSR-286), JSF, Richfaces, J2EE, Drools, BRMS.
              http://www.sysemo.com/Sysemo-expertise-portails-jboss-portal.php

               

              Message was edited by: Antoine Herzog Anwered the same time as Minh Hoang TO. The UIPortlet.gtmpl is doing the job. (and no more "renderer mechanism" that was in JBoss Portal).

              • 4. Re: dynamic Portlet titles using RenderResponse.setTitle()
                j.harm

                Hi,

                 

                thanks for the helpful answers! Here is the way the title set at RenderResponse takes his way through GateIn:

                • org.gatein.pc.portlet.impl.jsr168.api.RenderResponseImpl.createMarkupResponse(...) creates an instance of org.gatein.pc.api.invocation.response.FragmentResponse passing the title to it
                • org.exoplatform.portal.webui.application.UIPortletLifecycle takes the title from the FragmentResponse in its method processRender(...) binding it to the key "portletTitle" in the org.exoplatform.webui.core.lifecycle.WebuiBindingContext before rendering the template of the org.exoplatform.portal.webui.application.UIPortlet
                • the template UIPortlet.gtmpl does not use the portletTitle

                I changed the template (see attachment) to use the portletTitle if it is set. Not sure if it works in any circumstance at least in my tests it worked. UIPortletLifecycle takes "Portlet" as portletTitle if no title is set at the FragmentResponse. Thus, the template better should test for this value instead of null. On the other hand, I think UIPortletLifecycle should better not bind any value at all to "portletTitle" in the WebuiBindingContext.

                 

                UIPortletLifecycle does not call Portlet.render(RenderRequest,RenderResponse) if the window state is "minimized". The Portlet Spec says "When a portlet is in MINIMIZED window state, the portlet should only render minimal output or no output at all". Even minimal output is output and should not be ignored by the Portal. I did not find a hint in the Portlet Spec that a Portal implementation is allowed to omit the call to the render method in window state "minimized". Therefore, I consider this as a bug.

                 

                Kind regards,

                Joerg

                 

                Message was edited by: Joerg Harm, added feature request https://jira.jboss.org/browse/GTNPORTAL-1382 and bug https://jira.jboss.org/browse/GTNPORTAL-1383 to JIRA

                • 5. Re: dynamic Portlet titles using RenderResponse.setTitle()
                  trong.tran

                  Hi Joerg,

                  I changed the template (see attachment) to use the portletTitle if it is  set. Not sure if it works in any circumstance at least in my tests it  worked. UIPortletLifecycle takes "Portlet" as portletTitle if no title  is set at the FragmentResponse. Thus, the template better should test  for this value instead of null. On the other hand, I think  UIPortletLifecycle should better not bind any value at all to  "portletTitle" in the WebuiBindingContext.

                  I totally agree with you, so i think you could create a JIRA for this

                  UIPortletLifecycle does not call  Portlet.render(RenderRequest,RenderResponse) if the window state is  "minimized". The Portlet Spec says "When a portlet is in MINIMIZED  window state, the portlet should only render minimal output or no output  at all". Even minimal output is output and should not be ignored by the  Portal. I did not find a hint in the Portlet Spec that a Portal  implementation is allowed to omit the call to the render method in  window state "minimized". Therefore, I consider this as a bug.

                   

                  Not calling the render method in the MINIMIZED state makes sense to me BUT I can see two sessions in Portlet Spec to prove that it would be a bug indeed :

                   

                  If the window state of the portlet (see PLT.9 Window States Chapter) is MINIMIZED, the
                  render method of the GenericPortlet does not invoke any of the portlet mode
                  rendering methods

                   

                  and


                  A window state is an indicator of the amount of portal page space that will be assigned to
                  the content generated by a portlet via the render method. When invoking a portlet, the
                  portlet-container provides the current window state to the portlet. The portlet may use the
                  window state to decide how much information it should render.

                   

                  So you could create a JIRA issue for this too

                   

                  Many thanks for great investigation, Joerg

                  • 6. Re: dynamic Portlet titles using RenderResponse.setTitle()
                    trong.tran

                    FYI, two JIRA issues are created for these by Joerg :

                     

                    https://jira.jboss.org/browse/GTNPORTAL-1382

                     

                    and

                     

                    https://jira.jboss.org/browse/GTNPORTAL-1383

                    • 7. Re: dynamic Portlet titles using RenderResponse.setTitle()
                      hoang_to

                       

                      UIPortletLifecycle does not call Portlet.render(RenderRequest,RenderResponse) if the window state is "minimized". The Portlet Spec says "When a portlet is in MINIMIZED window state, the portlet should only render minimal output or no output at all". Even minimal output is output and should not be ignored by the Portal. I did not find a hint in the Portlet Spec that a Portal implementation is allowed to omit the call to the render method in window state "minimized". Therefore, I consider this as a bug.


                       

                      Additional argument to consider this as a bug.

                       

                      The section PLT 5.4. Request Handling in JSR 286 mentioned that

                       

                      Normally, a client request triggered by an action URL translates into one action request,
                      zero or more event requests and many render requests, one per portlet in the portal page.

                       

                      The sequential diagram in the page 43 depicts this statement. As turning window state to MINIMIZED requires an action request to the portlet, there should be render invocation.

                      • 8. Re: dynamic Portlet titles using RenderResponse.setTitle()
                        antoine_h

                        Other practical argument to consider this as a good thing :

                        I have encountered a few times some usecase that requiere that in the MINIMIZED mode, the porlet shows some indication such as "Click on the button XXX to open this window", for the users.

                        This is a request for portal dedicated to a general public of user, that may not be familiar to portlets behaviors.

                         

                        Another usecase is : in the MINIMIZED mode, the portlet should show a very small sumery of the content of the portlet in NORMAL mode.

                        this is very usefull for portal that provided operationnal informations, such as supervision information of a system, etc...

                        the user can see at a glance that something is happening, and then open the window.

                        This should be done with a custom mode, such as "MINIMAL_INFO", but it is less work to use the yet provided MINIMIZED mode.

                         

                        Thanks for the Jira and updates of the portal.


                        Antoine
                        JBoss Portal and GateIn (JSR-286), JSF, Richfaces, J2EE, Drools, BRMS.
                        http://www.sysemo.com/Sysemo-expertise-portails-jboss-portal.php