Source Code Cross Referenced for MessageEvent.java in  » Content-Management-System » contelligent » de » finix » contelligent » client » event » 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 » Content Management System » contelligent » de.finix.contelligent.client.event 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2001-2006 C:1 Financial Services GmbH
003:         *
004:         * This software is free software; you can redistribute it and/or
005:         * modify it under the terms of the GNU Lesser General Public
006:         * License Version 2.1, as published by the Free Software Foundation.
007:         *
008:         * This software is distributed in the hope that it will be useful,
009:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
010:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
011:         * Lesser General Public License for more details.
012:         *
013:         * You should have received a copy of the GNU Lesser General Public
014:         * License along with this library; if not, write to the Free Software
015:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
016:         */
017:
018:        package de.finix.contelligent.client.event;
019:
020:        import java.util.logging.Logger;
021:
022:        /**
023:         * Created when a user message is sent from the server.
024:         */
025:        public class MessageEvent extends AbstractContelligentEvent {
026:
027:            /**
028:             * For logging messages and errors.
029:             */
030:            private static Logger logger = Logger.getLogger(MessageEvent.class
031:                    .getName());
032:
033:            /**
034:             * The importance of the message is invalid.
035:             */
036:            public static final int IMPORTANCE_NIL = 0;
037:
038:            /**
039:             * The importance of the message is medium.
040:             */
041:            public static final int IMPORTANCE_MEDIUM = 1;
042:
043:            /**
044:             * The importance of the message is high.
045:             */
046:            public static final int IMPORTANCE_HIGH = 2;
047:
048:            /**
049:             * The message type is invalid.
050:             */
051:            public static final int TYPE_NIL = 0;
052:
053:            /**
054:             * The message has been sent from the user.
055:             */
056:            public static final int TYPE_FROM = 1;
057:
058:            /**
059:             * The message is being sent to the user.
060:             */
061:            public static final int TYPE_TO = 2;
062:
063:            /**
064:             * The message is being sent to all users.
065:             */
066:            public static final int TYPE_TO_ALL = 3;
067:
068:            /**
069:             * The user has sent himself a message.
070:             */
071:            public static final int TYPE_TO_SELF = 4;
072:
073:            /**
074:             * The name of the user who sent or is receiving the message.
075:             */
076:            private String user = null;
077:
078:            /**
079:             * The message text.
080:             */
081:            private String message = null;
082:
083:            /**
084:             * The importance of the message. This may be one of the importance levels
085:             * IMPORTANCE_*.
086:             */
087:            private int importance = IMPORTANCE_NIL;
088:
089:            /**
090:             * The message type. This may be one of the types TYPE_*.
091:             */
092:            private int type = TYPE_NIL;
093:
094:            /**
095:             * Creates a message event.
096:             * 
097:             * @param source
098:             *            the object which produced this event.
099:             * @param user
100:             *            if `type' is `from', `to-all' or `to-self', this is the name
101:             *            of the user who sent the message. Otherwise, it is the name of
102:             *            the name of the user receiving the message.
103:             * @param message
104:             *            the message text.
105:             * @param importance
106:             *            the importance of the message. This can be either `medium' or
107:             *            `high'.
108:             * @param type
109:             *            the type of message being sent. This may be `from', `to',
110:             *            `to-all' or `to-self'.
111:             */
112:            public MessageEvent(Object source, String user, String message,
113:                    String importance, String type) {
114:                super (source);
115:                this .user = user;
116:                this .message = message;
117:                if (importance.equals("high")) {
118:                    this .importance = IMPORTANCE_HIGH;
119:                } else if (importance.equals("medium")) {
120:                    this .importance = IMPORTANCE_MEDIUM;
121:                } else {
122:                    // Use default importance.
123:                }
124:                logger.info("message event type: " + type);
125:                if (type.equals("from")) {
126:                    this .type = TYPE_FROM;
127:                } else if (type.equals("to")) {
128:                    this .type = TYPE_TO;
129:                } else if (type.equals("to-all")) {
130:                    this .type = TYPE_TO_ALL;
131:                } else if (type.equals("to-self")) {
132:                    this .type = TYPE_TO_SELF;
133:                } else {
134:                    // Use default type.
135:                }
136:            }
137:
138:            /**
139:             * Get how important the message is.
140:             * 
141:             * @return the importance of the message.
142:             */
143:            public int getImportance() {
144:                return importance;
145:            }
146:
147:            /**
148:             * Get the message text.
149:             * 
150:             * @return the message text.
151:             */
152:            public String getMessage() {
153:                return message;
154:            }
155:
156:            /**
157:             * Get the type of the message. This may be one of the types TYPE_*.
158:             * 
159:             * @return the type of the message.
160:             */
161:            public int getType() {
162:                return type;
163:            }
164:
165:            /**
166:             * Get the name of the user who sent or is receiving the message.
167:             * 
168:             * @return the name of the user.
169:             */
170:            public String getUser() {
171:                return user;
172:            }
173:
174:            public String toString() {
175:                return getClass().getName() + "[user=" + user + ", message="
176:                        + message + ", importance=" + message + ", type="
177:                        + type + "]";
178:            }
179:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.