public class Recurrence
extends java.lang.Object
implements java.lang.Cloneable
Constructor and Description |
---|
Recurrence()
Initializes a new instance of the
Recurrence class. |
Modifier and Type | Method and Description |
---|---|
void |
addRecurrenceListener(RecurrenceListener listener)
Adds a
RecurrenceListener to the recurrence. |
void |
applyPattern(Recurrence recurrence)
Copies the fields of the specified
Recurrence object to this recurrence. |
void |
clearExceptions()
Removes all exceptions of this recurrence.
|
Recurrence |
clone()
Creates an exact copy of this
Recurrence object. |
ItemList |
generateItems(DateTime startDate,
DateTime endDate)
Creates occurrence items for this recurrence in the specified date range.
|
DailyRecurrence |
getDailyRecurrence()
Gets the type of daily recurrence.
|
DayOfWeekType |
getDay()
Gets a value indicating on which day of a week the event occurs.
|
int |
getDayOfMonth()
Gets on which day of a month the event occurs.
|
int |
getDays()
Gets how many days should pass before the event occurs again.
|
java.util.EnumSet<DayOfWeek> |
getDaysOfWeek()
Gets on which days of a week the event occurs.
|
DateTime |
getEffectiveEndDate()
Returns the effective end date for this recurrence.
|
DateTime |
getEndDate()
Gets the end date of the recurrence.
|
java.util.Collection<RecurrenceException> |
getExceptions()
Gets the list of all recurrence exceptions.
|
Duration |
getInterval()
Gets the recurrence interval.
|
Item |
getMaster()
Gets the master item of this recurrence.
|
MonthlyRecurrence |
getMonthlyRecurrence()
Gets the type of monthly recurrence.
|
int |
getMonthOfYear()
Gets in which month of the year the event occurs.
|
int |
getMonths()
Gets how many months should pass before the event occurs again.
|
int |
getNumOccurrences()
Gets how many times the recurring event should occur.
|
Occurrence |
getOccurrence()
Gets on which occurrence of the day type specified in
getDay() the event occurs. |
Item |
getOccurrence(int index)
Returns the occurrence having the specified index.
|
Item |
getOccurrence(int index,
ByRef<java.lang.Boolean> isDeleted)
Returns the occurrence having the specified index.
|
Item |
getOccurrence(int index,
ByRef<java.lang.Boolean> isDeleted,
boolean noException)
Returns the occurrence having the specified index.
|
RecurrencePattern |
getPattern()
Gets the recurrence pattern.
|
RecurrenceEnd |
getRecurrenceEnd()
Gets when the event should stop recurring.
|
DateTime |
getStartDate()
Gets when the recurring event should occur for the first time.
|
int |
getWeeks()
Gets how many weeks should pass before the event occurs again.
|
YearlyRecurrence |
getYearlyRecurrence()
Gets the type of yearly recurrence.
|
void |
loadFrom(org.w3c.dom.Element element,
XmlSerializationContext context)
Loads the recurrence data from an XML document.
|
void |
loadFrom(JsonObject obj,
JsonSerializationContext context)
Loads the recurrence from a JSON object.
|
void |
markException(Item item,
boolean deleted)
Marks the specified item as an exception of a recurrence pattern.
|
protected void |
onValidateOccurrence(ValidateOccurrenceEvent e)
Raises the
validateOccurrence event. |
void |
removeException(Item item)
Removes the exception associated with the specified item
from the recurrence.
|
void |
removeRecurrenceListener(RecurrenceListener listener)
Removes the specified
RecurrenceListener from the recurrence. |
void |
reschedule(Item occurrence,
DateTime oldDate)
Changes the recurrence pattern so that the specified occurrence remains
part of the recurrence without changing it into an exception.
|
boolean |
samePatternAs(Recurrence recurrence)
Determines whether two Recurrence objects define the same
recurrence pattern.
|
void |
saveTo(org.w3c.dom.Element element,
XmlSerializationContext context)
Saves the recurrence data to an XML document.
|
void |
saveTo(JsonObject obj,
JsonSerializationContext context)
Saves the recurrence as a JSON object.
|
void |
setDailyRecurrence(DailyRecurrence value)
Sets the type of daily recurrence.
|
void |
setDay(DayOfWeekType value)
Sets a value indicating on which day of a week the event occurs.
|
void |
setDayOfMonth(int value)
Sets on which day of a month the event occurs.
|
void |
setDays(int value)
Sets how many days should pass before the event occurs again.
|
void |
setDaysOfWeek(java.util.EnumSet<DayOfWeek> value)
Sets on which days of a week the event occurs.
|
void |
setEndDate(DateTime value)
Sets the end date of the recurrence.
|
void |
setInterval(Duration value)
Sets the recurrence interval.
|
void |
setMonthlyRecurrence(MonthlyRecurrence value)
Sets the type of monthly recurrence.
|
void |
setMonthOfYear(int value)
Sets in which month of the year the event occurs.
|
void |
setMonths(int value)
Sets how many months should pass before the event occurs again.
|
void |
setNumOccurrences(int value)
Sets how many times the recurring event should occur.
|
void |
setOccurrence(Occurrence value)
Sets on which occurrence of the day type specified in
getDay() the event occurs. |
void |
setPattern(RecurrencePattern value)
Sets the recurrence pattern.
|
void |
setRecurrenceEnd(RecurrenceEnd value)
Sets when the event should stop recurring.
|
void |
setStartDate(DateTime value)
Sets when the recurring event should occur for the first time.
|
void |
setWeeks(int value)
Sets how many weeks should pass before the event occurs again.
|
void |
setYearlyRecurrence(YearlyRecurrence value)
Sets the type of yearly recurrence.
|
java.lang.String |
toString()
Creates a string from this recurrence using the default locale.
|
java.lang.String |
toString(java.util.Locale locale)
Creates a string from this recurrence using the specified date
and time formatting.
|
public Recurrence()
Recurrence
class.public java.lang.String toString(java.util.Locale locale)
locale
- The desired locale of the resulting string.public java.lang.String toString()
toString
in class java.lang.Object
public Recurrence clone()
Recurrence
object.clone
in class java.lang.Object
Recurrence
object, cloned from this one.public boolean samePatternAs(Recurrence recurrence)
recurrence
- A Recurrence
object to compare with this recurrence.public void applyPattern(Recurrence recurrence)
Recurrence
object to this recurrence.
This method behaves similarly to the clone()
method except that it
does not create a new object.
recurrence
- The Recurrence
object whose fields to copy.public DateTime getEffectiveEndDate()
The end date is calculated from the specified repeat number if
RecurrenceEnd
is set to
NumOccurrences
.
DateTime.MaxValue
otherwise.public void saveTo(org.w3c.dom.Element element, XmlSerializationContext context)
The recurrence properties are saved as elements of an XML
document, and can be later restored using the loadFrom(org.w3c.dom.Element, com.mindfusion.scheduling.model.XmlSerializationContext)
method.
element
- Allows adding data to the XML document.context
- The context object contains the file format revision number
of the schedule being loaded. It also provides methods that
facilitate reading and writing various data types from and
to the XML document.public void loadFrom(org.w3c.dom.Element element, XmlSerializationContext context)
Loads the state of a recurrence from an XML document, where it
was previously saved via saveTo(org.w3c.dom.Element, com.mindfusion.scheduling.model.XmlSerializationContext)
.
element
- Allows reading data from the XML document.context
- The context object contains the file format revision number
of the schedule being loaded. It also provides methods that
facilitate reading and writing various data types from and
to the XML document.public void saveTo(JsonObject obj, JsonSerializationContext context)
obj
- A JsonObject instance to contain the serialized data.context
- A JsonSerializationContext object providing contextual information about the serialization process and helper serialization methods.public void loadFrom(JsonObject obj, JsonSerializationContext context)
obj
- A JsonObject containing the recurrence data.context
- A JsonSerializationContext object providing contextual information about the serialization process and helper serialization methods.protected void onValidateOccurrence(ValidateOccurrenceEvent e)
validateOccurrence
event.e
- An object, containing the event data.public Item getOccurrence(int index)
This function might take considerable amount of time if you specify a large index in an infinite recurrence.
index
- The index of the occurrence to retrieve.public Item getOccurrence(int index, ByRef<java.lang.Boolean> isDeleted)
This function might take considerable amount of time if you specify a large index in an infinite recurrence.
index
- The index of the occurrence to retrieve.isDeleted
- If the specified occurrence is an exception,
this parameter contains upon function completion whether
the exception is deleted or not.public Item getOccurrence(int index, ByRef<java.lang.Boolean> isDeleted, boolean noException)
This function might take considerable amount of time if you specify a large index in an infinite recurrence.
index
- The index of the occurrence to retrieve.isDeleted
- If the specified occurrence is an exception,
this parameter contains upon function completion whether
the exception is deleted or not.noException
- Specifies whether to return the original item,
in case this occurrence is an exception.public void reschedule(Item occurrence, DateTime oldDate)
public ItemList generateItems(DateTime startDate, DateTime endDate)
startDate
- The range start date.endDate
- The range end date.Item
instances representing each occurrence
of the recurrent event in the specified date range.public void clearExceptions()
public void markException(Item item, boolean deleted)
item
- The Item
instance to be marked as an exception.deleted
- Specifies whether the exception is created by deleting
one occurrence from the recurrent pattern or by changing the
properties of the occurrence.public void removeException(Item item)
public RecurrencePattern getPattern()
RecurrencePattern
constants.public void setPattern(RecurrencePattern value)
value
- One of the RecurrencePattern
constants.public DailyRecurrence getDailyRecurrence()
This value is used when the recurrence pattern is set to RecurrencePattern.Daily
.
DailyRecurrence
constants.public void setDailyRecurrence(DailyRecurrence value)
value
- One of the DailyRecurrence
constants.public MonthlyRecurrence getMonthlyRecurrence()
This value is used when the recurrence getPattern()
is Monthly
.
MonthlyRecurrence
constants.public void setMonthlyRecurrence(MonthlyRecurrence value)
This value is used when the recurrence getPattern()
is Monthly
.
value
- One of the MonthlyRecurrence
constants.public YearlyRecurrence getYearlyRecurrence()
This value is used when the recurrence getPattern()
is Yearly
.
YearlyRecurrence
constants.public void setYearlyRecurrence(YearlyRecurrence value)
This value is used when the recurrence getPattern()
is Yearly
.
value
- One of the YearlyRecurrence
constants.public int getDays()
This value is used when the recurrence getPattern()
is Daily
.
public void setDays(int value)
This value is used when the recurrence getPattern()
is Daily
.
value
- An integer value specifying the number of days between event occurrences.
The minimal allowed value is 1.public int getDayOfMonth()
This value is used when the recurrence getPattern()
is
Monthly
or Yearly
.
public void setDayOfMonth(int value)
This value is used when the recurrence getPattern()
is
Monthly
or Yearly
.
value
- An integer value specifying at which day of the month the recurring event occurs.
The allowed values range from 1 to 31.public int getWeeks()
This value is used when the recurrence getPattern()
is Weekly
.
public void setWeeks(int value)
This value is used when the recurrence getPattern()
is Weekly
.
value
- An integer value specifying the number of weeks between event occurrences.
The minimal allowed value is 1.public java.util.EnumSet<DayOfWeek> getDaysOfWeek()
This value is used when the recurrence getPattern()
is Weekly
.
DayOfWeek
constants.public void setDaysOfWeek(java.util.EnumSet<DayOfWeek> value)
This value is used when the recurrence getPattern()
is Weekly
.
value
- One or more of the DayOfWeek
constants.public int getMonths()
This value is used when the recurrence getPattern()
is Monthly
.
public void setMonths(int value)
This value is used when the recurrence getPattern()
is Monthly
.
value
- An integer value specifying the number of days between event occurrences.
The minimal allowed value is 1.public int getMonthOfYear()
This value is used when the recurrence getPattern()
is Yearly
.
public void setMonthOfYear(int value)
This value is used when the recurrence getPattern()
is Yearly
.
value
- An integer value specifying at which month the event occurs.
The allowed values range from 1 to 12.public Occurrence getOccurrence()
getDay()
the event occurs.
This value is used when the recurrence getPattern()
is
Monthly
or Yearly
and getMonthlyRecurrence()
or getYearlyRecurrence()
are ByDayType.
Occurrence
constants.public void setOccurrence(Occurrence value)
getDay()
the event occurs.
This value is used when the recurrence getPattern()
is
Monthly
or Yearly
and getMonthlyRecurrence()
or getYearlyRecurrence()
are ByDayType.
value
- One of the Occurrence
constants.public DayOfWeekType getDay()
This value is used when the recurrence getPattern()
is
Monthly
or Yearly
and getMonthlyRecurrence()
or getYearlyRecurrence()
are ByDayType.
DayOfWeekType
constants.public void setDay(DayOfWeekType value)
This value is used when the recurrence getPattern()
is
Monthly
or Yearly
and getMonthlyRecurrence()
or getYearlyRecurrence()
are ByDayType.
value
- One of the DayOfWeekType
constants.public Duration getInterval()
This value is used when the recurrence getPattern()
is
ByTimeInterval
.
Duration
value indicating the time interval between recurring items.public void setInterval(Duration value)
This value is used when the recurrence getPattern()
is
ByTimeInterval
.
value
- A Duration
value indicating the time interval between recurring items.public DateTime getStartDate()
The time properties set in a recurrence object override the time properties of
a schedule item to which the recurrence is assigned. The Calendar
component displays "occurrence" items corresponding to the recurring master item.
The first occurrence is displayed in the date cell specified in this property.
DateTime
object specifying the recurrence start date.public void setStartDate(DateTime value)
The time properties set in a recurrence object override the time properties of
a schedule item to which the recurrence is assigned. The Calendar
component displays "occurrence" items corresponding to the recurring master item.
The first occurrence is displayed in the date cell specified in this property.
value
- A DateTime
object specifying the recurrence start date.public RecurrenceEnd getRecurrenceEnd()
RecurrenceEnd
constants.public void setRecurrenceEnd(RecurrenceEnd value)
value
- One of the RecurrenceEnd
constants.public int getNumOccurrences()
public void setNumOccurrences(int value)
value
- An integer value specifying the number of occurrences.
The allowed values range from 1 to 999.public DateTime getEndDate()
This value is considered by the recurrence only if
getRecurrenceEnd()
is EndDate
.
DateTime
object specifying the end date of the recurring event.public void setEndDate(DateTime value)
This value is considered by the recurrence only if
getRecurrenceEnd()
is EndDate
.
value
- A DateTime
object specifying the end date of the recurring event.public java.util.Collection<RecurrenceException> getExceptions()
public Item getMaster()
To associate a recurrence with an item, pass a reference to a
Recurrence
object to the item's Item.setRecurrence(com.mindfusion.scheduling.model.Recurrence)
method.
public void addRecurrenceListener(RecurrenceListener listener)
RecurrenceListener
to the recurrence.listener
- The RecurrenceListener
to be added.public void removeRecurrenceListener(RecurrenceListener listener)
RecurrenceListener
from the recurrence.listener
- The listener to be removed.