Source Code Cross Referenced for ValidationResults.java in  » Swing-Library » jgoodies-validation » com » jgoodies » validation » tests » 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 » Swing Library » jgoodies validation » com.jgoodies.validation.tests 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright (c) 2003-2007 JGoodies Karsten Lentzsch. All Rights Reserved.
003:         *
004:         * Redistribution and use in source and binary forms, with or without
005:         * modification, are permitted provided that the following conditions are met:
006:         *
007:         *  o Redistributions of source code must retain the above copyright notice,
008:         *    this list of conditions and the following disclaimer.
009:         *
010:         *  o Redistributions in binary form must reproduce the above copyright notice,
011:         *    this list of conditions and the following disclaimer in the documentation
012:         *    and/or other materials provided with the distribution.
013:         *
014:         *  o Neither the name of JGoodies Karsten Lentzsch nor the names of
015:         *    its contributors may be used to endorse or promote products derived
016:         *    from this software without specific prior written permission.
017:         *
018:         * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
019:         * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
020:         * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
021:         * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
022:         * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
023:         * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
024:         * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
025:         * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
026:         * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
027:         * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
028:         * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
029:         */
030:
031:        package com.jgoodies.validation.tests;
032:
033:        import com.jgoodies.validation.Severity;
034:        import com.jgoodies.validation.ValidationMessage;
035:        import com.jgoodies.validation.ValidationResult;
036:        import com.jgoodies.validation.message.SimpleValidationMessage;
037:
038:        /**
039:         * Consists only of static fields for prepared ValidationResults
040:         * used by different Validation test cases. The result names
041:         * are an encoded form of their content:
042:         * <code>E1</code> is a result with just error1,
043:         * <code>E1W2</code> is a result with error1 and warning2,
044:         * <code>E1E2W1</code> is a result error1, error2 and warning1.
045:         *
046:         * @author  Karsten Lentzsch
047:         * @version $Revision: 1.3 $
048:         */
049:        public final class ValidationResults {
050:
051:            public static final Object KEY1;
052:            public static final Object KEY2;
053:            public static final Object KEY3;
054:
055:            public static final ValidationResult E1;
056:            public static final ValidationResult E2;
057:            public static final ValidationResult W1;
058:            public static final ValidationResult W2;
059:
060:            public static final ValidationResult E1E1;
061:            public static final ValidationResult E1E2;
062:            public static final ValidationResult E1W1;
063:            public static final ValidationResult E1W2;
064:
065:            public static final ValidationResult E2E1;
066:            public static final ValidationResult E2E2;
067:            public static final ValidationResult E2W1;
068:            public static final ValidationResult E2W2;
069:
070:            public static final ValidationResult W1E1;
071:            public static final ValidationResult W1E2;
072:            public static final ValidationResult W1W1;
073:            public static final ValidationResult W1W2;
074:
075:            public static final ValidationResult W2E1;
076:            public static final ValidationResult W2E2;
077:            public static final ValidationResult W2W1;
078:            public static final ValidationResult W2W2;
079:
080:            public static final ValidationResult E1E1E1;
081:            public static final ValidationResult E1E1W1;
082:            public static final ValidationResult E1W1E1;
083:            public static final ValidationResult E1W1W1;
084:            public static final ValidationResult W1E1E1;
085:            public static final ValidationResult W1E1W1;
086:            public static final ValidationResult W1W1E1;
087:            public static final ValidationResult W1W1W1;
088:
089:            public static final ValidationResult E1E2E3;
090:
091:            // Initialization *********************************************************
092:
093:            static {
094:                KEY1 = "key1";
095:                KEY2 = "key2";
096:                KEY3 = "key3";
097:
098:                ValidationMessage error1 = new SimpleValidationMessage(
099:                        "Validation error1", Severity.ERROR, KEY1);
100:                ValidationMessage error2 = new SimpleValidationMessage(
101:                        "Validation error2", Severity.ERROR, KEY2);
102:                ValidationMessage error3 = new SimpleValidationMessage(
103:                        "Validation error3", Severity.ERROR, KEY3);
104:                ValidationMessage warning1 = new SimpleValidationMessage(
105:                        "Validation warning1", Severity.WARNING, KEY1);
106:                ValidationMessage warning2 = new SimpleValidationMessage(
107:                        "Validation warning2", Severity.WARNING, KEY2);
108:
109:                E1 = createUnmodifiableResult(error1);
110:                E2 = createUnmodifiableResult(error2);
111:                W1 = createUnmodifiableResult(warning1);
112:                W2 = createUnmodifiableResult(warning2);
113:
114:                // ---------------------------------
115:
116:                E1E1 = createUnmodifiableResult(error1, error1);
117:                E1E2 = createUnmodifiableResult(error1, error2);
118:                E1W1 = createUnmodifiableResult(error1, warning1);
119:                E1W2 = createUnmodifiableResult(error1, warning2);
120:
121:                E2E1 = createUnmodifiableResult(error2, error1);
122:                E2E2 = createUnmodifiableResult(error2, error2);
123:                E2W1 = createUnmodifiableResult(error2, warning1);
124:                E2W2 = createUnmodifiableResult(error2, warning2);
125:
126:                W1E1 = createUnmodifiableResult(warning1, error1);
127:                W1E2 = createUnmodifiableResult(warning1, error2);
128:                W1W1 = createUnmodifiableResult(warning1, warning1);
129:                W1W2 = createUnmodifiableResult(warning1, warning2);
130:
131:                W2E1 = createUnmodifiableResult(warning2, error1);
132:                W2E2 = createUnmodifiableResult(warning2, error2);
133:                W2W1 = createUnmodifiableResult(warning2, warning1);
134:                W2W2 = createUnmodifiableResult(warning2, warning2);
135:
136:                // ----------------------------------
137:
138:                E1E1E1 = createUnmodifiableResult(error1, error1, error1);
139:                E1E1W1 = createUnmodifiableResult(error1, error1, warning1);
140:                E1W1E1 = createUnmodifiableResult(error1, warning1, error1);
141:                E1W1W1 = createUnmodifiableResult(error1, warning1, warning1);
142:                W1E1E1 = createUnmodifiableResult(warning1, error1, error1);
143:                W1E1W1 = createUnmodifiableResult(warning1, error1, warning1);
144:                W1W1E1 = createUnmodifiableResult(warning1, warning1, error1);
145:                W1W1W1 = createUnmodifiableResult(warning1, warning1, warning1);
146:
147:                E1E2E3 = createUnmodifiableResult(error1, error2, error3);
148:            }
149:
150:            // Overridden Constructor *************************************************
151:
152:            private ValidationResults() {
153:                // Override default constructor; prevents instantiation.
154:            }
155:
156:            // Helper Code ************************************************************
157:
158:            private static ValidationResult createUnmodifiableResult(
159:                    ValidationMessage message) {
160:                ValidationResult result = new ValidationResult();
161:                result.add(message);
162:                return ValidationResult.unmodifiableResult(result);
163:            }
164:
165:            private static ValidationResult createUnmodifiableResult(
166:                    ValidationMessage message1, ValidationMessage message2) {
167:                ValidationResult result = new ValidationResult();
168:                result.add(message1);
169:                result.add(message2);
170:                return ValidationResult.unmodifiableResult(result);
171:            }
172:
173:            private static ValidationResult createUnmodifiableResult(
174:                    ValidationMessage message1, ValidationMessage message2,
175:                    ValidationMessage message3) {
176:                ValidationResult result = new ValidationResult();
177:                result.add(message1);
178:                result.add(message2);
179:                result.add(message3);
180:                return ValidationResult.unmodifiableResult(result);
181:            }
182:
183:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.