|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD |
java.lang.Object java.lang.Enum<TimeGranularity> com.dlsc.flexgantt.model.TimeGranularity
public enum TimeGranularity
An enumeration of possible time granularities. The smallest granularity is
MILLISECOND
, the largest is MILLENIUM
. Time
granularities represent an abstract time concept. These abstractions can be
used in various places throughout the framework to control the behaviour and
appearance of the user interface. One example is the special zoom policy
IZoomPolicy
, which is used to determine how far the user can zoom
into and out of the timeline. For many applications it is sufficient to see
anything ranging from days to years, but not from milliseconds to milleniums.
Using the data type 'long' to represent (for example) a year would not be
sufficient, because a year can vary in duration.
TimeGranularityGridPolicy
,
TimeGranularityDatelineModel
,
TimeGranularityDatelineRenderer
Enum Constant Summary | |
---|---|
CENTURY
A time granularity representing 100 years. |
|
DAY_SHORT
A time granularity representing 1 day. |
|
DAY_TINY
A time granularity representing 1 day (tiny representation). |
|
DECADE
A time granularity representing 10 years. |
|
FIFTEEN_MINUTES
A time granularity representing 15 minutes. |
|
FIFTEEN_SECONDS
A time granularity representing 15 seconds. |
|
FIVE_MINUTES
A time granularity representing 5 minutes. |
|
FIVE_SECONDS
A time granularity representing 5 seconds. |
|
HALF_YEAR
A time granularity representing 6 months. |
|
HOUR
A time granularity representing 1 hour. |
|
HUNDRED_MILLISECONDS
A time granularity representing 100 milliseconds. |
|
MILLENIUM
A time granularity representing 1000 years. |
|
MILLISECOND
The smallest granularity representing a millisecond. |
|
MINUTE
A time granularity representing 1 minute. |
|
MONTH_SHORT
A time granularity representing 1 month. |
|
MONTH_TINY
A time granularity representing 1 month (tiny representation). |
|
QUARTER_YEAR
A time granularity representing 3 months. |
|
SECOND
A time granularity representing 1 second. |
|
SIX_HOURS
A time granularity representing 6 hour. |
|
TEN_MILLISECONDS
A time granularity representing 10 milliseconds. |
|
TEN_MINUTES
A time granularity representing 10 minutes. |
|
TEN_SECONDS
A time granularity representing 10 seconds. |
|
THIRTY_MINUTES
A time granularity representing 30 minutes. |
|
THIRTY_SECONDS
A time granularity representing 30 seconds. |
|
THREE_HOURS
A time granularity representing 3 hour. |
|
WEEK
A time granularity representing 1 week. |
|
YEAR
A time granularity representing 1 year. |
Method Summary | |
---|---|
void |
adjustCalendar(java.util.Calendar c)
Adjusts the given calendar by rounding it down based on the time granularity. |
void |
adjustDate(java.util.Date date)
Adjusts the given date by rounding it down based on the time granularity. |
void |
decrement(java.util.Calendar c)
Decrements a given calendar by removing time from it. |
void |
decrement(java.util.Date date)
Decrements a given date by removing time from it. |
double |
getDelta(java.util.Calendar s,
java.util.Calendar e)
Returns the number of hours or minutes or days between the given start and end time. |
double |
getDelta(ITimeSpan span,
java.util.TimeZone timeZone)
Returns the number of hours or minutes or days between the start and the end time of the given time span. |
long |
getMilliseconds()
Returns the number of milliseconds represented by the time granularity. |
java.lang.String |
getName()
Returns a translated and displayable name for the time granularity enumeration value. |
static TimeGranularity[] |
getRange(TimeGranularity smallest,
TimeGranularity largest)
Returns an array of time granularities. |
static TimeGranularity |
getTimeGranularity(java.lang.String name)
A name-based lookup of time granularities. |
void |
increment(java.util.Calendar c)
Increments a given calendar by adding time to it. |
void |
increment(java.util.Date date)
Increments a given date by adding time to it. |
boolean |
isInside(TimeGranularity lower,
TimeGranularity upper)
Checks whether a time granularity is 'inside' two other granularities. |
boolean |
isLarger(TimeGranularity tg)
Performs a check to see whether the time granularity is 'larger' than the given granularity. |
boolean |
isSmaller(TimeGranularity tg)
Performs a check to see whether the time granularity is 'smaller' than the given granularity. |
static TimeGranularity |
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. |
static TimeGranularity[] |
values()
Returns an array containing the constants of this enum type, in the order they're declared. |
Methods inherited from class java.lang.Enum |
---|
clone, compareTo, equals, getDeclaringClass, hashCode, name, ordinal, toString, valueOf |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Enum Constant Detail |
---|
public static final TimeGranularity MILLISECOND
public static final TimeGranularity TEN_MILLISECONDS
public static final TimeGranularity HUNDRED_MILLISECONDS
public static final TimeGranularity SECOND
public static final TimeGranularity FIVE_SECONDS
public static final TimeGranularity TEN_SECONDS
public static final TimeGranularity FIFTEEN_SECONDS
public static final TimeGranularity THIRTY_SECONDS
public static final TimeGranularity MINUTE
public static final TimeGranularity FIVE_MINUTES
public static final TimeGranularity TEN_MINUTES
public static final TimeGranularity FIFTEEN_MINUTES
public static final TimeGranularity THIRTY_MINUTES
public static final TimeGranularity HOUR
public static final TimeGranularity THREE_HOURS
public static final TimeGranularity SIX_HOURS
public static final TimeGranularity DAY_SHORT
public static final TimeGranularity DAY_TINY
public static final TimeGranularity WEEK
public static final TimeGranularity MONTH_SHORT
public static final TimeGranularity MONTH_TINY
public static final TimeGranularity QUARTER_YEAR
public static final TimeGranularity HALF_YEAR
public static final TimeGranularity YEAR
public static final TimeGranularity DECADE
public static final TimeGranularity CENTURY
public static final TimeGranularity MILLENIUM
Method Detail |
---|
public static final TimeGranularity[] values()
for(TimeGranularity c : TimeGranularity.values()) System.out.println(c);
public static TimeGranularity valueOf(java.lang.String name)
name
- the name of the enum constant to be returned.
java.lang.IllegalArgumentException
- if this enum type has no constant
with the specified namepublic long getMilliseconds()
public java.lang.String getName()
getName
in interface IGranularity<TimeGranularity>
public void adjustDate(java.util.Date date)
date
- the date to round downpublic void adjustCalendar(java.util.Calendar c)
c
- the calendar to round downpublic void increment(java.util.Date date)
date
- the date to incrementdecrement(Date)
,
increment(Calendar)
public void increment(java.util.Calendar c)
c
- the calendar to incrementdecrement(Calendar)
,
increment(Date)
public void decrement(java.util.Date date)
date
- the date to decrementincrement(Date)
,
decrement(Calendar)
public void decrement(java.util.Calendar c)
c
- the calendar to decrementincrement(Calendar)
,
decrement(Date)
public static TimeGranularity[] getRange(TimeGranularity smallest, TimeGranularity largest)
smallest
- the lower bounds of the requested rangelargest
- the upper bounds of the requested range
public boolean isInside(TimeGranularity lower, TimeGranularity upper)
G
is inside A
and
B
if (A.isSmaller(G) || A.equals(G))
and
(B.isLarger(G) ||
B.equals(G))
.
lower
- the lower bounds of the rangeupper
- the upper bounds of the range
java.lang.IllegalArgumentException
- if 'lower' is not smaller than 'upper' or equal to 'upper'public boolean isSmaller(TimeGranularity tg)
isSmaller
in interface IGranularity<TimeGranularity>
tg
- the time granularity to compare with
ordinal() < tg.ordinal()
public boolean isLarger(TimeGranularity tg)
isLarger
in interface IGranularity<TimeGranularity>
tg
- the time granularity to compare with
ordinal() > tg.ordinal()
public static TimeGranularity getTimeGranularity(java.lang.String name)
name
- a time granularity display name (note: depends on the current
locale as the name is i18n)
java.lang.IllegalArgumentException
- if no time granularity with the given display name existsgetName()
public double getDelta(ITimeSpan span, java.util.TimeZone timeZone)
span
- the time span for which to calculate the deltatimeZone
- used to create calendar objects for the start and the end time
of the given time span
getDelta(Calendar, Calendar)
public double getDelta(java.util.Calendar s, java.util.Calendar e)
s
- the start timee
- the end time
getDelta(ITimeSpan, TimeZone)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD |