|
JFreeChart 1.0.14-redhat-2 | |||||||||
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 |
---|
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(Date time)
Creates a new instance. |
|
RelativeDateFormat(long baseMillis)
Creates a new instance. |
Method Summary | |
---|---|
Object |
clone()
Returns a clone of this instance. |
boolean |
equals(Object obj)
Tests this formatter for equality with an arbitrary object. |
StringBuffer |
format(Date date,
StringBuffer toAppendTo,
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. |
String |
getDaySuffix()
Returns the string that is appended to the day count. |
String |
getHourSuffix()
Returns the string that is appended to the hour count. |
String |
getMinuteSuffix()
Returns the string that is appended to the minute count. |
String |
getPositivePrefix()
Returns the string that is prepended to the format if the relative time is positive. |
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(String[] args)
Some test code. |
Date |
parse(String source,
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(NumberFormat formatter)
Sets the formatter for the days. |
void |
setDaySuffix(String suffix)
Sets the string that is appended to the day count. |
void |
setHourFormatter(NumberFormat formatter)
Sets the formatter for the hours. |
void |
setHourSuffix(String suffix)
Sets the string that is appended to the hour count. |
void |
setMinuteFormatter(NumberFormat formatter)
Sets the formatter for the minutes. |
void |
setMinuteSuffix(String suffix)
Sets the string that is appended to the minute count. |
void |
setPositivePrefix(String prefix)
Sets the string that is prepended to the format if the relative time is positive. |
void |
setSecondFormatter(NumberFormat formatter)
Sets the formatter for the seconds and milliseconds. |
void |
setSecondSuffix(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(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 String getPositivePrefix()
null
).setPositivePrefix(String)
public void setPositivePrefix(String prefix)
prefix
- the prefix (null
not permitted).getPositivePrefix()
public void setDayFormatter(NumberFormat formatter)
formatter
- the formatter (null
not permitted).public String getDaySuffix()
setDaySuffix(String)
public void setDaySuffix(String suffix)
suffix
- the suffix (null
not permitted).getDaySuffix()
public void setHourFormatter(NumberFormat formatter)
formatter
- the formatter (null
not permitted).public String getHourSuffix()
setHourSuffix(String)
public void setHourSuffix(String suffix)
suffix
- the suffix (null
not permitted).getHourSuffix()
public void setMinuteFormatter(NumberFormat formatter)
formatter
- the formatter (null
not permitted).public String getMinuteSuffix()
setMinuteSuffix(String)
public void setMinuteSuffix(String suffix)
suffix
- the suffix (null
not permitted).getMinuteSuffix()
public String getSecondSuffix()
setSecondSuffix(String)
public void setSecondSuffix(String suffix)
suffix
- the suffix (null
not permitted).getSecondSuffix()
public void setSecondFormatter(NumberFormat formatter)
formatter
- the formatter (null
not permitted).public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition)
format
in class DateFormat
date
- the date.toAppendTo
- the string buffer.fieldPosition
- the field position.
public Date parse(String source, ParsePosition pos)
parse
in class DateFormat
source
- the date string.pos
- the parse position.
null
, as this method has not been implemented.public boolean equals(Object obj)
equals
in class DateFormat
obj
- the object (null
permitted).
public int hashCode()
hashCode
in class DateFormat
public Object clone()
clone
in class DateFormat
public static void main(String[] args)
args
- ignored.
|
JFreeChart 1.0.14-redhat-2 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |