|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.dlsc.flexgantt.model.calendar.AbstractCalendarModel<T,S> com.dlsc.flexgantt.model.calendar.AbstractEntryCalendarModel<T,S> com.dlsc.flexgantt.model.calendar.TimeGranularityCalendarModel<T,S>
T
- the type of the Gantt chart nodeS
- the type of the calendar entriespublic class TimeGranularityCalendarModel<T extends IGanttChartNode,S extends AbstractCalendarEntry>
A calendar model implementation that is based on 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 Summary | |
---|---|
TimeGranularityCalendarModel()
Constructs a new calendar model. |
Method Summary | |
---|---|
void |
addHoliday(java.util.Calendar calendar,
boolean annual)
Adds a holiday at the given time. |
void |
addHoliday(java.util.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 java.util.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. a holiday has been added). |
java.util.Iterator<S> |
getCalendarEntries(IDatelineModel model,
ITimeSpan span)
Returns an iterator for iterating over all calendar entries within the given time span. |
java.util.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. |
java.util.Date[] |
getHolidays(boolean annual)
Returns the holidays that are defined in the model. |
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(java.util.Calendar calendar,
boolean annual)
Determines whether the given calendar object represents a holiday. |
boolean |
isHoliday(java.util.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(java.util.Calendar calendar,
boolean annual)
Removes a holiday from the calendar. |
void |
removeHoliday(java.util.Date date,
boolean annual)
Removes a holiday from the calendar. |
void |
removeHoliday(long time,
boolean annual)
Removes a holiday from the calendar. |
void |
setWeekendDays(int[] days)
Sets the weekend days. |
Methods inherited from class com.dlsc.flexgantt.model.calendar.AbstractEntryCalendarModel |
---|
getCalendarEntryTimeSpan |
Methods inherited from class com.dlsc.flexgantt.model.calendar.AbstractCalendarModel |
---|
addCalendarListener, removeCalendarListener |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TimeGranularityCalendarModel()
Calendar.SATURDAY
and Calendar.SUNDAY
.
Method Detail |
---|
public java.util.Iterator<S> getCalendarEntries(IDatelineModel model, ITimeSpan span)
ICalendarModel
model
- the currently used dateline modelspan
- the time span for which to return calendar entries
public java.util.Iterator<S> getCalendarEntries(IDatelineModel model, T node, ITimeSpan span)
ICalendarModel
ICalendarModel.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 entries
protected java.util.List<S> calculateEntries(IDatelineModel model, ITimeSpan span)
model
- the currently used dateline modelspan
- the time span for which to return a list of calendar entries
protected boolean isGranularityShowingCalendarEntries(TimeGranularity tg)
tg
- the granularity to check for its suitability for showing
calendar entries
public boolean isWeekendDay(int day)
Calendar.SATURDAY
, Calendar.SUNDAY
,
Calendar.FRIDAY
, etc...
day
- the day of the week to check
public void setWeekendDays(int[] days)
Calendar.SATURDAY
,
Calendar.SUNDAY
, Calendar.FRIDAY
, and so on, can be
used as values
days
- 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(java.util.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(java.util.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(java.util.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(java.util.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 java.util.Date[] getHolidays(boolean annual)
annual
- determines whether the method will return the annual or the
floating holidays
public boolean isHoliday(java.util.Calendar calendar, boolean annual)
calendar
- the calendar object that will be checkedannual
- if TRUE the calendar object will be checked for annual holiday
public boolean isHoliday(java.util.Date date, boolean annual)
date
- the date object that will be checkedannual
- if TRUE the date object will be checked for annual holiday
protected void fireCalendarModelChanged()
AbstractCalendarModel
fireCalendarModelChanged
in class AbstractCalendarModel<T extends IGanttChartNode,S extends AbstractCalendarEntry>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |