KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > columba > calendar > base > Activity


1 // The contents of this file are subject to the Mozilla Public License Version
2
// 1.1
3
//(the "License"); you may not use this file except in compliance with the
4
//License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
5
//
6
//Software distributed under the License is distributed on an "AS IS" basis,
7
//WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
8
//for the specific language governing rights and
9
//limitations under the License.
10
//
11
//The Original Code is "The Columba Project"
12
//
13
//The Initial Developers of the Original Code are Frederik Dietz and Timo
14
// Stich.
15
//Portions created by Frederik Dietz and Timo Stich are Copyright (C) 2003.
16
//
17
//All Rights Reserved.
18
package org.columba.calendar.base;
19
20 import java.beans.PropertyVetoException JavaDoc;
21 import java.util.Calendar JavaDoc;
22
23 import org.columba.calendar.base.api.IActivity;
24
25 import com.miginfocom.util.PropertyKey;
26
27 public class Activity implements IActivity {
28
29     private com.miginfocom.calendar.activity.Activity wrapped;
30     
31     public Activity(com.miginfocom.calendar.activity.Activity wrapped) {
32         super();
33
34         this.wrapped = wrapped;
35     }
36
37     public String JavaDoc getId() {
38         return (String JavaDoc) wrapped.getID();
39     }
40
41     public String JavaDoc getProperty(String JavaDoc propertyKey) {
42         Object JavaDoc value = wrapped.getProperty(PropertyKey.getKey(propertyKey));
43
44         return (String JavaDoc) value;
45     }
46
47     public void setProperty(String JavaDoc propertyKey, String JavaDoc propertyValue) {
48
49         try {
50             // enabled event-firing
51
wrapped.setProperty(PropertyKey.getKey(propertyKey), propertyValue,
52                     Boolean.TRUE);
53         } catch (PropertyVetoException JavaDoc e) {
54             throw new IllegalArgumentException JavaDoc("illegal argument", e);
55         }
56     }
57
58     public String JavaDoc getSummary() {
59         return wrapped.getSummary();
60     }
61
62     public Calendar JavaDoc getDtStart() {
63         return wrapped.getDateRangeForReading().getStart();
64     }
65
66     public Calendar JavaDoc getDtEnd() {
67         return wrapped.getDateRangeForReading().getEnd(true);
68     }
69
70     public String JavaDoc getCalendarId() {
71         // we currently only support a single category per activity
72
Object JavaDoc[] categories = wrapped.getCategoryIDs();
73         
74         return (String JavaDoc) categories[0];
75     }
76
77 }
78
Popular Tags