Package com.composum.sling.cpnl
Class TextTag
- java.lang.Object
-
- javax.servlet.jsp.tagext.TagSupport
-
- javax.servlet.jsp.tagext.BodyTagSupport
-
- com.composum.sling.cpnl.CpnlBodyTagSupport
-
- com.composum.sling.cpnl.TagBase
-
- com.composum.sling.cpnl.TextTag
-
- 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 class TextTag extends TagBase
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
TextTag.EscapeFunction
static class
TextTag.Type
-
Field Summary
Fields Modifier and Type Field Description static Map<TextTag.Type,TextTag.EscapeFunction>
ESCAPE_FUNCTION_MAP
protected TextTag.Type
type
-
Fields inherited from class com.composum.sling.cpnl.TagBase
classes, dynamicAttributes, TAG_NONE, tagName, test
-
Fields inherited from class com.composum.sling.cpnl.CpnlBodyTagSupport
context, out, request, resource, resourceResolver
-
-
Constructor Summary
Constructors Constructor Description TextTag()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
clear()
Reset all member variables to the (default) start values.int
doAfterBody()
int
doStartTag()
protected Object
escape(Object value)
the extension hook for the various types of encoding; must work with Object values to ensure that non String values can be used as isprotected String
getDefaultTagName()
Format
getFormatter(Object value)
Locale
getLocale()
protected void
renderTagEnd()
is rendering the text and a tag around if 'tagName' is set or CSS classes are specifiedprotected void
renderTagStart()
void
setEscape(boolean escape)
void
setFormat(String format)
void
setI18n(boolean i18n)
void
setLocale(Locale locale)
void
setProperty(String propertyName)
void
setTagClass(String tagClass)
void
setType(String type)
void
setValue(Object value)
static String
toString(Object value)
-
Methods inherited from class com.composum.sling.cpnl.TagBase
acceptDynamicAttribute, doEndTag, getClasses, getTagName, getTestResult, renderTag, setClasses, setDynamicAttribute, setTagName, setTest, writeAttributes
-
Methods inherited from class com.composum.sling.cpnl.CpnlBodyTagSupport
createContext, eval, getExpressionUtil, release, setPageContext
-
Methods inherited from class javax.servlet.jsp.tagext.BodyTagSupport
doInitBody, getBodyContent, getPreviousOut, setBodyContent
-
Methods inherited from class javax.servlet.jsp.tagext.TagSupport
findAncestorWithClass, getId, getParent, getValue, getValues, removeValue, setId, setParent, setValue
-
-
-
-
Field Detail
-
ESCAPE_FUNCTION_MAP
public static final Map<TextTag.Type,TextTag.EscapeFunction> ESCAPE_FUNCTION_MAP
-
type
protected TextTag.Type type
-
-
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.
-
getDefaultTagName
protected String getDefaultTagName()
- Specified by:
getDefaultTagName
in classTagBase
-
doStartTag
public int doStartTag() throws javax.servlet.jsp.JspException
- Specified by:
doStartTag
in interfacejavax.servlet.jsp.tagext.Tag
- Overrides:
doStartTag
in classTagBase
- Throws:
javax.servlet.jsp.JspException
-
doAfterBody
public int doAfterBody()
- Specified by:
doAfterBody
in interfacejavax.servlet.jsp.tagext.IterationTag
- Overrides:
doAfterBody
in classjavax.servlet.jsp.tagext.BodyTagSupport
-
renderTagStart
protected void renderTagStart()
- Overrides:
renderTagStart
in classTagBase
-
renderTagEnd
protected void renderTagEnd()
is rendering the text and a tag around if 'tagName' is set or CSS classes are specified- Overrides:
renderTagEnd
in classTagBase
-
escape
protected Object escape(Object value)
the extension hook for the various types of encoding; must work with Object values to ensure that non String values can be used as is- Parameters:
value
- the value (String) to encode- Returns:
- the encoded String or an appropriate Object
-
setType
public void setType(String type)
- Parameters:
type
- the type of the value and the escape strategy key
-
setValue
public void setValue(Object value)
- Parameters:
value
- the value to set
-
setProperty
public void setProperty(String propertyName)
- Parameters:
propertyName
- the propertyName to set
-
setEscape
public void setEscape(boolean escape)
- Parameters:
escape
- flag for escaping the text (default: 'true')
-
setI18n
public void setI18n(boolean i18n)
- Parameters:
i18n
- flag for translating the text (default: 'false')
-
setFormat
public void setFormat(String format)
- Parameters:
format
- the fmt to set
-
setLocale
public void setLocale(Locale locale)
-
getLocale
public Locale getLocale()
-
setTagClass
public void setTagClass(String tagClass)
- Parameters:
tagClass
- the tagClass to set
-
-