|
Header
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.text.Format
java.text.DateFormat
org.jfree.chart.util.RelativeDateFormat
public class RelativeDateFormat
A formatter that formats dates to show the elapsed time relative to some base date.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.text.DateFormat |
---|
java.text.DateFormat.Field |
Field Summary |
---|
Fields inherited from class java.text.DateFormat |
---|
AM_PM_FIELD, calendar, DATE_FIELD, DAY_OF_WEEK_FIELD, DAY_OF_WEEK_IN_MONTH_FIELD, DAY_OF_YEAR_FIELD, DEFAULT, ERA_FIELD, FULL, HOUR_OF_DAY0_FIELD, HOUR_OF_DAY1_FIELD, HOUR0_FIELD, HOUR1_FIELD, LONG, MEDIUM, MILLISECOND_FIELD, MINUTE_FIELD, MONTH_FIELD, numberFormat, SECOND_FIELD, SHORT, TIMEZONE_FIELD, WEEK_OF_MONTH_FIELD, WEEK_OF_YEAR_FIELD, YEAR_FIELD |
Constructor Summary | |
---|---|
RelativeDateFormat()
Creates a new instance with base milliseconds set to zero. |
|
RelativeDateFormat(java.util.Date time)
Creates a new instance. |
|
RelativeDateFormat(long baseMillis)
Creates a new instance. |
Method Summary | |
---|---|
java.lang.Object |
clone()
Returns a clone of this instance. |
boolean |
equals(java.lang.Object obj)
Tests this formatter for equality with an arbitrary object. |
java.lang.StringBuffer |
format(java.util.Date date,
java.lang.StringBuffer toAppendTo,
java.text.FieldPosition fieldPosition)
Formats the given date as the amount of elapsed time (relative to the base date specified in the constructor). |
long |
getBaseMillis()
Returns the base date/time used to calculate the elapsed time for display. |
java.lang.String |
getDaySuffix()
Returns the string that is appended to the day count. |
java.lang.String |
getHourSuffix()
Returns the string that is appended to the hour count. |
java.lang.String |
getMinuteSuffix()
Returns the string that is appended to the minute count. |
java.lang.String |
getPositivePrefix()
Returns the string that is prepended to the format if the relative time is positive. |
java.lang.String |
getSecondSuffix()
Returns the string that is appended to the second count. |
boolean |
getShowZeroDays()
Returns the flag that controls whether or not zero day counts are shown in the formatted output. |
boolean |
getShowZeroHours()
Returns the flag that controls whether or not zero hour counts are shown in the formatted output. |
int |
hashCode()
Returns a hash code for this instance. |
static void |
main(java.lang.String[] args)
Some test code. |
java.util.Date |
parse(java.lang.String source,
java.text.ParsePosition pos)
Parses the given string (not implemented). |
void |
setBaseMillis(long baseMillis)
Sets the base date/time used to calculate the elapsed time for display. |
void |
setDayFormatter(java.text.NumberFormat formatter)
Sets the formatter for the days. |
void |
setDaySuffix(java.lang.String suffix)
Sets the string that is appended to the day count. |
void |
setHourFormatter(java.text.NumberFormat formatter)
Sets the formatter for the hours. |
void |
setHourSuffix(java.lang.String suffix)
Sets the string that is appended to the hour count. |
void |
setMinuteFormatter(java.text.NumberFormat formatter)
Sets the formatter for the minutes. |
void |
setMinuteSuffix(java.lang.String suffix)
Sets the string that is appended to the minute count. |
void |
setPositivePrefix(java.lang.String prefix)
Sets the string that is prepended to the format if the relative time is positive. |
void |
setSecondFormatter(java.text.NumberFormat formatter)
Sets the formatter for the seconds and milliseconds. |
void |
setSecondSuffix(java.lang.String suffix)
Sets the string that is appended to the second count. |
void |
setShowZeroDays(boolean show)
Sets the flag that controls whether or not zero day counts are shown in the formatted output. |
void |
setShowZeroHours(boolean show)
Sets the flag that controls whether or not zero hour counts are shown in the formatted output. |
Methods inherited from class java.text.DateFormat |
---|
format, format, getAvailableLocales, getCalendar, getDateInstance, getDateInstance, getDateInstance, getDateTimeInstance, getDateTimeInstance, getDateTimeInstance, getInstance, getNumberFormat, getTimeInstance, getTimeInstance, getTimeInstance, getTimeZone, isLenient, parse, parseObject, setCalendar, setLenient, setNumberFormat, setTimeZone |
Methods inherited from class java.text.Format |
---|
format, formatToCharacterIterator, parseObject |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public RelativeDateFormat()
public RelativeDateFormat(java.util.Date time)
time
- the date/time (null
not permitted).public RelativeDateFormat(long baseMillis)
baseMillis
- the time zone (null
not permitted).Method Detail |
---|
public long getBaseMillis()
setBaseMillis(long)
public void setBaseMillis(long baseMillis)
java.util.Date
.
baseMillis
- the base date/time in milliseconds.getBaseMillis()
public boolean getShowZeroDays()
setShowZeroDays(boolean)
public void setShowZeroDays(boolean show)
show
- the flag.getShowZeroDays()
public boolean getShowZeroHours()
setShowZeroHours(boolean)
public void setShowZeroHours(boolean show)
show
- the flag.getShowZeroHours()
public java.lang.String getPositivePrefix()
null
).setPositivePrefix(String)
public void setPositivePrefix(java.lang.String prefix)
prefix
- the prefix (null
not permitted).getPositivePrefix()
public void setDayFormatter(java.text.NumberFormat formatter)
formatter
- the formatter (null
not permitted).public java.lang.String getDaySuffix()
setDaySuffix(String)
public void setDaySuffix(java.lang.String suffix)
suffix
- the suffix (null
not permitted).getDaySuffix()
public void setHourFormatter(java.text.NumberFormat formatter)
formatter
- the formatter (null
not permitted).public java.lang.String getHourSuffix()
setHourSuffix(String)
public void setHourSuffix(java.lang.String suffix)
suffix
- the suffix (null
not permitted).getHourSuffix()
public void setMinuteFormatter(java.text.NumberFormat formatter)
formatter
- the formatter (null
not permitted).public java.lang.String getMinuteSuffix()
setMinuteSuffix(String)
public void setMinuteSuffix(java.lang.String suffix)
suffix
- the suffix (null
not permitted).getMinuteSuffix()
public java.lang.String getSecondSuffix()
setSecondSuffix(String)
public void setSecondSuffix(java.lang.String suffix)
suffix
- the suffix (null
not permitted).getSecondSuffix()
public void setSecondFormatter(java.text.NumberFormat formatter)
formatter
- the formatter (null
not permitted).public java.lang.StringBuffer format(java.util.Date date, java.lang.StringBuffer toAppendTo, java.text.FieldPosition fieldPosition)
format
in class java.text.DateFormat
date
- the date.toAppendTo
- the string buffer.fieldPosition
- the field position.
public java.util.Date parse(java.lang.String source, java.text.ParsePosition pos)
parse
in class java.text.DateFormat
source
- the date string.pos
- the parse position.
null
, as this method has not been implemented.public boolean equals(java.lang.Object obj)
equals
in class java.text.DateFormat
obj
- the object (null
permitted).
public int hashCode()
hashCode
in class java.text.DateFormat
public java.lang.Object clone()
clone
in class java.text.DateFormat
public static void main(java.lang.String[] args)
args
- ignored.
|
Footer
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |