The ZK Calendar Component"
Line 1: | Line 1: | ||
{{ZKCalendarEssentialsPageHeader}} | {{ZKCalendarEssentialsPageHeader}} | ||
===The ZK Calendar Component=== | ===The ZK Calendar Component=== | ||
+ | In this section, a brief overview is given on how developers work with the ZK Calendar component. | ||
====The Bare Calendar Component==== | ====The Bare Calendar Component==== | ||
+ | ---- | ||
ZK Calendar is a single ZK component. Developers could declare it within any ZK container components, such as Window, tabs, groupbox, etc. | ZK Calendar is a single ZK component. Developers could declare it within any ZK container components, such as Window, tabs, groupbox, etc. | ||
+ | |||
For example:<br> | For example:<br> | ||
<source lang="xml"> | <source lang="xml"> | ||
Line 12: | Line 15: | ||
</window> | </window> | ||
</source> | </source> | ||
+ | which renders:<br/> | ||
+ | [[Image: bareCalendar.png]] | ||
+ | The bare <calendars> declaration takes the following default values: | ||
+ | <calendars firstDayOfWeek="Sunday" mold="default" > | ||
+ | |||
+ | |||
+ | ====Calendar Component Attributes==== | ||
+ | ---- | ||
+ | Developers customize the calendars component by declaring its attributes, for example: | ||
+ | *the first day of week to be displayed on the calendar, by default: firstDayOfWeek="Sunday" | ||
+ | *the default mold (mold="default") displays a "date-time" format in which it displays hours of the day and days of a week ; the monthly mold (mold="monthly") displays the days in a month | ||
+ | *the time zone, for example: timeZone="Finland=GMT+2" | ||
+ | *size of the calendar component, for example: width="400px" height="600px" | ||
+ | |||
+ | |||
+ | ====Triggered Calendar Events==== | ||
+ | ---- | ||
+ | The calendar component triggers three events when users select time slots on ZK Calendar: | ||
+ | *onEventCreate | ||
+ | *onEventEdit | ||
+ | *onEventUpdate | ||
+ | Developers implement the corresponding event listeners to allow writing, editing, and updating (time updates) of calendar events (appointments) to data models. These methods pass the <javadoc>org.zkoss.calendar.event.CalendarsEvent</javadoc> object to the event listeners and information such as begin date and end date of the selected time slot. | ||
+ | |||
+ | ====Calendar Event Data Objects==== | ||
+ | ---- | ||
+ | Developers implement the <javadoc type="interface">org.zkoss.calendar.api.CalendarEvent</javadoc> interface, or use the default implementation <javadoc>org.zkoss.calendar.impl.SimpleCalendarEvent</javadoc> to set information just as begin date and end date to the event data object after retrieving such information from the <javadoc>org.zkoss.calendar.event.CalendarsEvent</javadoc>. | ||
+ | |||
+ | ====Calendar Event Date Model==== | ||
+ | ---- | ||
+ | Developers implement the <javadoc type="interface">org.zkoss.calendar.api.CalendarModel</javadoc> interface, or use the default implementation <javadoc>org.zkoss.calendar.impl.SimpleCalendarModel/javadoc> to store event data objects | ||
+ | |||
+ | |||
+ | |||
− | |||
{{ZKCalendarEssentialsPageFooter}} | {{ZKCalendarEssentialsPageFooter}} |
Revision as of 04:42, 12 March 2010
The ZK Calendar Component
In this section, a brief overview is given on how developers work with the ZK Calendar component.
The Bare Calendar Component
ZK Calendar is a single ZK component. Developers could declare it within any ZK container components, such as Window, tabs, groupbox, etc.
For example:
<window title="Bare ZK Calendar" border="normal">
<calendars>
</calendars>
</window>
which renders:
The bare <calendars> declaration takes the following default values:
<calendars firstDayOfWeek="Sunday" mold="default" >
Calendar Component Attributes
Developers customize the calendars component by declaring its attributes, for example:
- the first day of week to be displayed on the calendar, by default: firstDayOfWeek="Sunday"
- the default mold (mold="default") displays a "date-time" format in which it displays hours of the day and days of a week ; the monthly mold (mold="monthly") displays the days in a month
- the time zone, for example: timeZone="Finland=GMT+2"
- size of the calendar component, for example: width="400px" height="600px"
Triggered Calendar Events
The calendar component triggers three events when users select time slots on ZK Calendar:
- onEventCreate
- onEventEdit
- onEventUpdate
Developers implement the corresponding event listeners to allow writing, editing, and updating (time updates) of calendar events (appointments) to data models. These methods pass the CalendarsEvent object to the event listeners and information such as begin date and end date of the selected time slot.
Calendar Event Data Objects
Developers implement the CalendarEvent interface, or use the default implementation SimpleCalendarEvent to set information just as begin date and end date to the event data object after retrieving such information from the CalendarsEvent.
Calendar Event Date Model
Developers implement the CalendarModel interface, or use the default implementation <javadoc>org.zkoss.calendar.impl.SimpleCalendarModel/javadoc> to store event data objects
The example project is at Github