3 Replies Latest reply on Mar 13, 2009 10:59 AM by je.a.le

    Add portlet display name programatically.

      Jboss server 4.2.2.GA
      Jboss portal 2.7.0

      I have created some chart portlet programatically. but when I minimize the one chart portlet we could not find which portlet is minimized. so I want to add the display name programatically. do you have any idea regarding this please share with me.

        • 1. Re: Add portlet display name programatically.

          In some portlets, i use RenderResponse.setTitle("NAME") in doView and doEdit to personalize windows names.
          I think it's the code you need.

          • 2. Re: Add portlet display name programatically.

            Hi apemberton

            For example in portal.xml

            <display-name>My portlets</display-name>.

            If I minimize the above portlet it shows the name "My portlets".

            But in my dynamic creation portlet i cant set the display name programatically.(No portal.xml for this portlet everything is generated through coding). If I set displayname in dynamic portlet my problem is solved.

            • 3. Re: Add portlet display name programatically.
              je.a.le

              Override the getTitle method in the portlet code, and return your own portlet's title.
              Nota : getTitle is called first, and outside any "processAction/doView" operation, depending on how you get your data, you may have to do it twice.

              If the name only change only according to page node, you can used properties too.
              Here a sample code i used,

              public class xxxxPortlet extends JBossPortlet {
              // other relevant code here.....
              @Override
               protected String getTitle(RenderRequest request) {
               return (String) (((JBossRenderRequest) request).getPortalNode().getProperties().get("title"));
               }
              }