Source Code Cross Referenced for FeedbackMessage.java in  » J2EE » wicket » org » apache » wicket » feedback » 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 » J2EE » wicket » org.apache.wicket.feedback 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Licensed to the Apache Software Foundation (ASF) under one or more
003:         * contributor license agreements.  See the NOTICE file distributed with
004:         * this work for additional information regarding copyright ownership.
005:         * The ASF licenses this file to You under the Apache License, Version 2.0
006:         * (the "License"); you may not use this file except in compliance with
007:         * the License.  You may obtain a copy of the License at
008:         *
009:         *      http://www.apache.org/licenses/LICENSE-2.0
010:         *
011:         * Unless required by applicable law or agreed to in writing, software
012:         * distributed under the License is distributed on an "AS IS" BASIS,
013:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         * See the License for the specific language governing permissions and
015:         * limitations under the License.
016:         */
017:        package org.apache.wicket.feedback;
018:
019:        import java.io.Serializable;
020:
021:        import org.apache.wicket.Component;
022:        import org.apache.wicket.IClusterable;
023:
024:        /**
025:         * Represents a generic message meant for the end-user/ pages.
026:         * 
027:         * @author Eelco Hillenius
028:         * @author Jonathan Locke
029:         */
030:        public class FeedbackMessage implements  IClusterable {
031:            private static final long serialVersionUID = 1L;
032:
033:            /** Constant for debug level. */
034:            public static final int DEBUG = 1;
035:
036:            /** Constant for error level. */
037:            public static final int ERROR = 4;
038:
039:            /** Constant for fatal level. */
040:            public static final int FATAL = 5;
041:
042:            /** Constant for info level. */
043:            public static final int INFO = 2;
044:
045:            /**
046:             * Constant for an undefined level; note that components might decide not to
047:             * render anything when this level is used.
048:             */
049:            public static final int UNDEFINED = 0;
050:
051:            /** Constant for warning level. */
052:            public static final int WARNING = 3;
053:
054:            /** Levels as strings for debugging. */
055:            private static final String[] levelStrings = new String[] {
056:                    "UNDEFINED", "DEBUG", "INFO", "WARNING", "ERROR", "FATAL" };
057:
058:            /**
059:             * The message level; can be used by rendering components. Note that what
060:             * actually happens with the level indication is totally up to the
061:             * components that render messages like these. The default level is
062:             * UNDEFINED.
063:             */
064:            private final int level;
065:
066:            /** The actual message. */
067:            private final Serializable message;
068:
069:            /** The reporting component. */
070:            private final Component reporter;
071:
072:            /** Whether or not this message has been rendered */
073:            private boolean rendered = false;
074:
075:            /**
076:             * Construct using fields.
077:             * 
078:             * @param reporter
079:             *            The message reporter
080:             * @param message
081:             *            The actual message
082:             * @param level
083:             *            The level of the message
084:             * @param sessionStored
085:             *            Whether or not this message will be stored in session
086:             */
087:            public FeedbackMessage(final Component reporter,
088:                    final Serializable message, final int level) {
089:                this .reporter = reporter;
090:                this .message = message;
091:                this .level = level;
092:            }
093:
094:            /**
095:             * Gets whether or not this message has been rendered
096:             * 
097:             * @return true if this message has been rendered, false otherwise
098:             */
099:            public final boolean isRendered() {
100:                return rendered;
101:            }
102:
103:            /**
104:             * Marks this message as rendered.
105:             */
106:            public final void markRendered() {
107:                this .rendered = true;
108:            }
109:
110:            /**
111:             * Gets the message level; can be used by rendering components. Note that
112:             * what actually happens with the level indication is totally up to the
113:             * components that render feedback messages.
114:             * 
115:             * @return The message level indicator.
116:             */
117:            public final int getLevel() {
118:                return level;
119:            }
120:
121:            /**
122:             * Gets the current level as a String
123:             * 
124:             * @return The current level as a String
125:             */
126:            public String getLevelAsString() {
127:                return levelStrings[getLevel()];
128:            }
129:
130:            /**
131:             * Gets the actual message.
132:             * 
133:             * @return the message.
134:             */
135:            public final Serializable getMessage() {
136:                return message;
137:            }
138:
139:            /**
140:             * Gets the reporting component.
141:             * 
142:             * @return the reporting component.
143:             */
144:            public final Component getReporter() {
145:                return reporter;
146:            }
147:
148:            /**
149:             * Gets whether the current level is DEBUG or up.
150:             * 
151:             * @return whether the current level is DEBUG or up.
152:             */
153:            public final boolean isDebug() {
154:                return isLevel(DEBUG);
155:            }
156:
157:            /**
158:             * Gets whether the current level is ERROR or up.
159:             * 
160:             * @return whether the current level is ERROR or up.
161:             */
162:            public final boolean isError() {
163:                return isLevel(ERROR);
164:            }
165:
166:            /**
167:             * Gets whether the current level is FATAL or up.
168:             * 
169:             * @return whether the current level is FATAL or up.
170:             */
171:            public final boolean isFatal() {
172:                return isLevel(FATAL);
173:            }
174:
175:            /**
176:             * Gets whether the current level is INFO or up.
177:             * 
178:             * @return whether the current level is INFO or up.
179:             */
180:            public final boolean isInfo() {
181:                return isLevel(INFO);
182:            }
183:
184:            /**
185:             * Returns whether this level is greater than or equal to the given level.
186:             * 
187:             * @param level
188:             *            the level
189:             * @return whether this level is greater than or equal to the given level
190:             */
191:            public final boolean isLevel(int level) {
192:                return (getLevel() >= level);
193:            }
194:
195:            /**
196:             * Gets whether the current level is UNDEFINED.
197:             * 
198:             * @return whether the current level is UNDEFINED.
199:             */
200:            public final boolean isUndefined() {
201:                return (getLevel() == UNDEFINED);
202:            }
203:
204:            /**
205:             * Gets whether the current level is WARNING or up.
206:             * 
207:             * @return whether the current level is WARNING or up.
208:             */
209:            public final boolean isWarning() {
210:                return isLevel(WARNING);
211:            }
212:
213:            /**
214:             * @see java.lang.Object#toString()
215:             */
216:            public String toString() {
217:                return "[FeedbackMessage message = \""
218:                        + getMessage()
219:                        + "\", reporter = "
220:                        + ((getReporter() == null) ? "null" : getReporter()
221:                                .getId()) + ", level = " + getLevelAsString()
222:                        + "]";
223:            }
224:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.