Package org.deltava.taglib.format
Class NumberFormatTag
java.lang.Object
javax.servlet.jsp.tagext.TagSupport
org.deltava.taglib.format.UserSettingsTag
org.deltava.taglib.format.NumberFormatTag
- All Implemented Interfaces:
Serializable
,IterationTag
,JspTag
,Tag
- Direct Known Subclasses:
DecimalFormatTag
,IntegerFormatTag
,LandingScoreFormatTag
A JSP tag to support the rendering of formatted numeric values.
- Since:
- 1.0
- Version:
- 11.0
- Author:
- Luke
-
Field Summary
Fields inherited from class org.deltava.taglib.format.UserSettingsTag
_user
Fields inherited from class javax.servlet.jsp.tagext.TagSupport
id, pageContext
Fields inherited from interface javax.servlet.jsp.tagext.IterationTag
EVAL_BODY_AGAIN
Fields inherited from interface javax.servlet.jsp.tagext.Tag
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
Closes an optional formatting SPAN element.int
doEndTag()
Formats the number and writes it to the JSP output writer.int
Checks that a non-null value has been provided.protected StringBuilder
Returns a StringBuilder with the class name to allow subclasses to modify the css classes for the SPAN element.protected void
openSpan()
Opens an optional formatting SPAN element.protected void
Prints the value, or the zero value if set and the value is zero.protected void
Releases the tag's state and resets the format pattern string.final void
setClassName
(String cName) Updates the CSS class for this formatted number.final void
Updates the date format pattern.void
setForceSign
(boolean forceSign) Sets whether to explicitly display a positive or negative sign before the number.void
setPageContext
(PageContext ctxt) Updates this tag's page context and loads the user object from the request.final void
Sets the value to format.final void
Updates the content used if the value is zero.Methods inherited from class javax.servlet.jsp.tagext.TagSupport
doAfterBody, findAncestorWithClass, getId, getParent, getValue, getValues, release, removeValue, setId, setParent, setValue
-
Field Details
-
_nF
-
_value
-
_zeroValue
-
-
Constructor Details
-
NumberFormatTag
Initializes the tag.- Parameters:
pattern
- the formatting pattern to use
-
-
Method Details
-
setClassName
Updates the CSS class for this formatted number. This will automatically enclose the output in a <SPAN> tag.- Parameters:
cName
- the class Name(s)
-
setFmt
Updates the date format pattern.- Parameters:
pattern
- the format pattern string- See Also:
-
setZero
Updates the content used if the value is zero.- Parameters:
v
- the value
-
setValue
Sets the value to format.- Parameters:
value
- the value to format
-
setForceSign
public void setForceSign(boolean forceSign) Sets whether to explicitly display a positive or negative sign before the number.- Parameters:
forceSign
- TRUE to always display the sign, otherwise FALSE
-
getClassNameBuilder
Returns a StringBuilder with the class name to allow subclasses to modify the css classes for the SPAN element.- Returns:
- a StringBuilder
-
release
Releases the tag's state and resets the format pattern string.- Parameters:
pattern
- the new format pattern
-
setPageContext
Updates this tag's page context and loads the user object from the request.- Specified by:
setPageContext
in interfaceTag
- Overrides:
setPageContext
in classUserSettingsTag
- Parameters:
ctxt
- the new JSP page context
-
doStartTag
Checks that a non-null value has been provided.- Specified by:
doStartTag
in interfaceTag
- Overrides:
doStartTag
in classTagSupport
- Returns:
- SKIP_BODY always
- Throws:
JspException
- never
-
openSpan
-
closeSpan
-
printValue
-
doEndTag
Formats the number and writes it to the JSP output writer.- Specified by:
doEndTag
in interfaceTag
- Overrides:
doEndTag
in classTagSupport
- Returns:
- TagSupport.EVAL_PAGE
- Throws:
JspException
- if an error occurs
-