public class GanttSpecialDateRange
extends java.lang.Object
GanttSpecialDateRange weekends = new GanttSpecialDateRange(parentChart); weekends.addRecurDay(Calendar.SATURDAY); weekends.addRecurDay(Calendar.SUNDAY); weekends.setAllowEventsOnDates(false);To block a Tuesday before 8.30am and after 5.30pm, 10 times, starting Jan 1, 2009, you would do:
Calendar cal = Calendar.getInstance(Locale.getDefault()); cal.set(Calendar.YEAR, 2009); cal.set(Calendar.MONTH, Calendar.JANUARY); cal.set(Calendar.DATE, 1); GanttSpecialDateRange blockPre = new GanttSpecialDateRange(parentChart); blockPre.setStart(cal); blockPre.addRecurDay(Calendar.SATURDAY); blockPre.setEndHour(8); blockPre.setEndMinute(29); blockPre.setEndAfter(10); GanttSpecialDateRange blockPost = new GanttSpecialDateRange(parentChart); blockPre.setStart(cal); blockPost.addRecurDay(Calendar.SATURDAY); blockPost.setStartHour(17); blockPost.setStartMinute(30); blockPost.setEndAfter(10); blockPre.setAllowEventsOnDates(false); blockPost.setAllowEventsOnDates(false);For a D-Day calendar (which does not use actual dates (at least visibily)) a typical creation may look like this:
Calendar start = (Calendar) _ddayRootCalendar.clone(); Calendar end = (Calendar) start.clone(); end.add(Calendar.DATE, 50); GanttSpecialDateRange range = new GanttSpecialDateRange(_ganttChart, start, end); // these need to be set to indicate that the range should adapt to D-Day logic range.setFrequency(GanttSpecialDateRange.REPEAT_DDAY); range.setDDayRepeatInterval(10); // -- range.setRecurCount(50); range.setBackgroundColorTop(ColorCache.getRandomColor()); range.setBackgroundColorBottom(ColorCache.getRandomColor());
Modifier and Type | Field and Description |
---|---|
static int |
NO_END |
static int |
REPEAT_DAILY |
static int |
REPEAT_DDAY |
static int |
REPEAT_MONTHLY |
static int |
REPEAT_WEEKLY |
static int |
REPEAT_YEARLY |
Constructor and Description |
---|
GanttSpecialDateRange() |
GanttSpecialDateRange(GanttChart parent)
Creates a new Gantt Special Date Range that indicates a certain set of dates with colors.
|
GanttSpecialDateRange(GanttChart parent,
java.util.Calendar start,
java.util.Calendar end)
Creates a new Gantt Special Date Range that indicates a certain set of dates.
|
Modifier and Type | Method and Description |
---|---|
boolean |
addRecurDay(int day)
Adds a date that will be always used as a range date.
|
boolean |
canEventOccupy(java.util.Calendar start,
java.util.Calendar end)
Checks whether a set of dates overlap any of the dates in this range.
|
(package private) java.util.Calendar |
getActualEndDate() |
(package private) java.util.Calendar |
getActualStartDate() |
org.eclipse.swt.graphics.Color |
getBackgroundColorBottom()
Returns the gradient bottom color.
|
org.eclipse.swt.graphics.Color |
getBackgroundColorTop()
Returns the gradient top color.
|
(package private) java.util.List |
getBlocks() |
(package private) java.util.List |
getBlocks(java.util.Calendar start,
java.util.Calendar end) |
int |
getDDayRepeatInterval()
Returns the currently set DDay repeat interval.
|
java.util.Calendar |
getEnd()
Returns the end date.
|
int |
getEndAfter()
Returns the end after value that defines the number of recurring repetitions of the event.
|
int |
getEndHour()
Returns the end hour.
|
int |
getEndMinute()
Returns the end minute
|
int |
getFrequency()
Returns the frequency.
|
(package private) int |
getHighestRecurDate() |
GanttChart |
getParentChart()
Returns the chart that this range is associated with.
|
GanttComposite |
getParentComposite()
Returns the chart composite this range is associated with.
|
int |
getRecurCount()
Returns the "recurs every" value.
|
java.util.List |
getRecurDays()
Returns the list of currently set recurring days.
|
java.util.Calendar |
getStart()
Returns the start date.
|
int |
getStartHour()
Returns the start hour.
|
int |
getStartMinute()
Returns the start minute.
|
boolean |
isAllowEventsOnDates()
Whether events can be resized or dropped on the date range specified in this class.
|
(package private) boolean |
isUseable() |
(package private) boolean |
isVisible(java.util.Calendar start,
java.util.Calendar end) |
boolean |
removeRecurDay(int calDate)
Removes a set date.
|
void |
setAllowEventsOnDates(boolean allowEventsOnDates)
Sets whether events can be resized or dropped on to the date range specified in this class.
|
void |
setBackgroundColorBottom(org.eclipse.swt.graphics.Color backgroundColorBottom)
Sets the gradient bottom color.
|
void |
setBackgroundColorTop(org.eclipse.swt.graphics.Color backgroundColorTop)
Sets the gradient top color.
|
void |
setDDayRepeatInterval(int interval)
Sets the custom DDay repeat interval.
|
void |
setEnd(java.util.Calendar end)
Sets the end date.
|
void |
setEndAfter(int endAfter)
Sets how many times an event should re-occur and then end.
|
boolean |
setEndHour(int endHour)
Sets the end hour.
|
boolean |
setEndMinute(int endMinute)
Sets the end minute.
|
void |
setFrequency(int frequency)
Sets the repeat frequency.
|
void |
setParentChart(GanttChart parentChart) |
void |
setParentComposite(GanttComposite parentComposite) |
void |
setRecurCount(int recurMax)
How often this event re-occurs.
|
void |
setStart(java.util.Calendar start)
Sets the start date.
|
boolean |
setStartHour(int startHour)
Sets the start hour.
|
boolean |
setStartMinute(int startMinute)
Sets the start minute.
|
java.lang.String |
toString() |
public static final int REPEAT_DAILY
public static final int REPEAT_WEEKLY
public static final int REPEAT_MONTHLY
public static final int REPEAT_YEARLY
public static final int REPEAT_DDAY
public static final int NO_END
GanttSpecialDateRange()
public GanttSpecialDateRange(GanttChart parent)
parent
- Parent chartpublic GanttSpecialDateRange(GanttChart parent, java.util.Calendar start, java.util.Calendar end)
parent
- Parent chartstart
- Start dateend
- End datepublic java.util.Calendar getStart()
public void setStart(java.util.Calendar start)
start
- Start datepublic java.util.Calendar getEnd()
public void setEnd(java.util.Calendar end)
end
- End datepublic org.eclipse.swt.graphics.Color getBackgroundColorTop()
public void setBackgroundColorTop(org.eclipse.swt.graphics.Color backgroundColorTop)
backgroundColorTop
- Top color or null if none (transparent)public org.eclipse.swt.graphics.Color getBackgroundColorBottom()
public void setBackgroundColorBottom(org.eclipse.swt.graphics.Color backgroundColorBottom)
backgroundColorBottom
- Bottom color or null if none (transparent)public GanttChart getParentChart()
GanttChart
parentpublic GanttComposite getParentComposite()
GanttComposite
parentpublic boolean isAllowEventsOnDates()
public void setAllowEventsOnDates(boolean allowEventsOnDates)
allowEventsOnDates
- true if allowedpublic boolean addRecurDay(int day)
Calendar.MONDAY
. This is purely for convenience instead of having to create multiple special date ranges
to cover things such as weekends. Do note if you add specific hours, only the specified hour on the set days will
be covered and not the full day itself. If the frequency is set to 5 this method does
nothing and you should instead be using setDDayRepeatInterval(int)
as DDay calendars has no notion of
weekdates.day
- Calendar weekday to addpublic boolean removeRecurDay(int calDate)
calDate
- Date to removepublic int getFrequency()
public void setFrequency(int frequency)
REPEAT_DAILY
, REPEAT_MONTHLY
, REPEAT_WEEKLY
,
REPEAT_YEARLY
or REPEAT_DDAY
for DDay calendars.frequency
- Frequency to setpublic int getDDayRepeatInterval()
REPEAT_DDAY
.public void setDDayRepeatInterval(int interval)
REPEAT_DDAY
.interval
- Custom repeat interval of n DDayspublic int getRecurCount()
public void setRecurCount(int recurMax)
setEndAfter(int)
.recurMax
- Recurrence frequencypublic java.util.List getRecurDays()
public int getStartHour()
public boolean setStartHour(int startHour)
startHour
- start hourpublic int getStartMinute()
public boolean setStartMinute(int startMinute)
startMinute
- start minutepublic int getEndHour()
public boolean setEndHour(int endHour)
endHour
- end hourpublic int getEndMinute()
public boolean setEndMinute(int endMinute)
endMinute
- start minutepublic int getEndAfter()
public void setEndAfter(int endAfter)
NO_END
as value.endAfter
- After how many re-occurances to stop.public void setParentChart(GanttChart parentChart)
public void setParentComposite(GanttComposite parentComposite)
public boolean canEventOccupy(java.util.Calendar start, java.util.Calendar end)
start
- Start dateend
- End dateboolean isVisible(java.util.Calendar start, java.util.Calendar end)
java.util.Calendar getActualStartDate()
java.util.Calendar getActualEndDate()
java.util.List getBlocks()
java.util.List getBlocks(java.util.Calendar start, java.util.Calendar end)
int getHighestRecurDate()
boolean isUseable()
public java.lang.String toString()
toString
in class java.lang.Object