1 16 package com.blandware.atleap.webapp.taglib.core.grid; 17 18 import com.blandware.atleap.webapp.taglib.core.grid.util.Grid; 19 20 import javax.servlet.jsp.JspException ; 21 import javax.servlet.jsp.JspTagException ; 22 import javax.servlet.jsp.PageContext ; 23 import javax.servlet.jsp.tagext.JspFragment ; 24 import javax.servlet.jsp.tagext.SimpleTagSupport ; 25 import java.io.IOException ; 26 27 44 public class FilterEnabledTag extends SimpleTagSupport { 45 46 52 public void doTag() throws JspException , IOException { 53 54 PageContext pageContext = (PageContext ) getJspContext(); 55 56 58 BaseFilterTag parentFilterTag = (BaseFilterTag) findAncestorWithClass(this, BaseFilterTag.class); 59 if ( parentFilterTag == null ) { 60 JspTagException e = new JspTagException ("Parent tag is invalid! This tag is only valid when nested within 'filter' tag"); 61 throw e; 62 } 63 64 66 String fieldName = parentFilterTag.getFieldName(); 67 68 GridTag parentGridTag = (GridTag) findAncestorWithClass(this, GridTag.class); 69 Grid grid = parentGridTag.getGrid(); 70 71 if ( grid.isFilterEnabled(fieldName) ) { 72 JspFragment body = getJspBody(); 73 if ( body != null ) { 74 body.invoke(null); 75 } 76 } 77 } 78 79 } 80 | Popular Tags |