Switching between Portlet modes

Switching between Portlet modes

Question:

Can anybody point out how to convert between portlet modes, for example, clicking help logo and then back to view mode.

Answer:
With whatever link you want to change modes, you need a PortletURL. Simply create the URL normally (PortletURL myPortletURL = response.createRenderURL()), then call the method: myPortletURL.setPortletMode(PortletMode.EDIT) for edit mode, or use VIEW for view mode and HELP for help mode... If you're extending the GenericPortlet, you then just have to implement doView(), doHelp(), and doEdit() each method will get called accordingly. You can also set your window states if you want to by calling myPortletURL.setWindowState(WindowState.MAXIMIZED) etc...

With thanks to Keith Zantow of VT for answering this question on the uPortal list.