//If portlet is rendering as root, change mode to maximized, otherwise minimized
WindowState newWindowState = cd.getNewWindowState();
if (!psm.isAction() && rd.isRenderingAsRoot()) {
if (WindowState.MINIMIZED.equals(newWindowState)) {
pap.changePortletWindowState(WindowState.MINIMIZED);
}
else {
pap.changePortletWindowState(WindowState.MAXIMIZED);
}
} else if (newWindowState != null) {