01: // The contents of this file are subject to the Mozilla Public License Version
02: // 1.1
03: //(the "License"); you may not use this file except in compliance with the
04: //License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
05: //
06: //Software distributed under the License is distributed on an "AS IS" basis,
07: //WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
08: //for the specific language governing rights and
09: //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;
21: import java.util.Calendar;
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 getId() {
38: return (String) wrapped.getID();
39: }
40:
41: public String getProperty(String propertyKey) {
42: Object value = wrapped.getProperty(PropertyKey
43: .getKey(propertyKey));
44:
45: return (String) value;
46: }
47:
48: public void setProperty(String propertyKey, String propertyValue) {
49:
50: try {
51: // enabled event-firing
52: wrapped.setProperty(PropertyKey.getKey(propertyKey),
53: propertyValue, Boolean.TRUE);
54: } catch (PropertyVetoException e) {
55: throw new IllegalArgumentException("illegal argument", e);
56: }
57: }
58:
59: public String getSummary() {
60: return wrapped.getSummary();
61: }
62:
63: public Calendar getDtStart() {
64: return wrapped.getDateRangeForReading().getStart();
65: }
66:
67: public Calendar getDtEnd() {
68: return wrapped.getDateRangeForReading().getEnd(true);
69: }
70:
71: public String getCalendarId() {
72: // we currently only support a single category per activity
73: Object[] categories = wrapped.getCategoryIDs();
74:
75: return (String) categories[0];
76: }
77:
78: }
|