Source Code Cross Referenced for Event.java in  » Groupware » lucane » org » lucane » applications » calendar » 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 » Groupware » lucane » org.lucane.applications.calendar 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Lucane - a collaborative platform
003:         * Copyright (C) 2003  Vincent Fiack <vfiack@mail15.com>
004:         *
005:         * This library is free software; you can redistribute it and/or
006:         * modify it under the terms of the GNU Lesser General Public
007:         * License as published by the Free Software Foundation; either
008:         * version 2.1 of the License, or (at your option) any later version.
009:         *
010:         * This library is distributed in the hope that it will be useful,
011:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
012:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
013:         * Lesser General Public License for more details.
014:         *
015:         * You should have received a copy of the GNU Lesser General Public
016:         * License along with this library; if not, write to the Free Software
017:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
018:         */
019:
020:        package org.lucane.applications.calendar;
021:
022:        import java.awt.*;
023:        import java.io.*;
024:        import java.util.*;
025:
026:        import javax.swing.Icon;
027:
028:        import org.lucane.applications.calendar.widget.*;
029:        import org.lucane.client.PluginManager;
030:
031:        public class Event implements  Serializable, BasicEvent {
032:            //-- recurrence
033:            public static final int RECUR_NONE = 0;
034:            public static final int RECUR_DAY = 1;
035:            public static final int RECUR_WEEK = 2;
036:            public static final int RECUR_MONTH = 3;
037:            public static final int RECUR_YEAR = 4;
038:
039:            //-- attributes
040:            private int id;
041:            private String title;
042:            private String organizer;
043:            private boolean isPublic;
044:            private boolean isEditable;
045:            private Date start;
046:            private Date end;
047:            private int recurrence;
048:            private String description;
049:
050:            private String type;
051:            private int colorRed;
052:            private int colorGreen;
053:            private int colorBlue;
054:            private String iconFile;
055:
056:            private ArrayList attendees;
057:            private ArrayList resources;
058:
059:            /**
060:             * Constructor
061:             */
062:            public Event(int id, String type, String title, String organizer,
063:                    boolean isPublic, boolean isEditable, long start, long end,
064:                    int recurence, String description) {
065:                this .id = id;
066:                this .type = type;
067:                this .title = title;
068:                this .organizer = organizer;
069:                this .isPublic = isPublic;
070:                this .isEditable = isEditable;
071:                this .start = new Date(start);
072:                this .end = new Date(end);
073:                this .recurrence = recurence;
074:                this .description = description;
075:                this .attendees = new ArrayList();
076:                this .resources = new ArrayList();
077:                this .colorRed = 30;
078:                this .colorGreen = 30;
079:                this .colorBlue = 200;
080:                this .iconFile = "default.png";
081:            }
082:
083:            //-- setters
084:            public void setId(int id) {
085:                this .id = id;
086:            }
087:
088:            public void setAttendees(ArrayList attendees) {
089:                this .attendees = attendees;
090:            }
091:
092:            public void addAttendee(String user, boolean mandatory, int status) {
093:                this .attendees.add(new Attendee(user, mandatory, status));
094:            }
095:
096:            public Attendee getAttendee(String user) {
097:                Iterator i = getAttendees();
098:                while (i.hasNext()) {
099:                    Attendee a = (Attendee) i.next();
100:                    if (a.getUser().equals(user))
101:                        return a;
102:                }
103:
104:                return null;
105:            }
106:
107:            public void removeAttendee(String user) {
108:                attendees.remove(getAttendee(user));
109:            }
110:
111:            public boolean hasAttendee(String user) {
112:                return getAttendee(user) != null;
113:            }
114:
115:            public void setResources(ArrayList resources) {
116:                this .resources = resources;
117:            }
118:
119:            public void addResource(String resource) {
120:                this .resources.add(resource);
121:            }
122:
123:            public void setStartDate(Date start) {
124:                this .start = start;
125:            }
126:
127:            public void setEndDate(Date end) {
128:                this .end = end;
129:            }
130:
131:            public void setColor(Color color) {
132:                this .colorRed = color.getRed();
133:                this .colorGreen = color.getGreen();
134:                this .colorBlue = color.getBlue();
135:            }
136:
137:            public void setColor(int r, int g, int b) {
138:                this .colorRed = r;
139:                this .colorGreen = g;
140:                this .colorBlue = b;
141:            }
142:
143:            public int getColorRed() {
144:                return colorRed;
145:            }
146:
147:            public int getColorGreen() {
148:                return colorGreen;
149:            }
150:
151:            public int getColorBlue() {
152:                return colorBlue;
153:            }
154:
155:            //-- getters
156:            public int getId() {
157:                return this .id;
158:            }
159:
160:            public String getType() {
161:                return this .type;
162:            }
163:
164:            public String getOrganizer() {
165:                return this .organizer;
166:            }
167:
168:            public boolean isPublic() {
169:                return this .isPublic;
170:            }
171:
172:            public boolean isEditable() {
173:                return this .isEditable;
174:            }
175:
176:            public int getRecurrence() {
177:                return this .recurrence;
178:            }
179:
180:            public String getDescription() {
181:                return this .description;
182:            }
183:
184:            public Iterator getAttendees() {
185:                return this .attendees.iterator();
186:            }
187:
188:            public ArrayList getAttendeeList() {
189:                return this .attendees;
190:            }
191:
192:            public Iterator getResources() {
193:                return this .resources.iterator();
194:            }
195:
196:            public ArrayList getResourceList() {
197:                return this .resources;
198:            }
199:
200:            //-- getters for BasicEvent
201:
202:            public String getTitle() {
203:                return title;
204:            }
205:
206:            public Date getStartDate() {
207:                return this .start;
208:            }
209:
210:            public Date getEndDate() {
211:                return this .end;
212:            }
213:
214:            public int getStartHour() {
215:                Calendar c = Calendar.getInstance();
216:                c.setTime(start);
217:                return c.get(Calendar.HOUR_OF_DAY);
218:            }
219:
220:            public int getStartMinute() {
221:                Calendar c = Calendar.getInstance();
222:                c.setTime(start);
223:                return c.get(Calendar.MINUTE);
224:            }
225:
226:            public int getEndHour() {
227:                Calendar c = Calendar.getInstance();
228:                c.setTime(end);
229:                return c.get(Calendar.HOUR_OF_DAY);
230:            }
231:
232:            public int getEndMinute() {
233:                Calendar c = Calendar.getInstance();
234:                c.setTime(end);
235:                return c.get(Calendar.MINUTE);
236:            }
237:
238:            public boolean isMultiDay() {
239:                Calendar start = Calendar.getInstance();
240:                start.setTime(this .start);
241:                Calendar end = Calendar.getInstance();
242:                end.setTime(this .end);
243:
244:                return end.get(Calendar.YEAR) > start.get(Calendar.YEAR)
245:                        || end.get(Calendar.DAY_OF_YEAR) > start
246:                                .get(Calendar.DAY_OF_YEAR);
247:            }
248:
249:            public Color getColor() {
250:                return new Color(colorRed, colorGreen, colorBlue);
251:            }
252:
253:            public void setIconFile(String s) {
254:                this .iconFile = s;
255:            }
256:
257:            public String getIconFile() {
258:                return this .iconFile;
259:            }
260:
261:            public Icon getIcon() {
262:                return PluginManager.getInstance().getPlugin(
263:                        "org.lucane.applications.calendar").getImageIcon(
264:                        "types/" + iconFile);
265:            }
266:
267:            public boolean equals(Object o) {
268:                if (!(o instanceof  Event))
269:                    return false;
270:
271:                return ((Event) o).getId() == getId();
272:            }
273:
274:            public String toString() {
275:                return "[" + id + ": " + title + "]";
276:            }
277:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.