7 Replies Latest reply on Mar 27, 2006 2:30 PM by cpage cpage

    get portlet information from portletrenderer ?

    cpage cpage Novice

      hi,

      i've made my own renderset, based on the Divrenderer (window, portlet, decoration, region)

      i want to get some information from the render method about the portlets.

      i have a portletcontext, a windowresult and a rendercontext but i don't find information about portlets.

      i have their regions, their instances, their windows but nothing about the portlets themselves.


      thank you for help !

      regards,
      lionel

      btw, i work with JBP 2.2.0

        • 1. Re: get portlet information from portletrenderer ?
          cpage cpage Novice

          hi

          here is my class :

          public class CpagePortletRenderer implements PortletRenderer {
          
           /**
           * @see PortletRenderer#render
           */
           public void render(RenderContext renderContext, PortletContext state, WindowResult result)
           throws RenderException
           {
          
           renderStart(renderContext);
           renderContext.getMarkupFragment().append("\n<!-- début contenu de la portlet -->" );
           renderContext.getMarkupFragment().append(result.getContent());
           renderContext.getMarkupFragment().append("\n<!-- Fin contenu de la portlet -->\r\t\t\t\t" );
           renderEnd(renderContext);
          
           }



          I want to have the name of the portlet which is in the window container.
          i think it's something like ::

          myInstance.getComponentRef() ....


          how can i have the myInstance object, from the instanceID ?

          thanks !

          i take a look at the management portlet but i'm not good with jsf technology.

          regards
          Lionel


          • 2. Re: get portlet information from portletrenderer ?
            cpage cpage Novice

            up :p

            in the portletcontext, i have information about, the instance, the window, the region but nothing about the portlet itself.

            i want to read some of init-param, put in the portlet-xml for the portlet i'am rendering.
            for example: what icone is set to this portlet ?

            thanks for help !

            • 3. Re: get portlet information from portletrenderer ?
              cpage cpage Novice

              ok, i can have the icon of the portlet if i had a property "icon" to the portletwindow in the -portal.xml

              it's a little bitt dirty :p

              • 4. Re: get portlet information from portletrenderer ?
                cpage cpage Novice

                hi,

                accessing window properties when portlet is rendering work, but i have to stop my server if i change the properties.


                am i the only one who wants to access portlet properties in the renderer when the portal and the portlets are rendering ?

                ty


                • 5. Re: get portlet information from portletrenderer ?
                  Woodler Expert

                  I'm not sure what exactly you want here. Is it the data from the portlet.xml ?
                  The WindowResult class should give you all the portlet info you need. The RenderContext and WindowContext allow you to get to the layout/theme specific information.

                  If all of that doesn't suffice, you can always set a response property in the portlet's doView method, and pick it up in your renderer.

                  • 6. Re: get portlet information from portletrenderer ?
                    Woodler Expert

                    would read-only access to the portlet preferences solve the issue for you ?

                    • 7. Re: get portlet information from portletrenderer ?
                      cpage cpage Novice

                      ty mholzner for your response :p

                      what i want to do :
                      each portlet in my portal must have their own icon in the left side of their header.
                      so, in my renderset, i have to render the right icon for the right portlet.

                      to know which icon is set for a portlet, my first idea was to set an init-param for each portlet in the portlet.xml and to read the init-param "icon" in the renderset for each portlet i'am rendering

                      the problem :
                      i have no information about the portlet in windowresult, rendercontext or portletcontext except the generate content fragment of the portlet.


                      first solution :
                      set a property "icon" for each window in -object.xml
                      i can access to the properties so i can render the right icon for the right window and so for the right portlet.

                      the problem of that method (except it's not a clean solution:p) is that i can't change the icon dynamically for my portlet, i have to restart the server if i make a change.

                      for the moment, this solution is acceptable for me but in the near future, i think it will raise some problems.

                      thank you in advance

                      best regards
                      lionel