You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-dev@jakarta.apache.org by gl...@locus.apache.org on 2000/11/06 02:19:31 UTC
cvs commit: jakarta-taglibs/datetime/src/org/apache/taglibs/datetime ParseTag.java
glenn 00/11/05 17:19:31
Modified: datetime/src/org/apache/taglibs/datetime ParseTag.java
Log:
Cleanup for release
Revision Changes Path
1.2 +42 -28 jakarta-taglibs/datetime/src/org/apache/taglibs/datetime/ParseTag.java
Index: ParseTag.java
===================================================================
RCS file: /home/cvs/jakarta-taglibs/datetime/src/org/apache/taglibs/datetime/ParseTag.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ParseTag.java 2000/09/29 16:13:56 1.1
+++ ParseTag.java 2000/11/06 01:19:30 1.2
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-taglibs/datetime/src/org/apache/taglibs/datetime/ParseTag.java,v 1.1 2000/09/29 16:13:56 glenn Exp $
- * $Revision: 1.1 $
- * $Date: 2000/09/29 16:13:56 $
+ * $Header: /home/cvs/jakarta-taglibs/datetime/src/org/apache/taglibs/datetime/ParseTag.java,v 1.2 2000/11/06 01:19:30 glenn Exp $
+ * $Revision: 1.2 $
+ * $Date: 2000/11/06 01:19:30 $
*
* ====================================================================
*
@@ -77,6 +77,10 @@
* Uses the optional attribute <b>pattern</b> as the pattern
* to use when parsing the Date string.
* <p>
+ * The optional attribute <b>timezone</b> can be set to the id of
+ * a timezone script varaible so that the Date if adjusted for
+ * that timezone.
+ * <p>
* If the optional attribute <b>locale</b> is true, the Date
* is parsed for the clients locale if known.
* <p>
@@ -87,7 +91,7 @@
* <name>parse</name>
* <tagclass>org.apache.taglibs.datetime.ParseTag</tagclass>
* <bodycontent>JSP</bodycontent>
- * <info>Parses a date string and outputs the time in ms.</info>
+ * <info>Parses a date string and outputs the time in milliseconds since Jan 1, 1970 GMT.</info>
* <attribute>
* <name>pattern</name>
* <sessuired>false</sessuired>
@@ -110,17 +114,21 @@
public class ParseTag extends BodyTagSupport
{
+ // Optional attribute, use users locale if known when formatting date
private Locale locale = null;
+ // Optional attribute, time pattern string to use when formatting date
private String pattern = null;
+ // Optional attribute, timezone script variable id to use when formatting date
private TimeZone timezone = null;
+ // Date after parsing tag body
private Date date = null;
/**
* Method called at start of tag, always returns EVAL_BODY_TAG
*
- * @return always returns EVAL_BODY_TAG
+ * @return EVAL_BODY_TAG
*/
- public int doStartTag() throws JspException
+ public final int doStartTag() throws JspException
{
return EVAL_BODY_TAG;
}
@@ -128,9 +136,9 @@
/**
* Method called at end of parse tag body.
*
- * @return always returns SKIP_BODY
+ * @return SKIP_BODY
*/
- public int doAfterBody() throws JspException
+ public final int doAfterBody() throws JspException
{
// Use the body of the tag as input for the date
BodyContent body = getBodyContent();
@@ -164,9 +172,10 @@
/**
* Method called at end of Tag
+ *
* @return EVAL_PAGE
*/
- public int doEndTag() throws JspException
+ public final int doEndTag() throws JspException
{
long time = 0;
if( date != null )
@@ -181,33 +190,38 @@
}
/**
- * Locale flag, if set to true, parse date for client's locale
- * for client's preferred locale if known.
+ * Locale flag, if set to true, date format is for
+ * client's preferred locale if known.
+ *
+ * @param String use users locale, true or false
*/
- public void setLocale(String str)
+ public final void setLocale(String str)
{
- if( str.equals("true") )
- locale = pageContext.getRequest().getLocale();
+ if( str.equals("true") )
+ locale = pageContext.getRequest().getLocale();
}
-
+
/**
- * Set the time zone to use when parseting date.
+ * Set the time zone to use when parsing date.
*
* Value must be the name of a <b>timezone</b> tag script
* variable ID.
+ *
+ * @param String name of timezone to use
*/
- public void setTimezone(String tz)
- {
- timezone =
- (TimeZone)pageContext.getAttribute(tz,PageContext.SESSION_SCOPE);
- }
-
- /**
- * Set the pattern to use when parseting Date.
+ public final void setTimezone(String tz)
+ {
+ timezone =
+ (TimeZone)pageContext.getAttribute(tz,PageContext.SESSION_SCOPE);
+ }
+
+ /**
+ * Set the pattern to use when parsing Date.
+ *
+ * @param String SimpleDateFormat style time pattern format string
*/
- public void setPattern(String str)
- {
- pattern = str;
+ public final void setPattern(String str)
+ {
+ pattern = str;
}
-
}