Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
William Gosse
How do I get the current title of a portlet
March 24, 2011 9:35 AM
Answer

William Gosse

Rank: Regular Member

Posts: 249

Join Date: July 4, 2010

Recent Posts

I'm trying to get the current title of a portlet that may have been changed by an admin when its deployed.
David H Nebinger
RE: How do I get the current title of a portlet
March 24, 2011 9:43 AM
Answer

David H Nebinger

Community Moderator

Rank: Liferay Legend

Posts: 11046

Join Date: September 1, 2006

Recent Posts

Bill Gosse:
I'm trying to get the current title of a portlet that may have been changed by an admin when its deployed.


It's worse than that; as a logged in user you will typically have permissions to change the portlet title on the fly...

If you could get the title, what would you use it for anyway?
William Gosse
RE: How do I get the current title of a portlet
March 24, 2011 9:51 AM
Answer

William Gosse

Rank: Regular Member

Posts: 249

Join Date: July 4, 2010

Recent Posts

On our system only admins can change the title.

I'm using Icefaces so I want to get the title in my managed bean and use it to drive some of the output in my faceletts, such as making part of the title for a popup form.
SZ khan
RE: How do I get the current title of a portlet
March 24, 2011 10:21 AM
Answer

SZ khan

Rank: Regular Member

Posts: 148

Join Date: October 31, 2009

Recent Posts

Check out this
http://www.liferay.com/community/forums/-/message_boards/message/6407628
William Gosse
RE: How do I get the current title of a portlet
March 24, 2011 10:48 AM
Answer

William Gosse

Rank: Regular Member

Posts: 249

Join Date: July 4, 2010

Recent Posts

Thanks that got me in the ball park. Here's what I final came up with:

ThemeDisplay themeDisplay = PortletUtils.getThemeDisplay();
PortletPreferences portletSetup = themeDisplay.getPortletDisplay().getPortletSetup();
String languageId = LocaleUtil.toLanguageId(themeDisplay.getLocale());
String title = themeDisplay.getPortletDisplay().getTitle();
title = portletSetup.getValue("portlet-setup-title-" + languageId, title);


PortletPreferences is actually a javax.portlet.PortletPreferences.
Hitoshi Ozawa
RE: How do I get the current title of a portlet
April 2, 2011 4:39 AM
Answer

Hitoshi Ozawa

Rank: Liferay Legend

Posts: 7949

Join Date: March 23, 2010

Recent Posts

I thought it was standard to use javax.portlet.title to set the portlet title based on Language_xx.properties for each portlet.
William Gosse
RE: How do I get the current title of a portlet
April 22, 2011 2:33 PM
Answer

William Gosse

Rank: Regular Member

Posts: 249

Join Date: July 4, 2010

Recent Posts

I'm not setting it I'm getting it. I wanted to get it dynamically when ever the admin changed the portlet title while the portal was running. I can then use the use that title to set some other stuff in the portlet.

Specifically this was used for a generic contact us portlet that could be dropped on any page. If the admin changes the portlet title in the title bar, something that can be done on the fly in Liferay, I can then use that title to change a button label and a popup dialog title. I also used it in the subject of an email that get sent from the portlet. This allows the email to traced to the particular instance of the portlet that sent it.
Hitoshi Ozawa
RE: How do I get the current title of a portlet
April 22, 2011 3:26 PM
Answer

Hitoshi Ozawa

Rank: Liferay Legend

Posts: 7949

Join Date: March 23, 2010

Recent Posts

So the question of is more of detecting title name change name of a portlet in Liferay container rather than getting the name of the title?
Jelmer Kuperus
RE: How do I get the current title of a portlet
April 22, 2011 11:56 PM
Answer

Jelmer Kuperus

Rank: Liferay Legend

Posts: 1192

Join Date: March 10, 2010

Recent Posts

Perhaps this post is useful to you

http://www.liferay.com/community/forums/-/message_boards/message/6407628