public class FormatDateTag
extends javax.servlet.jsp.tagext.TagSupport
<rhn:human-value value="${bean.value}">
Outputs a human readable text for the value relative to now.
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
dateStyle |
protected java.lang.String |
humanStyle |
protected java.util.Locale |
locale |
protected java.lang.String |
pattern |
protected java.util.Date |
reference |
protected java.lang.String |
timeStyle |
protected java.lang.String |
type |
protected java.util.Date |
value |
Constructor and Description |
---|
FormatDateTag()
Constructor
|
Modifier and Type | Method and Description |
---|---|
int |
doEndTag() |
int |
doStartTag() |
protected java.util.Locale |
getBestLocale() |
protected java.lang.String |
getCssClass() |
java.lang.String |
getDateStyle()
For details, refer to the <fmt:FormatDate> tag
|
protected java.lang.String |
getFormattedDate() |
protected java.text.DateFormat |
getFormatter() |
java.lang.String |
getHumanStyle() |
java.util.Locale |
getLocale() |
java.lang.String |
getPattern()
For details, refer to the <fmt:FormatDate> tag
|
java.util.Date |
getReference() |
java.lang.String |
getTimeStyle()
For details, refer to the <fmt:FormatDate> tag
|
java.lang.String |
getType()
For details, refer to the <fmt:FormatDate> tag
|
java.util.Date |
getValue() |
protected boolean |
isFormatCustomized() |
protected void |
renderMomentInclude(java.io.Writer out)
renders code that includes the moment.js library, only
if it has not been included before by the same tag
|
void |
setDateStyle(java.lang.String style)
For details, refer to the <fmt:FormatDate> tag
|
void |
setHumanStyle(java.lang.String style)
Set human style
|
void |
setLocale(java.util.Locale loc) |
void |
setPattern(java.lang.String pat)
For details, refer to the <fmt:FormatDate> tag
|
void |
setReference(java.util.Date ref)
The reference date used instead of now
when calculating intervals or durations
|
void |
setTimeStyle(java.lang.String style)
For details, refer to the <fmt:FormatDate> tag
|
void |
setType(java.lang.String typ)
For details, refer to the <fmt:FormatDate> tag
|
void |
setValue(java.util.Date val) |
protected java.util.Date value
protected java.util.Date reference
protected java.util.Locale locale
protected java.lang.String pattern
protected java.lang.String dateStyle
protected java.lang.String timeStyle
protected java.lang.String type
protected java.lang.String humanStyle
public java.util.Date getReference()
public void setReference(java.util.Date ref)
ref
- date valuepublic java.lang.String getHumanStyle()
public void setHumanStyle(java.lang.String style)
style
- value
Valid values:
"none" (default)
"from" date from now or reference
"calendar" calendar datepublic java.lang.String getPattern()
public void setPattern(java.lang.String pat)
pat
- The desired pattern for the formatterpublic java.lang.String getDateStyle()
public void setDateStyle(java.lang.String style)
style
- Desired date style for the formatter
(Valid values: default, shot, medium, long, full)public java.lang.String getTimeStyle()
public void setTimeStyle(java.lang.String style)
style
- Desired time style for the formatterpublic java.lang.String getType()
public void setType(java.lang.String typ)
typ
- Desired type for the formatter
(Valid values: date, time or both)public java.util.Locale getLocale()
public void setLocale(java.util.Locale loc)
loc
- Locale to do the formatting, defaults to the application
settingspublic java.util.Date getValue()
public void setValue(java.util.Date val)
val
- the value to be formattedprotected void renderMomentInclude(java.io.Writer out) throws java.io.IOException
out
- Where to render tojava.io.IOException
- IO exceptionprotected java.lang.String getFormattedDate()
public int doStartTag() throws javax.servlet.jsp.JspException
doStartTag
in interface javax.servlet.jsp.tagext.Tag
doStartTag
in class javax.servlet.jsp.tagext.TagSupport
javax.servlet.jsp.JspException
- JSP exceptionpublic int doEndTag() throws javax.servlet.jsp.JspException
doEndTag
in interface javax.servlet.jsp.tagext.Tag
doEndTag
in class javax.servlet.jsp.tagext.TagSupport
javax.servlet.jsp.JspException
- JSP exceptionprotected java.lang.String getCssClass()
protected boolean isFormatCustomized()
protected java.util.Locale getBestLocale()
protected java.text.DateFormat getFormatter()