Source Code Cross Referenced for ContextBean.java in  » Development » iScreen » org » iscreen » impl » 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 » Development » iScreen » org.iscreen.impl 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2006 Dan Shellman
003:         *
004:         * Licensed under the Apache License, Version 2.0 (the "License");
005:         * you may not use this file except in compliance with the License.
006:         * You may obtain a copy of the License at
007:         *
008:         * http://www.apache.org/licenses/LICENSE-2.0
009:         *
010:         * Unless required by applicable law or agreed to in writing, software
011:         * distributed under the License is distributed on an "AS IS" BASIS,
012:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013:         * See the License for the specific language governing permissions and
014:         * limitations under the License.
015:         */
016:        package org.iscreen.impl;
017:
018:        import java.util.ArrayList;
019:        import java.util.Collection;
020:
021:        import org.iscreen.Validator;
022:
023:        /**
024:         * This class represents the JavaBean that's used to evaluate OGNL
025:         * expressions.  Failure messages and documentation may reference
026:         * this JavaBean to reference its properties.  Note that certain
027:         * properties are certain lifecycles (meaning, they are valid at
028:         * certain times).  For example, the failure property is only
029:         * available during runtime, after a validation has been performed
030:         * (and a failure has been discovered).  Therefore, it's not "valid"
031:         * to reference it within documentation.  Note the lifecycles of
032:         * each property on the getters/setters.
033:         *
034:         * @author Shellman, Dan
035:         */
036:        public class ContextBean {
037:            protected Object bean;
038:            protected String label;
039:            protected Object failure;
040:            protected Validator validator;
041:            protected Collection fields = new ArrayList();
042:            protected Integer index;
043:
044:            /**
045:             * Default constructor.
046:             */
047:            public ContextBean() {
048:            } //end ContextBean()
049:
050:            /**
051:             * The JavaBean being validated is set during runtime, prior to
052:             * any validators being called (prior to validation).
053:             *
054:             * @param   theBean The JavaBean being validated.
055:             */
056:            public void setBean(Object theBean) {
057:                bean = theBean;
058:            } //end setBean()
059:
060:            /**
061:             * The JavaBean being validated can be retrieved by failure
062:             * messages, since the bean is set prior to validation (prior
063:             * to any validators being called).
064:             *
065:             * @return Returns the JavaBean being validated.
066:             */
067:            public Object getBean() {
068:                return bean;
069:            } //end getBean()
070:
071:            /**
072:             * The label is set during runtime, prior to any validators
073:             * being called (prior to validation).  In fact, the label is
074:             * set during configuration of the ValidationService.
075:             *
076:             * @param   theLabel The label associated with a particular validation.
077:             */
078:            public void setLabel(String theLabel) {
079:                label = theLabel;
080:            } //end setLabel()
081:
082:            /**
083:             * The label is available during runtime, prior to any validators
084:             * being called (prior to validation).  In fact, the label is
085:             * set during configuration of the ValidationService.
086:             *
087:             * @return Returns the label associated with a particular validation.
088:             */
089:            public String getLabel() {
090:                return label;
091:            } //end getLabel()
092:
093:            /**
094:             * The Validator is set during runtime, prior to any
095:             * validators being called (prior to validation).  It has the
096:             * same lifecycle as the label.
097:             *
098:             * @param   theValidator The validator being used.
099:             */
100:            public void setValidator(Validator theValidator) {
101:                validator = theValidator;
102:            } //end setValidator()
103:
104:            /**
105:             * The Validator is available during runtime, prior to
106:             * any validators being called (prior to validation).  It has
107:             * the same lifecycle as the label.
108:             *
109:             * @return Returns the Validator that is currently being called.
110:             */
111:            public Validator getValidator() {
112:                return validator;
113:            } //end getValidator()
114:
115:            /**
116:             * The failure object, which represents an object associated with
117:             * a particular failure (and failure message), is set during
118:             * validation, when a validator reports the failure.
119:             *
120:             * @param   theFailure The failure object set by a Validator during
121:             *                     validation (associated with a failure message).
122:             */
123:            public void setFailure(Object theFailure) {
124:                failure = theFailure;
125:            } //end setFailure()
126:
127:            /**
128:             * The failure object, which represents an object associated with
129:             * a particular failure (and failure message), is available to
130:             * failure messages, as it's set prior to them being evaluated.
131:             *
132:             * @return Return the failure object set by a Validator during
133:             *         validation (associated with a failure message).
134:             */
135:            public Object getFailure() {
136:                return failure;
137:            } //end getFailure()
138:
139:            /**
140:             * The fields, which are a collection of OGNL 'getter' expressions meant
141:             * to map from the JavaBean (or object) being validated to the validation
142:             * bean used by the Validator, are set prior to validation.
143:             *
144:             * @param   theFields The Collection of fields (or OGNL 'getter' expressions).
145:             */
146:            public void setFields(Collection theFields) {
147:                fields.clear();
148:                fields.addAll(theFields);
149:            } //end setFields()
150:
151:            /**
152:             * Returns the fields, which are OGNL 'getter' expressions.  These are
153:             * set prior to validation.
154:             *
155:             * @return Returns the fields (OGNL 'getter' expressions) being validated.
156:             */
157:            public Collection getFields() {
158:                Collection col = new ArrayList();
159:
160:                col.addAll(fields);
161:
162:                return col;
163:            } //end getFields()
164:
165:            /**
166:             * Sets the index of this OGNL root.  This index is used when a JavaBean/Object
167:             * has a property that is some form of array/Collection that is being
168:             * validated across.  The index represents the particular object within
169:             * the array/Collection that is being validated.  This property is set
170:             * prior to validation of the indexed property (but not necessarily before
171:             * the parent is validated).
172:             *
173:             * @param   theIndex The index of the JavaBean property being validated.
174:             */
175:            public void setIndex(int theIndex) {
176:                index = new Integer(theIndex);
177:            } //end setIndex()
178:
179:            /**
180:             * Gets the index of this OGNL root.  This index is used when a JavaBean/Object
181:             * has a property that is some form of array/Collection that is being
182:             * validated across.  The index represents the particular object within
183:             * the array/Collection that is being validated.  If a JavaBean/Object is
184:             * NOT being used in this way (such as the parent JavaBean), then this
185:             * method will return null (note that null is NOT the same as zero, since
186:             * zero is the first index in an array/Collection, where null means that
187:             * there is no array/Collection being validated).
188:             *
189:             * @return Returns the index of the JavaBean property being validated.
190:             */
191:            public Integer getIndex() {
192:                return index;
193:            } //end getIndex()
194:        } //end ContextBean
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.