Source Code Cross Referenced for GroupFolder.java in  » Mail-Clients » columba-1.4 » org » columba » addressbook » folder » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Mail Clients » columba 1.4 » org.columba.addressbook.folder 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


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.folder;
019:
020:        import java.util.Hashtable;
021:        import java.util.Map;
022:
023:        import javax.swing.ImageIcon;
024:
025:        import org.columba.addressbook.config.FolderItem;
026:        import org.columba.addressbook.facade.IContactItem;
027:        import org.columba.addressbook.model.ContactModelFactory;
028:        import org.columba.addressbook.model.ContactModelPartial;
029:        import org.columba.addressbook.model.GroupModel;
030:        import org.columba.addressbook.model.IContactModel;
031:        import org.columba.addressbook.model.IContactModelPartial;
032:        import org.columba.addressbook.model.IGroupModel;
033:        import org.columba.api.command.IWorkerStatusController;
034:        import org.columba.api.exception.StoreException;
035:        import org.columba.core.resourceloader.IconKeys;
036:        import org.columba.core.resourceloader.ImageLoader;
037:        import org.columba.core.xml.XmlElement;
038:
039:        /**
040:         * Group folder storing a list of contact indices.
041:         * <p>
042:         * This can be seen as a filtered view of a contact folder. 
043:         * 
044:         * @author fdietz
045:         *  
046:         */
047:        public class GroupFolder extends AbstractFolder implements 
048:                IContactStorage, IGroupFolder {
049:
050:            private IGroupModel group;
051:
052:            private ImageIcon groupImageIcon = ImageLoader
053:                    .getSmallIcon(IconKeys.USER);
054:
055:            /**
056:             * @param name
057:             */
058:            public GroupFolder(String name, String dir) {
059:                super (name, dir);
060:
061:                group = new GroupModel();
062:            }
063:
064:            /**
065:             * @param item
066:             */
067:            public GroupFolder(FolderItem item) {
068:                super (item);
069:
070:                XmlElement property = item.getElement("property");
071:                XmlElement e = property.getElement("group");
072:                if (e == null) {
073:                    e = new XmlElement("group");
074:                    property.addElement(e);
075:                }
076:
077:                group = new GroupModel(e, getId());
078:            }
079:
080:            public void createChildren(IWorkerStatusController worker) {
081:            }
082:
083:            /**
084:             * @see org.columba.addressbook.folder.IContactStorage#add(IContactModel)
085:             */
086:            public String add(IContactModel contact) throws StoreException {
087:                String uid = contact.getId();
088:
089:                group.addMember(uid);
090:
091:                fireItemAdded(uid);
092:
093:                return uid;
094:            }
095:
096:            /**
097:             * @see org.columba.addressbook.folder.IContactStorage#count()
098:             */
099:            public int count() throws StoreException {
100:
101:                return group.count();
102:            }
103:
104:            /**
105:             * @see org.columba.addressbook.folder.IContactStorage#exists(java.lang.Object)
106:             */
107:            public boolean exists(String uid) throws StoreException {
108:
109:                return group.exists(uid);
110:            }
111:
112:            /**
113:             * @see org.columba.addressbook.folder.IContactStorage#get(java.lang.Object)
114:             */
115:            public IContactModel get(String uid) throws StoreException {
116:
117:                AbstractFolder parent = (AbstractFolder) getParent();
118:
119:                return parent.get(uid);
120:            }
121:
122:            /**
123:             * @see org.columba.addressbook.folder.IContactStorage#modify(java.lang.Object,
124:             *      IContactModel)
125:             */
126:            public void modify(String uid, IContactModel contact)
127:                    throws StoreException {
128:                AbstractFolder parent = (AbstractFolder) getParent();
129:
130:                parent.modify(uid, contact);
131:
132:                fireItemChanged(uid);
133:
134:            }
135:
136:            /**
137:             * @see org.columba.addressbook.folder.IContactStorage#remove(java.lang.Object)
138:             */
139:            public void remove(String uid) throws StoreException {
140:                group.remove(uid);
141:
142:                fireItemRemoved(uid);
143:            }
144:
145:            /**
146:             * @see org.columba.addressbook.folder.IContactStorage#getHeaderItemList()
147:             */
148:            public Map<String, IContactModelPartial> getContactItemMap()
149:                    throws StoreException {
150:                AbstractFolder parent = (AbstractFolder) getParent();
151:
152:                Map<String, IContactModelPartial> filter = new Hashtable<String, IContactModelPartial>();
153:
154:                String[] members = group.getMembers();
155:                for (int i = 0; i < members.length; i++) {
156:                    IContactModel c = parent.get(members[i]);
157:                    if (c == null) {
158:                        // contact doesn't exist in parent folder anymore
159:                        // -> remove it
160:
161:                        remove(members[i]);
162:                    } else {
163:                        IContactModelPartial item = ContactModelFactory
164:                                .createContactModelPartial(c, c.getId());
165:
166:                        filter.put(members[i], item);
167:                    }
168:                }
169:
170:                return filter;
171:            }
172:
173:            /**
174:             * @return Returns the group.
175:             */
176:            public IGroupModel getGroup() {
177:                return group;
178:            }
179:
180:            /**
181:             * @see org.columba.addressbook.folder.AddressbookTreeNode#getIcon()
182:             */
183:            public ImageIcon getIcon() {
184:                return groupImageIcon;
185:            }
186:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.