<%	
	import javax.portlet.WindowState;

	def rcontext = _ctx.getRequestContext();

	WindowState windowState = uicomponent.getCurrentWindowState();
	String portletId = uicomponent.getId();

  String hiddenClass = "";
  if(portletContent == null || org.apache.commons.lang3.StringUtils.isBlank(portletContent.toString())) {
    hiddenClass = "class=\"hidden\"";
  }

	if (windowState != WindowState.MINIMIZED) {
		String windowWidth = uicomponent.getWidth();
		String windowHeight = uicomponent.getHeight();

		String cssStyle = "";
		if ((windowHeight != null || windowWidth != null) && !rcontext.isMaximizePortlet()) {
  		if (windowWidth != null) {
  			cssStyle += "width: "+ windowWidth +";";
  		}
  		if (windowHeight != null) {
  			cssStyle += "height: "+ windowHeight +";";
  		}
  		cssStyle = " style=\"" + cssStyle + "\"";
    }
    String cssClass = uicomponent.getCssClass() == null ? "" : " " + uicomponent.getCssClass();
 %>
  	<div id="$portletId" $hiddenClass>
  		<div class="PORTLET-FRAGMENT$cssClass" $cssStyle>
  			<% println portletContent; %>
  		</div>
  	</div>	
<% } %>
