Source Code Cross Referenced for Value.java in  » Content-Management-System » dspace » org » dspace » app » xmlui » wing » element » 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 » Content Management System » dspace » org.dspace.app.xmlui.wing.element 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Value.java
003:         *
004:         * Version: $Revision: 1.7 $
005:         *
006:         * Date: $Date: 2006/07/05 21:40:01 $
007:         *
008:         * Copyright (c) 2002-2005, Hewlett-Packard Company and Massachusetts
009:         * Institute of Technology.  All rights reserved.
010:         *
011:         * Redistribution and use in source and binary forms, with or without
012:         * modification, are permitted provided that the following conditions are
013:         * met:
014:         *
015:         * - Redistributions of source code must retain the above copyright
016:         * notice, this list of conditions and the following disclaimer.
017:         *
018:         * - Redistributions in binary form must reproduce the above copyright
019:         * notice, this list of conditions and the following disclaimer in the
020:         * documentation and/or other materials provided with the distribution.
021:         *
022:         * - Neither the name of the Hewlett-Packard Company nor the name of the
023:         * Massachusetts Institute of Technology nor the names of their
024:         * contributors may be used to endorse or promote products derived from
025:         * this software without specific prior written permission.
026:         *
027:         * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
028:         * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
029:         * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
030:         * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
031:         * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
032:         * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
033:         * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
034:         * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
035:         * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
036:         * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
037:         * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
038:         * DAMAGE.
039:         */
040:
041:        package org.dspace.app.xmlui.wing.element;
042:
043:        import org.dspace.app.xmlui.wing.AttributeMap;
044:        import org.dspace.app.xmlui.wing.WingContext;
045:        import org.dspace.app.xmlui.wing.WingException;
046:        import org.xml.sax.ContentHandler;
047:        import org.xml.sax.SAXException;
048:        import org.xml.sax.ext.LexicalHandler;
049:        import org.xml.sax.helpers.NamespaceSupport;
050:
051:        /**
052:         * This class represents field values.
053:         * 
054:         * @author Scott Phillips
055:         */
056:
057:        public class Value extends RichTextContainer {
058:            /** The name of the value element */
059:            public static final String E_VALUE = "value";
060:
061:            /** The name of the value type attribute */
062:            public static final String A_TYPE = "type";
063:
064:            /** The name of the option value attribute */
065:            public static final String A_OPTION = "option";
066:
067:            /** The name of the checked attribute */
068:            public static final String A_CHECKED = "checked";
069:
070:            /** The possible value types */
071:            public static final String TYPE_RAW = "raw";
072:
073:            public static final String TYPE_INTERPRETED = "interpreted";
074:
075:            public static final String TYPE_OPTION = "option";
076:
077:            /** All the possible value types collected into one array. */
078:            public static final String[] TYPES = { TYPE_RAW, TYPE_INTERPRETED,
079:                    TYPE_OPTION };
080:
081:            /** The type of this value element */
082:            private String type;
083:
084:            /** The submited value for this option */
085:            private String option;
086:
087:            /** The checked attribute */
088:            private boolean checked;
089:
090:            /**
091:             * Construct a new field value, when used in a multiple value context
092:             * 
093:             * @param context
094:             *            (Required) The context this element is contained in
095:             * @param type
096:             *            (may be null) Determine the value's type, raw, default or
097:             *            interpreted. If the value is null, then raw is used.
098:             */
099:            protected Value(WingContext context, String type)
100:                    throws WingException {
101:                super (context);
102:
103:                if (type == null) {
104:                    // if no type specified just default to raw.
105:                    type = TYPE_RAW;
106:                }
107:
108:                restrict(
109:                        type,
110:                        TYPES,
111:                        "The 'type' parameter must be one of these values: 'raw', 'interpreted', or 'option'");
112:
113:                this .type = type;
114:            }
115:
116:            /**
117:             * Construct a new field value, when used in a multiple value context
118:             * 
119:             * @param context
120:             *            (Required) The context this element is contained in
121:             * @param type
122:             *            (may be null) Determine the value's type, raw, default or
123:             *            interpreted. If the value is null, then raw is used.
124:             * @param option
125:             *            (May be null) The option's return value that is selected.
126:             */
127:            protected Value(WingContext context, String type, String option)
128:                    throws WingException {
129:                super (context);
130:
131:                if (type == null) {
132:                    // if no type specified just default to raw.
133:                    type = TYPE_RAW;
134:                }
135:                restrict(
136:                        type,
137:                        TYPES,
138:                        "The 'type' parameter must be one of these values: 'raw', 'interpreted', or 'option'.");
139:
140:                this .type = type;
141:                this .option = option;
142:            }
143:
144:            /**
145:             * Construct a new field value, when used in a multiple value context
146:             * 
147:             * @param context
148:             *            (Required) The context this element is contained in
149:             * @param type
150:             *            (may be null) Determine the value's type, raw, default or
151:             *            interpreted. If the value is null, then raw is used.
152:             * @param checked
153:             *            (Required) Determine if the value is checked, only valid for
154:             *            checkboxes and radio buttons
155:             */
156:            protected Value(WingContext context, String type, boolean checked)
157:                    throws WingException {
158:                super (context);
159:
160:                if (type == null) {
161:                    // if no type specified just default to raw.
162:                    type = TYPE_RAW;
163:                }
164:                restrict(
165:                        type,
166:                        TYPES,
167:                        "The 'type' parameter must be one of these values: 'raw', 'interpreted', or 'option'.");
168:
169:                this .type = type;
170:                this .checked = checked;
171:            }
172:
173:            /**
174:             * @return the type of this value.
175:             */
176:            protected String getType() {
177:                return type;
178:            }
179:
180:            /**
181:             * Translate this element and all contained elements into SAX events. The
182:             * events should be routed to the contentHandler found in the WingContext.
183:             * 
184:             * @param contentHandler
185:             *            (Required) The registered contentHandler where SAX events
186:             *            should be routed too.
187:             * @param lexicalHandler
188:             *            (Required) The registered lexicalHandler where lexical events
189:             *            (such as CDATA, DTD, etc) should be routed too.
190:             * @param namespaces
191:             *            (Required) SAX Helper class to keep track of namespaces able
192:             *            to determine the correct prefix for a given namespace URI.
193:             */
194:
195:            public void toSAX(ContentHandler contentHandler,
196:                    LexicalHandler lexicalHandler, NamespaceSupport namespaces)
197:                    throws SAXException {
198:                AttributeMap attributes = new AttributeMap();
199:                attributes.put(A_TYPE, this .type);
200:
201:                if (this .option != null)
202:                    attributes.put(A_OPTION, this .option);
203:                if (this .checked)
204:                    attributes.put(A_CHECKED, this .checked);
205:
206:                startElement(contentHandler, namespaces, E_VALUE, attributes);
207:                super .toSAX(contentHandler, lexicalHandler, namespaces);
208:                endElement(contentHandler, namespaces, E_VALUE);
209:            }
210:
211:            /**
212:             * dispose
213:             */
214:            public void dispose() {
215:                super.dispose();
216:            }
217:
218:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.