001: // The contents of this file are subject to the Mozilla Public License Version
002: // 1.1
003: //(the "License"); you may not use this file except in compliance with the
004: //License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
005: //
006: //Software distributed under the License is distributed on an "AS IS" basis,
007: //WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
008: //for the specific language governing rights and
009: //limitations under the License.
010: //
011: //The Original Code is "The Columba Project"
012: //
013: //The Initial Developers of the Original Code are Frederik Dietz and Timo
014: // Stich.
015: //Portions created by Frederik Dietz and Timo Stich are Copyright (C) 2003.
016: //
017: //All Rights Reserved.
018: package org.columba.addressbook.facade;
019:
020: /**
021: * Convenience class implementation of IHeaderItem. This implementation class can be used by clients
022: * of the addressbook facade if desired, or can be implemented differently, if necessary.
023: */
024: public class HeaderItem implements IHeaderItem {
025:
026: private String id;
027:
028: private String name;
029:
030: private String description;
031:
032: private boolean contact;
033:
034: public HeaderItem() {
035:
036: }
037:
038: public HeaderItem(boolean contact) {
039: this .contact = contact;
040: }
041:
042: public HeaderItem(String id, boolean contact) {
043: if (id == null)
044: throw new IllegalArgumentException("id == null");
045:
046: this .id = id;
047: this .contact = contact;
048: }
049:
050: /**
051: * @param id
052: * contact unique id as generated by contact store
053: * @param name
054: * displayname
055: * @param description
056: * description, can be used as tooltip
057: * @param contact
058: * true, if a contact item. False, otherwise.
059: */
060: public HeaderItem(String id, String name, String description,
061: boolean contact) {
062: this (id, contact);
063:
064: if (name == null)
065: throw new IllegalArgumentException("name == null");
066: if (description == null)
067: throw new IllegalArgumentException("description == null");
068:
069: this .name = name;
070: this .description = description;
071: }
072:
073: public String getId() {
074: return id;
075: }
076:
077: /* (non-Javadoc)
078: * @see org.columba.addressbook.facade.IHeaderItem#setId(java.lang.String)
079: */
080: public void setId(String id) {
081: this .id = id;
082: }
083:
084: public String getName() {
085: return name;
086: }
087:
088: public String getDescription() {
089: return description;
090: }
091:
092: public boolean isContact() {
093: return contact;
094: }
095:
096: public void setName(String name) {
097: this .name = name;
098: }
099:
100: public void setDescription(String description) {
101: this .description = description;
102: }
103:
104: public Object clone() {
105: IHeaderItem item = null;
106: try {
107: item = (IHeaderItem) super .clone();
108: } catch (CloneNotSupportedException e) {
109: // This should never happen since superclass is Object
110: e.printStackTrace();
111: }
112: return item;
113: }
114: }
|