com.atlassian.jira.util
Class JiraDurationUtils.PrettyDurationFormatter

java.lang.Object
  extended by com.atlassian.jira.util.JiraDurationUtils.PrettyDurationFormatter
All Implemented Interfaces:
JiraDurationUtils.DurationFormatter
Enclosing class:
JiraDurationUtils

public static class JiraDurationUtils.PrettyDurationFormatter
extends Object
implements JiraDurationUtils.DurationFormatter

This formatter formats time duration to "pretty" format, such as 3 weeks, 2 days, 1 hour, 15 minutes. This value is formatted according to system or user's locale.


Field Summary
protected  int daysPerWeek
           
protected  int hoursPerDay
           
static String KEY_FORMAT_PRETTY
           
 
Constructor Summary
JiraDurationUtils.PrettyDurationFormatter(int hoursPerDay, int daysPerWeek, I18nBean i18nBean)
           
 
Method Summary
 String format(Long duration)
          Formats a given time duration with default (system) locale.
 String format(Long duration, Locale locale)
          Formats a given time duration with given locale.
 String getI18nKey()
           
 String shortFormat(Long duration)
          Used by the Time Tracking report to show shorter durations than full pretty format.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

KEY_FORMAT_PRETTY

public static final String KEY_FORMAT_PRETTY
See Also:
Constant Field Values

hoursPerDay

protected final int hoursPerDay

daysPerWeek

protected final int daysPerWeek
Constructor Detail

JiraDurationUtils.PrettyDurationFormatter

public JiraDurationUtils.PrettyDurationFormatter(int hoursPerDay,
                                                 int daysPerWeek,
                                                 I18nBean i18nBean)
Method Detail

getI18nKey

public String getI18nKey()
Specified by:
getI18nKey in interface JiraDurationUtils.DurationFormatter

format

public String format(Long duration)
Description copied from interface: JiraDurationUtils.DurationFormatter
Formats a given time duration with default (system) locale.

Specified by:
format in interface JiraDurationUtils.DurationFormatter
Parameters:
duration - time duration to format
Returns:
formatted time duration

format

public String format(Long duration,
                     Locale locale)
Description copied from interface: JiraDurationUtils.DurationFormatter
Formats a given time duration with given locale.

Specified by:
format in interface JiraDurationUtils.DurationFormatter
Parameters:
duration - time duration to format
locale - user's locale
Returns:
formatted time duration

shortFormat

public String shortFormat(Long duration)
Used by the Time Tracking report to show shorter durations than full pretty format.

Specified by:
shortFormat in interface JiraDurationUtils.DurationFormatter
Parameters:
duration - time duration to format
Returns:
a duration String in the format "1d 3h 30m".


Copyright © 2002-2009 Atlassian. All Rights Reserved.