Minimize portlet

Hello:

There is a way to change a portlet configuration in a way so that when a user logs the porlet appears minimized (the same way as if the user clicks the “-” (minus) button in the portlet bar ?)

Thanks
Edgardo

Hi
as far as I know, window state cannot be configured. To minimize a portlet you have the following options:

  • set a parameter in the url that points to that portlet (this can be done, for example, setting a property in a Portlet URL control that links to the portlet you want to open)
  • via the portlet API
javax.portlet.ActionResponse actionResponse = (javax.portlet.ActionResponse)getFacesContext().getExternalContext().getResponse();
actionResponse.setWindowState(WindowState.MINIMIZED);

Hope this helps,
Javier

Thanks Javier:

The solution based on the Control worked (I had to add some code to avoid minimizing the porlet after the 1st time).

Nevertheless, I couldn’t find how to invoke the java portlet code you provided as an alternative. Could you explain where to insert the code (in which bean and in which method ?). I tried using the beforeRestoreView, afterRestoreView, etc and couldn’ make it work.

Thanks in advance.
Edgardo

hi
sorry, I forgot that this can only be applied during an action request. And this eliminates the initialize method.

best regards
Javier