1 16 package com.blandware.atleap.webapp.taglib.core.grid; 17 18 import org.apache.commons.logging.Log; 19 import org.apache.commons.logging.LogFactory; 20 21 import javax.servlet.jsp.JspException ; 22 import javax.servlet.jsp.JspTagException ; 23 import javax.servlet.jsp.PageContext ; 24 import javax.servlet.jsp.tagext.JspFragment ; 25 import javax.servlet.jsp.tagext.SimpleTagSupport ; 26 import java.io.IOException ; 27 28 39 public class NoRowsTag extends SimpleTagSupport { 40 41 protected transient final Log log = LogFactory.getLog(NoRowsTag.class); 42 43 49 public void doTag() throws JspException , IOException { 50 51 PageContext pageContext = (PageContext ) getJspContext(); 52 53 GridTag parentGridTag = (GridTag) findAncestorWithClass(this, GridTag.class); 54 if ( parentGridTag == null ) { 55 JspTagException e = new JspTagException ("Parent tag is invalid! This tag is only valid when nested within 'grid' tag"); 56 throw e; 57 } 58 59 if ( parentGridTag.getGrid().getTotal().intValue() == 0 ) { 60 JspFragment body = getJspBody(); 61 if ( body != null ) { 62 body.invoke(null); 63 } 64 } 65 } 66 } 67 | Popular Tags |