com.logikdev.jsftools
Class StaticComparisonDateTool

java.lang.Object
  extended by com.logikdev.jsftools.StaticDateTool
      extended by com.logikdev.jsftools.StaticComparisonDateTool

public class StaticComparisonDateTool
extends StaticDateTool

Tool for comparing Date and Calendar values in JSF. This is a subclass of StaticDateTool and thus provides all the functionality of that tool and augments it with the ability to find the relationship between any date and the current date, or between any two dates. This comparison can result in either a textual representation of the relationship (e.g. "3 weeks, 2 days ago", "tomorrow", or "3 hrs away") or the value of a specific time unit may be requested. When using the textual representations, you can configure the tool to use alternate resource bundles and to skip over units you do not want to be included.

Since:
0.3
Author:
Stéphane Moreau
See Also:
org.apache.velocity.tools.generic.ComparisonDateTool

Constructor Summary
StaticComparisonDateTool()
           
 
Method Summary
static org.apache.velocity.tools.generic.ComparisonDateTool.Comparison difference(java.lang.Object now, java.lang.Object then)
          Returns a ComparisonDateTool.Comparison between the result of the second specified date and the first specified date.
static long toDays(long ms)
          Returns the number of whole Days in the specified number of milliseconds.
static long toHours(long ms)
          Returns the number of whole Hours in the specified number of milliseconds.
static long toMinutes(long ms)
          Returns the number of whole Minutes in the specified number of milliseconds.
static long toMonths(long ms)
          Returns the number of whole Months in the specified number of milliseconds.
static long toSeconds(long ms)
          Returns the number of whole Seconds in the specified number of milliseconds.
static long toWeeks(long ms)
          Returns the number of whole Weeks in the specified number of milliseconds.
static long toYears(long ms)
          Returns the number of whole Years in the specified number of milliseconds.
static org.apache.velocity.tools.generic.ComparisonDateTool.Comparison whenIs(java.lang.Object then)
          Returns a ComparisonDateTool.Comparison between the result of DateTool.getCalendar() and the specified date.
static org.apache.velocity.tools.generic.ComparisonDateTool.Comparison whenIs(java.lang.Object now, java.lang.Object then)
          Returns a ComparisonDateTool.Comparison between the second specified date and the first specified date.
 
Methods inherited from class com.logikdev.jsftools.StaticDateTool
format, format, format, format, format, format, format, get, get, getCalendar, getDate, getDateFormat, getDateFormat, getDay, getDay, getMonth, getMonth, getSystemCalendar, getSystemDate, getSystemTime, getTimeZone, getValue, getValue, getValue, getYear, getYear, toCalendar, toCalendar, toDate, toDate, toDate, toDate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StaticComparisonDateTool

public StaticComparisonDateTool()
Method Detail

difference

public static final org.apache.velocity.tools.generic.ComparisonDateTool.Comparison difference(java.lang.Object now,
                                                                                               java.lang.Object then)
Returns a ComparisonDateTool.Comparison between the result of the second specified date and the first specified date.

Parameters:
now - The date to use as representative of "now"
then - The secondary date
Returns:
A ComparisonDateTool.Comparison between the result of the second specified date and the first specified date
See Also:
org.apache.velocity.tools.generic.ComparisonDateTool#difference(java.lang.Object, java.lang.Object)

toDays

public static final long toDays(long ms)
Returns the number of whole Days in the specified number of milliseconds.

Parameters:
ms - The specified number of milliseconds
Returns:
The number of whole Days in the specified number of milliseconds
See Also:
org.apache.velocity.tools.generic.ComparisonDateTool#toDays(long)

toHours

public static final long toHours(long ms)
Returns the number of whole Hours in the specified number of milliseconds.

Parameters:
ms - The specified number of milliseconds
Returns:
The number of whole Hours in the specified number of milliseconds
See Also:
org.apache.velocity.tools.generic.ComparisonDateTool#toHours(long)

toMinutes

public static final long toMinutes(long ms)
Returns the number of whole Minutes in the specified number of milliseconds.

Parameters:
ms - The specified number of milliseconds
Returns:
The number of whole Minutes in the specified number of milliseconds
See Also:
org.apache.velocity.tools.generic.ComparisonDateTool#toMinutes(long)

toMonths

public static final long toMonths(long ms)
Returns the number of whole Months in the specified number of milliseconds.

Parameters:
ms - The specified number of milliseconds
Returns:
The number of whole Months in the specified number of milliseconds
See Also:
org.apache.velocity.tools.generic.ComparisonDateTool#toMonths(long)

toSeconds

public static final long toSeconds(long ms)
Returns the number of whole Seconds in the specified number of milliseconds.

Parameters:
ms - The specified number of milliseconds
Returns:
The number of whole Seconds in the specified number of milliseconds
See Also:
org.apache.velocity.tools.generic.ComparisonDateTool#toSeconds(long)

toWeeks

public static final long toWeeks(long ms)
Returns the number of whole Weeks in the specified number of milliseconds.

Parameters:
ms - The specified number of milliseconds
Returns:
The number of whole Weeks in the specified number of milliseconds
See Also:
org.apache.velocity.tools.generic.ComparisonDateTool#toWeeks(long)

toYears

public static final long toYears(long ms)
Returns the number of whole Years in the specified number of milliseconds.

Parameters:
ms - The specified number of milliseconds
Returns:
The number of whole Years in the specified number of milliseconds
See Also:
org.apache.velocity.tools.generic.ComparisonDateTool#toYears(long)

whenIs

public static final org.apache.velocity.tools.generic.ComparisonDateTool.Comparison whenIs(java.lang.Object then)
Returns a ComparisonDateTool.Comparison between the result of DateTool.getCalendar() and the specified date.

Parameters:
then - The date in question
Returns:
A ComparisonDateTool.Comparison between the result of DateTool.getCalendar() and the specified date
See Also:
org.apache.velocity.tools.generic.ComparisonDateTool#whenIs(java.lang.Object)

whenIs

public static final org.apache.velocity.tools.generic.ComparisonDateTool.Comparison whenIs(java.lang.Object now,
                                                                                           java.lang.Object then)
Returns a ComparisonDateTool.Comparison between the second specified date and the first specified date.

Parameters:
now - The date to use as representative of "now"
then - The date in question
Returns:
A ComparisonDateTool.Comparison between the second specified date and the first specified date
See Also:
org.apache.velocity.tools.generic.ComparisonDateTool#whenIs(java.lang.Object, java.lang.Object)


Copyright © 2009-2010 Logik Development. All Rights Reserved.