Source Code Cross Referenced for CalendarTagList.java in  » Mail-Clients » columba-1.4 » org » columba » calendar » ui » tagging » 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.calendar.ui.tagging 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.columba.calendar.ui.tagging;
002:
003:        import java.util.Collection;
004:
005:        import javax.swing.event.ListSelectionEvent;
006:        import javax.swing.event.ListSelectionListener;
007:
008:        import org.columba.api.gui.frame.IFrameMediator;
009:        import org.columba.calendar.ui.frame.CalendarFrameMediator;
010:        import org.columba.core.association.AssociationStore;
011:        import org.columba.core.gui.tagging.TagList;
012:        import org.columba.core.tagging.api.ITag;
013:
014:        import com.miginfocom.calendar.activity.Activity;
015:        import com.miginfocom.calendar.activity.ActivityDepository;
016:        import com.miginfocom.calendar.category.Category;
017:        import com.miginfocom.calendar.category.CategoryDepository;
018:        import com.miginfocom.util.MigUtil;
019:
020:        public class CalendarTagList extends TagList {
021:
022:            private static final java.util.logging.Logger LOG = java.util.logging.Logger
023:                    .getLogger("org.columba.calendar.ui.tagging"); //$NON-NLS-1$
024:
025:            public static final String PROP_FILTERED = "filterRow";
026:
027:            private IFrameMediator frameMediator;
028:
029:            public CalendarTagList(IFrameMediator frameMediator) {
030:                super ();
031:
032:                this .frameMediator = frameMediator;
033:
034:                addListSelectionListener(new MyListSelectionListener());
035:            }
036:
037:            class MyListSelectionListener implements  ListSelectionListener {
038:                MyListSelectionListener() {
039:                }
040:
041:                public void valueChanged(ListSelectionEvent event) {
042:                    // return if selection change is in flux
043:                    if (event.getValueIsAdjusting()) {
044:                        return;
045:                    }
046:
047:                    ITag result = (ITag) getSelectedValue();
048:
049:                    //
050:                    // mark all activities with the tag
051:                    // 
052:
053:                    Collection<String> messageList = AssociationStore
054:                            .getInstance().getAssociatedItems("tagging",
055:                                    result.getId());
056:                    for (String id : messageList) {
057:
058:                        // example:
059:                        // "columba://org.columba.contact/<folder-id>/<contact-id>"
060:                        String s = id.toString();
061:
062:                        // TODO: @author fdietz replace with regular expression
063:                        int activityIndex = s.lastIndexOf('/');
064:                        String activityId = s.substring(activityIndex + 1, s
065:                                .length());
066:                        int folderIndex = s.lastIndexOf('/', activityIndex - 1);
067:                        String folderId = s.substring(folderIndex + 1,
068:                                activityIndex);
069:                        int componentIndex = s
070:                                .lastIndexOf('/', folderIndex - 1);
071:                        String componentId = s.substring(componentIndex + 1,
072:                                folderIndex);
073:
074:                        // check if its a calendar component
075:                        if (componentId.equals("org.columba.calendar")) {
076:                            // get calendar ui component depository
077:                            Activity act = ActivityDepository.getInstance()
078:                                    .getActivity(activityId);
079:                            // add tag id as last
080:                            act.addCategoryID("tag_" + result.getId(),
081:                                    MigUtil.BIG_INT);
082:                        }
083:                    }
084:
085:                    //
086:                    // now change all global categories
087:                    // 
088:
089:                    // set all tags/categories to be *not* selected
090:                    clearAllTagCategories();
091:
092:                    // retrieve tag/category to be selected
093:                    Category category = retrieveTagCategory(result.getId());
094:                    if (category == null) {
095:                        System.out.println("add: " + result.getId());
096:                        // create new one
097:                        category = CategoryDepository.getRoot().addSubCategory(
098:                                "tag_" + result.getId(), result.getName());
099:                    }
100:
101:                    // mark it as selected
102:                    category.setProperty(Category.PROP_IS_HIDDEN, Boolean
103:                            .valueOf(false), Boolean.TRUE);
104:                    System.out.println("tag: " + category.getId().toString());
105:
106:                    // update calendar viewer
107:                    ((CalendarFrameMediator) frameMediator).getCalendarView()
108:                            .recreateFilterRows();
109:
110:                }
111:            }
112:
113:            private Category retrieveTagCategory(String tagId) {
114:                Collection<Category> c = CategoryDepository.getRoot()
115:                        .getChildrenDeep();
116:                for (Category category : c) {
117:                    String categoryId = (String) category.getId();
118:                    if (categoryId.equals("tag_" + tagId))
119:                        return category;
120:                }
121:
122:                return null;
123:            }
124:
125:            private void clearAllTagCategories() {
126:                CategoryDepository.getRoot().setPropertyDeep(
127:                        Category.PROP_IS_HIDDEN, Boolean.valueOf(true),
128:                        Boolean.TRUE);
129:            }
130:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.