org.deltava.taglib.format
Class NumberFormatTag

java.lang.Object
  extended by javax.servlet.jsp.tagext.TagSupport
      extended by org.deltava.taglib.format.NumberFormatTag
All Implemented Interfaces:
Serializable, IterationTag, JspTag, Tag
Direct Known Subclasses:
DecimalFormatTag, IntegerFormatTag

public abstract class NumberFormatTag
extends TagSupport

A JSP tag to support the rendering of formatted numeric values.

Since:
1.0
Version:
2.4
Author:
Luke
See Also:
Serialized Form

Field Summary
protected  String _className
           
protected  DecimalFormat _nF
           
protected  Number _value
           
 
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
NumberFormatTag()
          Initializes the tag.
 
Method Summary
 int doEndTag()
          Formats the number and writes it to the JSP output writer.
 int doStartTag()
          Checks that a non-null value has been provided.
protected  void release(String pattern)
          Releases the tag's state and resets the format pattern string.
 void setClassName(String cName)
          Updates the CSS class for this formatted number.
 void setFmt(String pattern)
          Updates the date format pattern.
 void setPageContext(PageContext ctxt)
          Updates this tag's page context and loads the user object from the request.
 void setValue(Number value)
          Sets the value to format.
 
Methods inherited from class javax.servlet.jsp.tagext.TagSupport
doAfterBody, findAncestorWithClass, getId, getParent, getValue, getValues, release, removeValue, setId, setParent, setValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_nF

protected DecimalFormat _nF

_value

protected Number _value

_className

protected String _className
Constructor Detail

NumberFormatTag

public NumberFormatTag()
Initializes the tag.

Method Detail

setClassName

public final void setClassName(String cName)
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

public final void setFmt(String pattern)
Updates the date format pattern.

Parameters:
pattern - the format pattern string
See Also:
DecimalFormat.applyPattern(String)

setValue

public final void setValue(Number value)
Sets the value to format.

Parameters:
value - the value to format

release

protected void release(String pattern)
Releases the tag's state and resets the format pattern string.

Parameters:
pattern - the new format pattern

setPageContext

public void setPageContext(PageContext ctxt)
Updates this tag's page context and loads the user object from the request.

Specified by:
setPageContext in interface Tag
Overrides:
setPageContext in class TagSupport
Parameters:
ctxt - the new JSP page context

doStartTag

public int doStartTag()
               throws JspException
Checks that a non-null value has been provided.

Specified by:
doStartTag in interface Tag
Overrides:
doStartTag in class TagSupport
Returns:
SKIP_BODY always
Throws:
JspException - never

doEndTag

public int doEndTag()
             throws JspException
Formats the number and writes it to the JSP output writer.

Specified by:
doEndTag in interface Tag
Overrides:
doEndTag in class TagSupport
Returns:
TagSupport.EVAL_PAGE
Throws:
JspException - if an error occurs


Copyright © 2004-2009 Global Virtual Airlines Group. All Rights Reserved.