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 String
classes
protected Map<String,Object>
dynamicAttributes
static String
TAG_NONE
protected String
tagName
protected Object
test
-
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 boolean
acceptDynamicAttribute(String key, Object value)
extension hook to check and filter dynamic attributesprotected void
clear()
Reset all member variables to the (default) start values.int
doEndTag()
int
doStartTag()
String
getClasses()
protected abstract String
getDefaultTagName()
protected String
getTagName()
protected boolean
getTestResult()
evaluates the test expression if present and returns the evaluation result; default: 'true'protected boolean
renderTag()
if this returns 'false' nothing is rendered (extension hook; returns the test result)protected void
renderTagEnd()
protected void
renderTagStart()
void
setClasses(String classes)
void
setDynamicAttribute(String namespace, String name, Object value)
interface: DynamicAttributesvoid
setTagName(String tagName)
void
setTest(Object value)
the 'test' expression for conditional tagsprotected void
writeAttributes(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:CpnlBodyTagSupport
Reset all member variables to the (default) start values. Called prior processing the tag and at release time.- Overrides:
clear
in 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:
setDynamicAttribute
in 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:
doStartTag
in interfacejavax.servlet.jsp.tagext.Tag
- Overrides:
doStartTag
in classCpnlBodyTagSupport
- Throws:
javax.servlet.jsp.JspException
-
renderTagStart
protected void renderTagStart()
-
doEndTag
public int doEndTag() throws javax.servlet.jsp.JspException
- Specified by:
doEndTag
in interfacejavax.servlet.jsp.tagext.Tag
- Overrides:
doEndTag
in classjavax.servlet.jsp.tagext.BodyTagSupport
- Throws:
javax.servlet.jsp.JspException
-
renderTagEnd
protected void renderTagEnd()
-
-