Source Code Cross Referenced for DefaultAddressbookImporter.java in  » Mail-Clients » columba-1.4 » org » columba » addressbook » folder » importfilter » 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.importfilter 
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:
019:        package org.columba.addressbook.folder.importfilter;
020:
021:        import java.io.File;
022:
023:        import javax.swing.JOptionPane;
024:
025:        import org.columba.addressbook.folder.AbstractFolder;
026:        import org.columba.addressbook.model.IContactModel;
027:        import org.columba.addressbook.util.AddressbookResourceLoader;
028:        import org.columba.api.plugin.IExtensionInterface;
029:        import org.columba.core.gui.frame.FrameManager;
030:
031:        /**
032:         * Abstract base class for addressbook data importers.
033:         */
034:        public abstract class DefaultAddressbookImporter implements 
035:                IExtensionInterface {
036:            public static int TYPE_FILE = 0;
037:
038:            public static int TYPE_DIRECTORY = 1;
039:
040:            protected AbstractFolder destinationFolder;
041:
042:            protected File sourceFile;
043:
044:            // protected AddressbookFolder tempFolder;
045:            protected int counter;
046:
047:            public DefaultAddressbookImporter() {
048:            }
049:
050:            public DefaultAddressbookImporter(File sourceFile,
051:                    AbstractFolder destinationFolder) {
052:                this .sourceFile = sourceFile;
053:                this .destinationFolder = destinationFolder;
054:            }
055:
056:            public void init() {
057:                counter = 0;
058:
059:                // tempFolder = new AddressbookFolder(null,addressbookInterface);
060:            }
061:
062:            /** ********* override the following messages ************************* */
063:            /**
064:             * override this method to specify type the wizard dialog will open the
065:             * correct file/directory dialog automatically
066:             */
067:            public int getType() {
068:                return TYPE_FILE;
069:            }
070:
071:            /**
072:             * enter a description which will be shown to the user here
073:             */
074:            public String getDescription() {
075:                return "";
076:            }
077:
078:            /**
079:             * this method does all the import work
080:             */
081:            public abstract void importAddressbook(File file) throws Exception;
082:
083:            public void setSourceFile(File file) {
084:                this .sourceFile = file;
085:            }
086:
087:            /**
088:             * set destination folder
089:             */
090:            public void setDestinationFolder(AbstractFolder folder) {
091:                destinationFolder = folder;
092:            }
093:
094:            /**
095:             * counter for successfully imported messages
096:             */
097:            public int getCount() {
098:                return counter;
099:            }
100:
101:            /**
102:             * this method calls your overridden importMailbox(File)-method and handles
103:             * exceptions
104:             */
105:            public void run() {
106:                try {
107:                    importAddressbook(sourceFile);
108:                } catch (Exception ex) {
109:                    JOptionPane.showMessageDialog(FrameManager.getInstance()
110:                            .getActiveFrame(), AddressbookResourceLoader
111:                            .getString("dialog", "addressbookimport",
112:                                    "addressbook_import_failed"), "",
113:                            JOptionPane.ERROR_MESSAGE);
114:                    return;
115:                }
116:
117:                if (getCount() == 0) {
118:                    JOptionPane.showMessageDialog(FrameManager.getInstance()
119:                            .getActiveFrame(), AddressbookResourceLoader
120:                            .getString("dialog", "addressbookimport",
121:                                    "addressbook_import_failed_2"), "",
122:                            JOptionPane.ERROR_MESSAGE);
123:                } else {
124:                    JOptionPane.showMessageDialog(FrameManager.getInstance()
125:                            .getActiveFrame(), AddressbookResourceLoader
126:                            .getString("dialog", "addressbookimport",
127:                                    "addressbook_import_was_successfull"),
128:                            AddressbookResourceLoader.getString("dialog",
129:                                    "contact", "information"),
130:                            JOptionPane.INFORMATION_MESSAGE);
131:                }
132:            }
133:
134:            /**
135:             * use this method to save a message to the specified destination folder
136:             */
137:            protected void saveContact(IContactModel card) throws Exception {
138:                destinationFolder.add(card);
139:
140:                counter++;
141:            }
142:
143:            /**
144:             * use this method to save contacts to the specified destination folder
145:             */
146:            protected void saveContacts(IContactModel[] cards) throws Exception {
147:                destinationFolder.add(cards);
148:
149:                counter += cards.length;
150:            }
151:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.