KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > columba > addressbook > facade > HeaderItem


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.addressbook.facade;
19
20 /**
21  * Convenience class implementation of IHeaderItem. This implementation class can be used by clients
22  * of the addressbook facade if desired, or can be implemented differently, if necessary.
23  */

24 public class HeaderItem implements IHeaderItem {
25
26     private String JavaDoc id;
27
28     private String JavaDoc name;
29
30     private String JavaDoc description;
31
32     private boolean contact;
33
34     public HeaderItem() {
35         
36     }
37     
38     public HeaderItem(boolean contact) {
39         this.contact = contact;
40     }
41
42     public HeaderItem(String JavaDoc id, boolean contact) {
43         if (id == null)
44             throw new IllegalArgumentException JavaDoc("id == null");
45
46         this.id = id;
47         this.contact = contact;
48     }
49
50     /**
51      * @param id
52      * contact unique id as generated by contact store
53      * @param name
54      * displayname
55      * @param description
56      * description, can be used as tooltip
57      * @param contact
58      * true, if a contact item. False, otherwise.
59      */

60     public HeaderItem(String JavaDoc id, String JavaDoc name, String JavaDoc description,
61             boolean contact) {
62         this(id, contact);
63         
64         if (name == null)
65             throw new IllegalArgumentException JavaDoc("name == null");
66         if (description == null)
67             throw new IllegalArgumentException JavaDoc("description == null");
68
69         this.name = name;
70         this.description = description;
71     }
72
73     public String JavaDoc getId() {
74         return id;
75     }
76
77     /* (non-Javadoc)
78      * @see org.columba.addressbook.facade.IHeaderItem#setId(java.lang.String)
79      */

80     public void setId(String JavaDoc id) {
81         this.id = id;
82     }
83
84     public String JavaDoc getName() {
85         return name;
86     }
87
88     public String JavaDoc getDescription() {
89         return description;
90     }
91
92     public boolean isContact() {
93         return contact;
94     }
95
96     public void setName(String JavaDoc name) {
97         this.name = name;
98     }
99
100     public void setDescription(String JavaDoc description) {
101         this.description = description;
102     }
103
104     public Object JavaDoc clone() {
105         IHeaderItem item = null;
106         try {
107             item = (IHeaderItem)super.clone();
108         } catch (CloneNotSupportedException JavaDoc e) {
109             // This should never happen since superclass is Object
110
e.printStackTrace();
111         }
112         return item;
113     }
114 }
115
Popular Tags