Package com.composum.sling.cpnl
Class TagBase
- java.lang.Object
-
- javax.servlet.jsp.tagext.TagSupport
-
- javax.servlet.jsp.tagext.BodyTagSupport
-
- com.composum.sling.cpnl.CpnlBodyTagSupport
-
- com.composum.sling.cpnl.TagBase
-
- All Implemented Interfaces:
Serializable,javax.servlet.jsp.tagext.BodyTag,javax.servlet.jsp.tagext.DynamicAttributes,javax.servlet.jsp.tagext.IterationTag,javax.servlet.jsp.tagext.JspTag,javax.servlet.jsp.tagext.Tag
public abstract class TagBase extends CpnlBodyTagSupport implements javax.servlet.jsp.tagext.DynamicAttributes
an abstract base tag implementation to generate HTML tags with dynamic attributes and an optional condition- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected Stringclassesprotected Map<String,Object>dynamicAttributesstatic StringTAG_NONEprotected StringtagNameprotected Objecttest-
Fields inherited from class com.composum.sling.cpnl.CpnlBodyTagSupport
context, out, request, resource, resourceResolver
-
-
Constructor Summary
Constructors Constructor Description TagBase()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected booleanacceptDynamicAttribute(String key, Object value)extension hook to check and filter dynamic attributesprotected voidclear()Reset all member variables to the (default) start values.intdoEndTag()intdoStartTag()StringgetClasses()protected abstract StringgetDefaultTagName()protected StringgetTagName()protected booleangetTestResult()evaluates the test expression if present and returns the evaluation result; default: 'true'protected booleanrenderTag()if this returns 'false' nothing is rendered (extension hook; returns the test result)protected voidrenderTagEnd()protected voidrenderTagStart()voidsetClasses(String classes)voidsetDynamicAttribute(String namespace, String name, Object value)interface: DynamicAttributesvoidsetTagName(String tagName)voidsetTest(Object value)the 'test' expression for conditional tagsprotected voidwriteAttributes(javax.servlet.jsp.JspWriter writer)-
Methods inherited from class com.composum.sling.cpnl.CpnlBodyTagSupport
createContext, eval, getExpressionUtil, release, setPageContext
-
Methods inherited from class javax.servlet.jsp.tagext.BodyTagSupport
doAfterBody, doInitBody, getBodyContent, getPreviousOut, setBodyContent
-
Methods inherited from class javax.servlet.jsp.tagext.TagSupport
findAncestorWithClass, getId, getParent, getValue, getValues, removeValue, setId, setParent, setValue
-
-
-
-
Method Detail
-
clear
protected void clear()
Description copied from class:CpnlBodyTagSupportReset all member variables to the (default) start values. Called prior processing the tag and at release time.- Overrides:
clearin classCpnlBodyTagSupport
-
getDefaultTagName
protected abstract String getDefaultTagName()
-
setTagName
public void setTagName(String tagName)
- Parameters:
tagName- the tagName to set
-
getTagName
protected String getTagName()
-
getClasses
public String getClasses()
-
setClasses
public void setClasses(String classes)
-
setTest
public void setTest(Object value)
the 'test' expression for conditional tags
-
getTestResult
protected boolean getTestResult()
evaluates the test expression if present and returns the evaluation result; default: 'true'
-
acceptDynamicAttribute
protected boolean acceptDynamicAttribute(String key, Object value)
extension hook to check and filter dynamic attributes
-
setDynamicAttribute
public void setDynamicAttribute(String namespace, String name, Object value)
interface: DynamicAttributes- Specified by:
setDynamicAttributein interfacejavax.servlet.jsp.tagext.DynamicAttributes
-
writeAttributes
protected void writeAttributes(javax.servlet.jsp.JspWriter writer) throws IOException- Throws:
IOException
-
renderTag
protected boolean renderTag()
if this returns 'false' nothing is rendered (extension hook; returns the test result)
-
doStartTag
public int doStartTag() throws javax.servlet.jsp.JspException- Specified by:
doStartTagin interfacejavax.servlet.jsp.tagext.Tag- Overrides:
doStartTagin classCpnlBodyTagSupport- Throws:
javax.servlet.jsp.JspException
-
renderTagStart
protected void renderTagStart()
-
doEndTag
public int doEndTag() throws javax.servlet.jsp.JspException- Specified by:
doEndTagin interfacejavax.servlet.jsp.tagext.Tag- Overrides:
doEndTagin classjavax.servlet.jsp.tagext.BodyTagSupport- Throws:
javax.servlet.jsp.JspException
-
renderTagEnd
protected void renderTagEnd()
-
-