The calendar may also use a special data model to provide data for element rendering. You can re-define the default calendar model using the dataModel attribute and point to an object that implements the CalendarDataModel interface.

In this example we are using a custom data model to implement the following rules:

- Weekend days are disabled and use bold and italic text style.
- Tuesdays and Thursdays are disabled, and grayed out to represent busy days.
- All the values in the past are disabled and styled as boundary dates.

There are two primary interfaces that make up the calendar data model.

CalendarDataModel:

- CalendarDataModelItem[] getData(Date[]) is called every time when components need the next block of CalendarDataItems. That may happen when the calendar is rendered, or when you navigate to the next/previous month or in any other case when the calendar is rendered. This method is called in Ajax mode when the calendar renders for a new page.

CalendarDataModelItem:

- Boolean isEnabled() returns "true" if date is "selectable" on the calendar, the default implementation returns "true"
- String getStyleClass() returns "String" that is appended to a style class for the date span. For example it may be "relevant holiday" that means a class looks like "rich-cal-day relevant holiday". The default implementation returns an empty string.