Source Code Cross Referenced for ValidationFormatter.java in  » Web-Framework » rife-1.6.1 » com » uwyn » rife » site » 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 » rife 1.6.1 » com.uwyn.rife.site 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2001-2007 Geert Bevin <gbevin[remove] at uwyn dot com>
003:         * Distributed under the terms of either:
004:         * - the common development and distribution license (CDDL), v1.0; or
005:         * - the GNU Lesser General Public License, v2.1 or later
006:         * $Id: ValidationFormatter.java 3669 2007-02-26 13:51:23Z gbevin $
007:         */
008:        package com.uwyn.rife.site;
009:
010:        import java.util.Collection;
011:
012:        import com.uwyn.rife.template.Template;
013:
014:        /**
015:         * Since this entire class has been deprecated it will not even be
016:         * tested anymore, use {@link ValidationBuilder} now instead.
017:         *
018:         * @deprecated
019:         */
020:        ///CLOVER:OFF
021:        public abstract class ValidationFormatter {
022:            /**
023:             * @deprecated
024:             */
025:            public static final String DEFAULT_ERROR_MESSAGE_ID = "error_message";
026:            /**
027:             * @deprecated
028:             */
029:            public static final String DEFAULT_ERROR_LINE_ID = "error_line";
030:            /**
031:             * @deprecated
032:             */
033:            public static final String DEFAULT_ERROR_CONTENT_ID = "error_content";
034:            /**
035:             * @deprecated
036:             */
037:            public static final String DEFAULT_ERROR_AREA_ID = "error_area";
038:
039:            /**
040:             * @deprecated
041:             */
042:            public static void setValidationErrors(Template template,
043:                    Collection<ValidationError> errors) {
044:                setValidationErrors(template, errors, DEFAULT_ERROR_MESSAGE_ID,
045:                        DEFAULT_ERROR_LINE_ID, DEFAULT_ERROR_CONTENT_ID,
046:                        DEFAULT_ERROR_AREA_ID);
047:            }
048:
049:            /**
050:             * @deprecated
051:             */
052:            public static void setValidationErrors(Template template,
053:                    Collection<ValidationError> errors, String errorMessageId,
054:                    String errorLineId, String errorContentId,
055:                    String errorAreaId) {
056:                if (null == template || null == errors) {
057:                    return;
058:                }
059:
060:                if (null == errorMessageId)
061:                    throw new IllegalArgumentException(
062:                            "errorMessageId can't be null.");
063:                if (null == errorLineId)
064:                    throw new IllegalArgumentException(
065:                            "errorLineId can't be null.");
066:                if (null == errorContentId)
067:                    throw new IllegalArgumentException(
068:                            "errorContentId can't be null.");
069:                if (null == errorAreaId)
070:                    throw new IllegalArgumentException(
071:                            "errorAreaId can't be null.");
072:
073:                if (!template.hasValueId(errorMessageId))
074:                    throw new IllegalArgumentException(
075:                            "Missing template value '" + errorMessageId + "'.");
076:                if (!template.hasValueId(errorContentId))
077:                    throw new IllegalArgumentException(
078:                            "Missing template value '" + errorContentId + "'.");
079:                if (!template.hasValueId(errorAreaId))
080:                    throw new IllegalArgumentException(
081:                            "Missing template value '" + errorAreaId + "'.");
082:                if (!template.hasBlock(errorLineId))
083:                    throw new IllegalArgumentException(
084:                            "Missing template block '" + errorLineId + "'.");
085:                if (!template.hasBlock(errorAreaId))
086:                    throw new IllegalArgumentException(
087:                            "Missing template block '" + errorAreaId + "'.");
088:
089:                String error_block_name;
090:                for (ValidationError error : errors) {
091:                    error_block_name = error.getIdentifier() + ":"
092:                            + error.getSubject();
093:                    if (template.hasBlock(error_block_name)) {
094:                        template.setBlock(errorMessageId, error_block_name);
095:                    } else {
096:                        template.setValue(errorMessageId, error_block_name);
097:                    }
098:                    template.appendBlock(errorContentId, errorLineId);
099:                }
100:
101:                template.setBlock(errorAreaId, errorAreaId);
102:            }
103:
104:            /**
105:             * @deprecated
106:             */
107:            public static void setErrorArea(Template template, String content) {
108:                setErrorArea(template, content, DEFAULT_ERROR_MESSAGE_ID,
109:                        DEFAULT_ERROR_LINE_ID, DEFAULT_ERROR_CONTENT_ID,
110:                        DEFAULT_ERROR_AREA_ID);
111:            }
112:
113:            /**
114:             * @deprecated
115:             */
116:            public static void setErrorArea(Template template, String content,
117:                    String errorMessageId, String errorLineId,
118:                    String errorContentId, String errorAreaId) {
119:                if (null == template || null == content) {
120:                    return;
121:                }
122:
123:                if (null == errorMessageId)
124:                    throw new IllegalArgumentException(
125:                            "errorMessageId can't be null.");
126:                if (null == errorLineId)
127:                    throw new IllegalArgumentException(
128:                            "errorLineId can't be null.");
129:                if (null == errorContentId)
130:                    throw new IllegalArgumentException(
131:                            "errorContentId can't be null.");
132:                if (null == errorAreaId)
133:                    throw new IllegalArgumentException(
134:                            "errorAreaId can't be null.");
135:
136:                if (!template.hasValueId(errorMessageId))
137:                    throw new IllegalArgumentException(
138:                            "Missing template value '" + errorMessageId + "'.");
139:                if (!template.hasValueId(errorContentId))
140:                    throw new IllegalArgumentException(
141:                            "Missing template value '" + errorContentId + "'.");
142:                if (!template.hasValueId(errorAreaId))
143:                    throw new IllegalArgumentException(
144:                            "Missing template value '" + errorAreaId + "'.");
145:                if (!template.hasBlock(errorLineId))
146:                    throw new IllegalArgumentException(
147:                            "Missing template block '" + errorLineId + "'.");
148:                if (!template.hasBlock(errorAreaId))
149:                    throw new IllegalArgumentException(
150:                            "Missing template block '" + errorAreaId + "'.");
151:
152:                template.setValue(errorMessageId, content);
153:                template.setBlock(errorContentId, errorLineId);
154:                template.setBlock(errorAreaId, errorAreaId);
155:            }
156:
157:            /**
158:             * @deprecated
159:             */
160:            public static void highlightInvalidSubjects(Template template,
161:                    Collection<ValidationError> errors,
162:                    String highlightValuePrefix, String highlightBlockId) {
163:                if (null == template || null == errors) {
164:                    return;
165:                }
166:
167:                if (null == highlightValuePrefix)
168:                    throw new IllegalArgumentException(
169:                            "highlightValuePrefix can't be null.");
170:                if (null == highlightBlockId)
171:                    throw new IllegalArgumentException(
172:                            "highlightBlockId can't be null.");
173:
174:                // highlight the validation erors
175:                String value_id;
176:                for (ValidationError validationerror : errors) {
177:                    value_id = highlightValuePrefix
178:                            + validationerror.getSubject();
179:                    if (template.hasValueId(value_id)) {
180:                        template.setBlock(value_id, highlightBlockId);
181:                    }
182:                }
183:            }
184:        }
185:        ///CLOVER:ON
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.