01: package com.xoetrope.swing.date;
02:
03: import com.xoetrope.swing.date.XAppointment;
04: import java.util.Calendar;
05:
06: /**
07: * An interface used by the XCalendarPanel to find appointments
08: *
09: * <p> Copyright (c) Xoetrope Ltd., 2001-2006, This software is licensed under
10: * the GNU Public License (GPL), please see license.txt for more details. If
11: * you make commercial use of this software you must purchase a commercial
12: * license from Xoetrope.</p>
13: * <p> $Revision: 1.2 $</p>
14: */
15: public interface XAppointmentProvider {
16: /**
17: * Get the appoints for a particular date
18: * <html>
19: * <pre>
20: public XAppointment[] getAppointments( Calendar c )
21: {
22: int dayOfMonth = c.get( Calendar.DAY_OF_MONTH );
23: if (( dayOfMonth == 18 ) || ( dayOfMonth == 1 )){
24: XAppointment events[] = new XAppointment[ 2 ];
25: events[ 0 ] = new XAppointment();
26: events[ 0 ].bkColor = new Color( 252, 231, 255, 128 );
27: events[ 0 ].fgColor = Color.black;
28: events[ 0 ].title = ( dayOfMonth == 6 ) ? "Breakfast with Basil Faulty" : "Meet John Doe";
29: Calendar start = (Calendar)calendar.clone();
30: start.set( Calendar.HOUR_OF_DAY, 8 );
31: start.set( Calendar.MINUTE, 0 );
32: events[ 0 ].startTime = start;
33: Calendar end = (Calendar)start.clone();
34: end.set( Calendar.MINUTE, 45 );
35: events[ 0 ].endTime = end;
36:
37: events[ 1 ] = new XAppointment();
38: events[ 1 ].bkColor = new Color( 231, 231, 255, 128 );
39: events[ 1 ].fgColor = Color.black;
40: events[ 1 ].title = ( dayOfMonth == 6 ) ? "Lunch" : "Conference call";
41: start = (Calendar)calendar.clone();
42: start.set( Calendar.HOUR_OF_DAY, 12 );
43: start.set( Calendar.MINUTE, 5 );
44: events[ 1 ].startTime = start;
45: end = (Calendar)start.clone();
46: end.set( Calendar.HOUR_OF_DAY, 13 );
47: end.set( Calendar.MINUTE, 45 );
48: events[ 1 ].endTime = end;
49: return events;
50: }
51: return new XAppointment[ 0 ];
52: }
53: * </pre>
54: * </html>
55: */
56: public XAppointment[] getAppointments(Calendar c);
57: }
|