Source Code Cross Referenced for Params.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:         * Params.java
003:         *
004:         * Version: $Revision: 1.1 $
005:         *
006:         * Date: $Date: 2006/07/05 21:40:01 $
007:         *
008:         * Copyright (c) 2002, 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:        /**
044:         * A class represented parameters to fields. The parameter element is basicaly a
045:         * grab bag of attributes associated with varios fields.
046:         * 
047:         * @author Scott Phillips
048:         */
049:
050:        import org.dspace.app.xmlui.wing.AttributeMap;
051:        import org.dspace.app.xmlui.wing.WingContext;
052:        import org.dspace.app.xmlui.wing.WingException;
053:        import org.xml.sax.ContentHandler;
054:        import org.xml.sax.SAXException;
055:        import org.xml.sax.ext.LexicalHandler;
056:        import org.xml.sax.helpers.NamespaceSupport;
057:
058:        public class Params extends AbstractWingElement implements 
059:                StructuralElement {
060:            /** The name of the params element */
061:            public static final String E_PARAMS = "params";
062:
063:            /** The name of the operations attribute */
064:            public static final String A_OPERATIONS = "operations";
065:
066:            /** The name of the return value attribute */
067:            public static final String A_RETURN_VALUE = "returnValue";
068:
069:            /** The name of the size attribute */
070:            public static final String A_SIZE = "size";
071:
072:            /** The name of the max length attribute */
073:            public static final String A_MAX_LENGTH = "maxlength";
074:
075:            /** The name of the multiple attribute */
076:            public static final String A_MULTIPLE = "multiple";
077:
078:            /** The name of the rows attribute */
079:            public static final String A_ROWS = "rows";
080:
081:            /** The name of the cols attribute */
082:            public static final String A_COLS = "cols";
083:
084:            /** Possible operations */
085:            public static final String OPERATION_ADD = "add";
086:
087:            public static final String OPERATION_DELETE = "delete";
088:
089:            public static final String[] OPERATIONS = { OPERATION_ADD,
090:                    OPERATION_DELETE };
091:
092:            /** *********** Parameter Attributes *************** */
093:
094:            /** The supported operations for this field */
095:            protected boolean addOperation;
096:            protected boolean deleteOperation;
097:
098:            /** The return value for the field, checkboxes and radio buttons. */
099:            protected String returnValue;
100:
101:            /** The field size */
102:            protected int size = -1;
103:
104:            /** The maximum length of the field */
105:            protected int maxlength = -1;
106:
107:            /** Weather multiple values for this field are allowed */
108:            protected boolean multiple = false;
109:
110:            /** The number of rows the field should span */
111:            protected int rows = -1;
112:
113:            /** The number of cols the field should span */
114:            protected int cols = -1;
115:
116:            /**
117:             * Construct a new parameter's element
118:             * 
119:             * @param context
120:             *            (Required) The context this element is contained in, such as
121:             *            where to route SAX events and what i18n catalogue to use.
122:             * 
123:             */
124:            protected Params(WingContext context) throws WingException {
125:                super (context);
126:            }
127:
128:            /**
129:             * Enable the add operation for this field set. When this is enabled the
130:             * front end will add a button to add more items to the field.
131:             * 
132:             */
133:            public void enableAddOperation() throws WingException {
134:                this .addOperation = true;
135:            }
136:
137:            /**
138:             * Enable the delete operation for this field set. When this is enabled then
139:             * the front end will provide a way for the user to select fields (probably
140:             * checkboxes) along with a submit button to delete the selected fields.
141:             * 
142:             */
143:            public void enableDeleteOperation() throws WingException {
144:                this .deleteOperation = true;
145:            }
146:
147:            /**
148:             * Set the size of the field.
149:             * 
150:             * This applies to text, password, and select fields.
151:             * 
152:             * @param size
153:             *            (Required) The size of the field.
154:             */
155:            public void setSize(int size) {
156:                this .size = size;
157:            }
158:
159:            /**
160:             * Set the maximum length of the field.
161:             * 
162:             * This applies to text, password, and textarea fields.
163:             * 
164:             * @param maxlength
165:             *            (Required) The maximum length of the field.
166:             */
167:            public void setMaxLength(int maxlength) {
168:                this .maxlength = maxlength;
169:            }
170:
171:            /**
172:             * Set the number of rows of this field.
173:             * 
174:             * The applies only to textarea fields.
175:             * 
176:             * @param rows
177:             *            (Required) The number of rows.
178:             */
179:            public void setRows(int rows) {
180:                this .rows = rows;
181:            }
182:
183:            /**
184:             * Set the number of columns of this field.
185:             * 
186:             * The applies only to textarea fields.
187:             * 
188:             * @param cols
189:             *            (Required) The number of columns.
190:             */
191:            public void setCols(int cols) {
192:                this .cols = cols;
193:            }
194:
195:            /**
196:             * The returned value for this field if it is checked (or selected).
197:             * 
198:             * The applies to radio and checkbox fields.
199:             * 
200:             * @param returnValue
201:             *            (Required) The value to be returned if this field is checked.
202:             */
203:            public void setReturnValue(String returnValue) {
204:                this .returnValue = returnValue;
205:            }
206:
207:            /**
208:             * Determine if this field can accept multiple values.
209:             * 
210:             * The applies only to select fields.
211:             * 
212:             * @param multiple
213:             *            (Required) whether the field can accept multiple values.
214:             */
215:            public void setMultiple(boolean multiple) {
216:                this .multiple = multiple;
217:            }
218:
219:            /**
220:             * Translate this element and all contained elements into SAX events. The
221:             * events should be routed to the contentHandler found in the WingContext.
222:             * 
223:             * @param contentHandler
224:             *            (Required) The registered contentHandler where SAX events
225:             *            should be routed too.
226:             * @param lexicalHandler
227:             *            (Required) The registered lexicalHandler where lexical events
228:             *            (such as CDATA, DTD, etc) should be routed too.
229:             * @param namespaces
230:             *            (Required) SAX Helper class to keep track of namespaces able
231:             *            to determine the correct prefix for a given namespace URI.
232:             */
233:            public void toSAX(ContentHandler contentHandler,
234:                    LexicalHandler lexicalHandler, NamespaceSupport namespaces)
235:                    throws SAXException {
236:                AttributeMap attributes = new AttributeMap();
237:
238:                // Determine if there are any operations
239:                String operations = null;
240:                if (addOperation) {
241:                    if (operations == null)
242:                        operations = OPERATION_ADD;
243:                    else
244:                        operations += " " + OPERATION_ADD;
245:                }
246:                if (addOperation) {
247:                    if (operations == null)
248:                        operations = OPERATION_DELETE;
249:                    else
250:                        operations += " " + OPERATION_DELETE;
251:                }
252:                if (operations != null)
253:                    attributes.put(A_OPERATIONS, operations);
254:
255:                if (this .returnValue != null) {
256:                    attributes.put(A_RETURN_VALUE, this .returnValue);
257:                }
258:
259:                if (this .size > -1) {
260:                    attributes.put(A_SIZE, this .size);
261:                }
262:
263:                if (this .maxlength > -1) {
264:                    attributes.put(A_MAX_LENGTH, this .maxlength);
265:                }
266:
267:                if (this .multiple == true) {
268:                    attributes.put(A_MULTIPLE, this .multiple);
269:                }
270:
271:                if (this .rows > -1) {
272:                    attributes.put(A_ROWS, this .rows);
273:                }
274:
275:                if (this .cols > -1) {
276:                    attributes.put(A_COLS, this .cols);
277:                }
278:
279:                startElement(contentHandler, namespaces, E_PARAMS, attributes);
280:                endElement(contentHandler, namespaces, E_PARAMS);
281:            }
282:
283:            /**
284:             * Dispose
285:             */
286:            public void dispose() {
287:                super.dispose();
288:            }
289:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.