T - the type of the Gantt chart nodeS - the type of the calendar entriespublic class TimeGranularityCalendarModel<T extends IGanttChartNode,S extends AbstractCalendarEntry> extends AbstractEntryCalendarModel<T,S>
TimeGranularity. It
is capable of returning information on weekends and holidays. The holidays
can be floating or annual holidays. The model requires that the currently
used dateline model is an instance of TimeGranularityDatelineModel.| Constructor and Description |
|---|
TimeGranularityCalendarModel()
Constructs a new calendar model.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addHoliday(Calendar calendar,
boolean annual)
Adds a holiday at the given time.
|
void |
addHoliday(Date date,
boolean annual)
Adds a holiday at the given date.
|
void |
addHoliday(int month,
int day)
Adds an annual holiday to the calendar.
|
void |
addHoliday(int year,
int month,
int day)
Adds a floating holiday to the calendar.
|
void |
addHoliday(long time,
boolean annual)
Adds a holiday at the given time point.
|
protected List<S> |
calculateEntries(IDatelineModel model,
ITimeSpan span)
Performs the actual calculation of the calendar entries that are located
within the given time span.
|
protected void |
fireCalendarModelChanged()
Informs all listeners that the calendar model has been changed (e.g.
|
Iterator<S> |
getCalendarEntries(IDatelineModel model,
ITimeSpan span)
Returns an iterator for iterating over all calendar entries within the
given time span.
|
Iterator<S> |
getCalendarEntries(IDatelineModel model,
T node,
ITimeSpan span)
Returns an iterator for iterating over all calendar entries of the given
node within the given time span.
|
Date[] |
getHolidays(boolean annual)
Returns the holidays that are defined in the model.
|
TimeZone |
getTimeZone()
Returns the currently used time zone.
|
int[] |
getWeekendDays()
Returns the weekend days supported by the calendar.
|
protected boolean |
isGranularityShowingCalendarEntries(TimeGranularity tg)
Determines whether the given time granularity is suitable for displaying
calendar entries.
|
boolean |
isHoliday(Calendar calendar,
boolean annual)
Determines whether the given calendar object represents a holiday.
|
boolean |
isHoliday(Date date)
Determines whether the given date object represents a holiday
(independent of whether it is an annual holiday or not).
|
boolean |
isHoliday(Date date,
boolean annual)
Determines whether the given date object represents a holiday.
|
boolean |
isWeekendDay(int day)
Checks whether the given value is stored in the list of weekend days.
|
void |
removeHoliday(Calendar calendar,
boolean annual)
Removes a holiday from the calendar.
|
void |
removeHoliday(Date date,
boolean annual)
Removes a holiday from the calendar.
|
void |
removeHoliday(long time,
boolean annual)
Removes a holiday from the calendar.
|
void |
setTimeZone(TimeZone timeZone)
Sets a new time zone to be used by this calendar model.
|
void |
setWeekendDays(int[] days)
Sets the weekend days.
|
getCalendarEntryTimeSpanaddCalendarListener, removeCalendarListenerpublic TimeGranularityCalendarModel()
Calendar.SATURDAY and Calendar.SUNDAY.public void setTimeZone(TimeZone timeZone)
timeZone - the new time zonepublic TimeZone getTimeZone()
public Iterator<S> getCalendarEntries(IDatelineModel model, ITimeSpan span)
ICalendarModelmodel - the currently used dateline modelspan - the time span for which to return calendar entriespublic Iterator<S> getCalendarEntries(IDatelineModel model, T node, ITimeSpan span)
ICalendarModelICalendarModel.getCalendarEntries(IDatelineModel, ITimeSpan).model - the currently used dateline modelnode - the tree node / Gantt chart node for which to return calendar
entriesspan - the time span for which to return calendar entriesprotected List<S> calculateEntries(IDatelineModel model, ITimeSpan span)
model - the currently used dateline modelspan - the time span for which to return a list of calendar entriesprotected boolean isGranularityShowingCalendarEntries(TimeGranularity tg)
tg - the granularity to check for its suitability for showing
calendar entriespublic boolean isWeekendDay(int day)
Calendar.SATURDAY, Calendar.SUNDAY,
Calendar.FRIDAY, etc...day - the day of the week to checkpublic void setWeekendDays(int[] days)
Calendar.SATURDAY,
Calendar.SUNDAY, Calendar.FRIDAY, and so on, can be used
as valuesdays - the days that represent weekend dayspublic int[] getWeekendDays()
public void addHoliday(long time,
boolean annual)
time - the time at which the holiday is locatedannual - determines whether the holiday is a floating or an annual
holidayaddHoliday(Calendar, boolean),
addHoliday(Date, boolean)public void addHoliday(Date date, boolean annual)
date - the date at which the holiday is locatedannual - determines whether the holiday is a floating or an annual
holidayaddHoliday(Calendar, boolean),
addHoliday(long, boolean)public void addHoliday(Calendar calendar, boolean annual)
calendar - the time at which the holiday is locatedannual - determines whether the holiday is a floating or an annual
holidayaddHoliday(long, boolean),
addHoliday(Date, boolean)public void addHoliday(int year,
int month,
int day)
year - the yearmonth - the month (0 based, e.g. 0 for January, 1 for February)day - the day of the monthspublic void addHoliday(int month,
int day)
month - the month (0 based, e.g. 0 for January, 1 for February)day - the day of the monthspublic void removeHoliday(long time,
boolean annual)
time - the time at which the holiday is locatedannual - determines whether the holiday is a floating or an annual
holidayremoveHoliday(Calendar, boolean),
removeHoliday(Date, boolean)public void removeHoliday(Date date, boolean annual)
date - the date at which the holiday is locatedannual - determines whether the holiday is a floating or an annual
holidayremoveHoliday(Calendar, boolean),
removeHoliday(long, boolean)public void removeHoliday(Calendar calendar, boolean annual)
calendar - the time at which the holiday is locatedannual - determines whether the holiday is a floating or an annual
holidayremoveHoliday(long, boolean),
removeHoliday(Date, boolean)public Date[] getHolidays(boolean annual)
annual - determines whether the method will return the annual or the
floating holidayspublic boolean isHoliday(Calendar calendar, boolean annual)
calendar - the calendar object that will be checkedannual - if TRUE the calendar object will be checked for annual holidaypublic boolean isHoliday(Date date, boolean annual)
date - the date object that will be checkedannual - if TRUE the date object will be checked for annual holidaypublic boolean isHoliday(Date date)
date - the date object that will be checkedprotected void fireCalendarModelChanged()
AbstractCalendarModelfireCalendarModelChanged in class AbstractCalendarModel<T extends IGanttChartNode,S extends AbstractCalendarEntry>Copyright © 2006–2016 Dirk Lemmermann Software & Consulting. All rights reserved.