Search
Schedule Items

Events scheduled to occur at an appointed time are represented by instances of the Item class. Item comprises the information that completely defines a schedule items. For example, the getStartTime and getEndTime methods specify the time and duration of an item. The setRecurrence method lets you create items that occur repeatedly following a specific recurrence pattern. There are several methods that provide additional information about an item, such as getPriority, getHeaderText and getDescriptionText. The class also defines methods that support serialization in XML.

It is possible to associate resources with items via the Resources and Contacts collections or the setLocation and setTask methods of Item. The resources that can be associated with an item are instances of the Resource, Contact, Location, and Task classes respectively.

The appearance of an item when displayed in a view is specified through several Style objects. These style objects are associated with the item through the setStyle, setSelectedStyle, setPointedStyle, and setPointedSelectedStyle methods. Each of the styles lets you define various aspects of the item appearance, such as color, font, and alignment.

The abstract class Item is inherited by the concrete class Appointment, which can be readily used in your applications. You could also define your own item classes, which derive either from Appointment or Item. In order to integrate your custom class into the calendar API and user interface, you must do the following:

  • Provide parameterless constructor to let users create items of the custom class interactively;
  • Override the saveTo / loadFrom methods if you have any additional data fields in your custom class and register the class for serialization using the Schedule.registerItemClass method;
  • Override copyOccurrence to support recurrence of the custom item. Also ensure you call markException on the associated recurrence whenever a custom property of the new item changes.

Tutorial 3: Creating Custom Appointment Classes demonstrates in details how to implement custom items.