Source Code Cross Referenced for UserError.java in  » Web-Framework » Millstone » org » millstone » base » terminal » 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 » Web Framework » Millstone » org.millstone.base.terminal 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /* *************************************************************************
002:         
003:                                        Millstone(TM) 
004:                           Open Sourced User Interface Library for
005:                               Internet Development with Java
006:
007:                     Millstone is a registered trademark of IT Mill Ltd
008:                          Copyright (C) 2000-2005 IT Mill Ltd
009:                             
010:         *************************************************************************
011:
012:           This library is free software; you can redistribute it and/or
013:           modify it under the terms of the GNU Lesser General Public
014:           license version 2.1 as published by the Free Software Foundation.
015:
016:           This library is distributed in the hope that it will be useful,
017:           but WITHOUT ANY WARRANTY; without even the implied warranty of
018:           MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
019:           Lesser General Public License for more details.
020:
021:           You should have received a copy of the GNU Lesser General Public
022:           License along with this library; if not, write to the Free Software
023:           Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
024:
025:         *************************************************************************
026:           
027:           For more information, contact:
028:           
029:           IT Mill Ltd                           phone: +358 2 4802 7180
030:           Ruukinkatu 2-4                        fax:  +358 2 4802 7181
031:           20540, Turku                          email: info@itmill.com
032:           Finland                               company www: www.itmill.com
033:           
034:           Primary source for MillStone information and releases: www.millstone.org
035:
036:         ********************************************************************** */
037:
038:        package org.millstone.base.terminal;
039:
040:        /** User error is a controlled error occurred in application. User errors
041:         * are occur in normal usage of the application and guide the user.
042:         *
043:         * @author IT Mill Ltd.
044:         * @version 3.1.1
045:         * @since 3.0
046:         */
047:        public class UserError implements  ErrorMessage {
048:
049:            /** Content mode, where the error contains only plain text. 
050:             */
051:            public static final int CONTENT_TEXT = 0;
052:
053:            /** Content mode, where the error contains preformatted text.
054:             */
055:            public static final int CONTENT_PREFORMATTED = 1;
056:
057:            /** Formatted content mode, where the contents is XML restricted to the
058:             * UIDL 1.0 formatting markups.
059:             */
060:            public static final int CONTENT_UIDL = 2;
061:
062:            /** Content mode */
063:            private int mode = CONTENT_TEXT;
064:
065:            /** Message in content mode */
066:            private String msg;
067:
068:            /** Error level */
069:            private int level = ErrorMessage.ERROR;
070:
071:            /** Create a textual error message of level ERROR.
072:             * 
073:             * @param textErrorMessage The text of the error message. 
074:             */
075:            public UserError(String textErrorMessage) {
076:                this .msg = textErrorMessage;
077:            }
078:
079:            /** Create error message with level and content mode.
080:             */
081:            public UserError(String message, int contentMode, int errorLevel) {
082:
083:                // Check the parameters
084:                if (contentMode < 0 || contentMode > 2)
085:                    throw new java.lang.IllegalArgumentException(
086:                            "Unsupported content mode: " + contentMode);
087:
088:                this .msg = message;
089:                this .mode = contentMode;
090:                this .level = errorLevel;
091:            }
092:
093:            /* Documenten in interface */
094:            public int getErrorLevel() {
095:                return level;
096:            }
097:
098:            /* Documenten in interface */
099:            public void addListener(RepaintRequestListener listener) {
100:            }
101:
102:            /* Documenten in interface */
103:            public void removeListener(RepaintRequestListener listener) {
104:            }
105:
106:            /* Documenten in interface */
107:            public void requestRepaint() {
108:            }
109:
110:            /* Documenten in interface */
111:            public void paint(PaintTarget target) throws PaintException {
112:
113:                target.startTag("error");
114:
115:                // Error level
116:                if (level >= ErrorMessage.SYSTEMERROR)
117:                    target.addAttribute("level", "system");
118:                else if (level >= ErrorMessage.CRITICAL)
119:                    target.addAttribute("level", "critical");
120:                else if (level >= ErrorMessage.ERROR)
121:                    target.addAttribute("level", "error");
122:                else if (level >= ErrorMessage.WARNING)
123:                    target.addAttribute("level", "warning");
124:                else
125:                    target.addAttribute("level", "info");
126:
127:                // Paint the message
128:                switch (mode) {
129:                case CONTENT_TEXT:
130:                    target.addText(msg);
131:                    break;
132:                case CONTENT_UIDL:
133:                    target.addUIDL(msg);
134:                    break;
135:                case CONTENT_PREFORMATTED:
136:                    target.startTag("pre");
137:                    target.addText(msg);
138:                    target.endTag("pre");
139:                }
140:
141:                target.endTag("error");
142:            }
143:
144:            /* Documenten in interface */
145:            public void requestRepaintRequests() {
146:            }
147:
148:            /* Documented in superclass */
149:            public String toString() {
150:                return msg;
151:            }
152:
153:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.