Source Code Cross Referenced for MessageEvent.java in  » IDE-Netbeans » cvsclient » org » netbeans » lib » cvsclient » 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 » IDE Netbeans » cvsclient » org.netbeans.lib.cvsclient.event 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*****************************************************************************
002:         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003:         *
004:         * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005:         *
006:         * The contents of this file are subject to the terms of either the GNU
007:         * General Public License Version 2 only ("GPL") or the Common
008:         * Development and Distribution License("CDDL") (collectively, the
009:         * "License"). You may not use this file except in compliance with the
010:         * License. You can obtain a copy of the License at
011:         * http://www.netbeans.org/cddl-gplv2.html
012:         * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013:         * specific language governing permissions and limitations under the
014:         * License.  When distributing the software, include this License Header
015:         * Notice in each file and include the License file at
016:         * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
017:         * particular file as subject to the "Classpath" exception as provided
018:         * by Sun in the GPL Version 2 section of the License file that
019:         * accompanied this code. If applicable, add the following below the
020:         * License Header, with the fields enclosed by brackets [] replaced by
021:         * your own identifying information:
022:         * "Portions Copyrighted [year] [name of copyright owner]"
023:         *
024:         * Contributor(s):
025:
026:         * The Original Software is the CVS Client Library.
027:         * The Initial Developer of the Original Software is Robert Greig.
028:         * Portions created by Robert Greig are Copyright (C) 2000.
029:         * All Rights Reserved.
030:         *
031:         * If you wish your version of this file to be governed by only the CDDL
032:         * or only the GPL Version 2, indicate your decision by adding
033:         * "[Contributor] elects to include this software in this distribution
034:         * under the [CDDL or GPL Version 2] license." If you do not indicate a
035:         * single choice of license, a recipient has the option to distribute
036:         * your version of this file under either the CDDL, the GPL Version 2 or
037:         * to extend the choice of license to its licensees as provided above.
038:         * However, if you add GPL Version 2 code and therefore, elected the GPL
039:         * Version 2 license, then the option applies only if the new code is
040:         * made subject to such option by the copyright holder.
041:
042:         * Contributor(s): Robert Greig.
043:         *****************************************************************************/package org.netbeans.lib.cvsclient.event;
044:
045:        /**
046:         * An event sent from the server to indicate that a message should be
047:         * displayed to the user
048:         * @author  Robert Greig
049:         */
050:        public class MessageEvent extends CVSEvent {
051:            /**
052:             * Holds value of property message.
053:             */
054:            private String message;
055:
056:            /**
057:             * Whether the message is an error message
058:             */
059:            private boolean error;
060:
061:            /** Holds value of property tagged. */
062:            private boolean tagged;
063:
064:            private final byte[] raw;
065:
066:            public MessageEvent(Object source, String message, byte[] raw,
067:                    boolean isError) {
068:                super (source);
069:                setMessage(message);
070:                setError(isError);
071:                setTagged(false);
072:                this .raw = raw;
073:            }
074:
075:            /**
076:             * Construct a MessageEvent
077:             * @param source the source of the event
078:             * @param message the message text
079:             * @param isError true if the message is an error message (i.e. intended
080:             * for stderr rather than stdout), false otherwise
081:             */
082:            public MessageEvent(Object source, String message, boolean isError) {
083:                this (source, message, null, isError);
084:            }
085:
086:            /**
087:             * Construct a MessageEvent with no message text
088:             * @param source the source of the event
089:             */
090:            public MessageEvent(Object source) {
091:                this (source, null, false);
092:            }
093:
094:            /**
095:             * Getter for property message.
096:             * @return Value of property message.
097:             */
098:            public String getMessage() {
099:                return message;
100:            }
101:
102:            /** @return bytes from wire or null */
103:            public byte[] getRawData() {
104:                return raw;
105:            }
106:
107:            /**
108:             * Setter for property message.
109:             * @param message New value of property message.
110:             */
111:            public void setMessage(String message) {
112:                this .message = message;
113:            }
114:
115:            /**
116:             * Get whether the message should be displayed in stderr
117:             * @return true if the message should be sent to stderr, false otherwise
118:             */
119:            public boolean isError() {
120:                return error;
121:            }
122:
123:            /**
124:             * Set whether the message should go to stderr
125:             * @param error true if the message is an error message, false otherwise
126:             */
127:            public void setError(boolean error) {
128:                this .error = error;
129:            }
130:
131:            /**
132:             * Fire the event to the event listener. Subclasses should call the
133:             * appropriate method on the listener to dispatch this event.
134:             * @param listener the event listener
135:             */
136:            protected void fireEvent(CVSListener listener) {
137:                listener.messageSent(this );
138:            }
139:
140:            /** Getter for property tagged.
141:             * @return Value of property tagged.
142:             */
143:            public boolean isTagged() {
144:                return tagged;
145:            }
146:
147:            /** Setter for property tagged.
148:             * @param tagged New value of property tagged.
149:             */
150:            public void setTagged(boolean tagged) {
151:                this .tagged = tagged;
152:            }
153:
154:            /**
155:             * Parses the tagged message using the specified buffer.
156:             * @returns != null, if the line is finished and could be processed
157:             */
158:            public static String parseTaggedMessage(
159:                    StringBuffer taggedLineBufferNotNull, String taggedMessage) {
160:                String line = taggedMessage;
161:
162:                if (line.charAt(0) == '+' || line.charAt(0) == '-') {
163:                    return null;
164:                }
165:
166:                String result = null;
167:                if (line.equals("newline")) {//NOI18N
168:                    result = taggedLineBufferNotNull.toString();
169:                    taggedLineBufferNotNull.setLength(0);
170:                }
171:                int index = line.indexOf(' ');
172:                if (index > 0) {
173:                    taggedLineBufferNotNull.append(line.substring(index + 1));
174:                }
175:                return result;
176:            }
177:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.