Source Code Cross Referenced for Select.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:         * Select.java
003:         *
004:         * Version: $Revision: 1.2 $
005:         *
006:         * Date: $Date: 2006/07/06 17:02:03 $
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:         * 
045:         * A class representing a select input control. The select input control allows
046:         * the user to select from a list of available options.
047:         * 
048:         * @author Scott Phillips
049:         */
050:
051:        import org.dspace.app.xmlui.wing.Message;
052:        import org.dspace.app.xmlui.wing.WingContext;
053:        import org.dspace.app.xmlui.wing.WingException;
054:
055:        public class Select extends Field {
056:
057:            /**
058:             * Construct a new field.
059:             * 
060:             * @param context
061:             *            (Required) The context this element is contained in, such as
062:             *            where to route SAX events and what i18n catalogue to use.
063:             * 
064:             * @param name
065:             *            (Required) a non-unique local identifier used to differentiate
066:             *            the element from its siblings within an interactive division.
067:             *            This is the name of the field use when data is submitted back
068:             *            to the server.
069:             * @param rend
070:             *            (May be null) a rendering hint used to override the default
071:             *            display of the element.
072:             */
073:            protected Select(WingContext context, String name, String rend)
074:                    throws WingException {
075:                super (context, name, Field.TYPE_SELECT, rend);
076:                this .params = new Params(context);
077:            }
078:
079:            /**
080:             * Enable the user to select multiple options.
081:             * 
082:             */
083:            public void setMultiple() {
084:                this .params.setMultiple(true);
085:            }
086:
087:            /**
088:             * Set whether the user is able to select multiple options.
089:             * 
090:             * @param multiple
091:             *            (Required) The multiple state.
092:             */
093:            public void setMultiple(boolean multiple) {
094:                this .params.setMultiple(multiple);
095:            }
096:
097:            /**
098:             * Set the number of options visible at any one time.
099:             * 
100:             * @param size
101:             *            (Required) The number of options to display.
102:             */
103:            public void setSize(int size) {
104:                this .params.setSize(size);
105:            }
106:
107:            /**
108:             * Enable the add operation for this field. When this is enabled the
109:             * front end will add a button to add more items to the field.
110:             * 
111:             */
112:            public void enableAddOperation() throws WingException {
113:                this .params.enableAddOperation();
114:            }
115:
116:            /**
117:             * Enable the delete operation for this field. When this is enabled then
118:             * the front end will provide a way for the user to select fields (probably
119:             * checkboxes) along with a submit button to delete the selected fields.
120:             * 
121:             */
122:            public void enableDeleteOperation() throws WingException {
123:                this .params.enableDeleteOperation();
124:            }
125:
126:            /**
127:             * Add a select option.
128:             * 
129:             * @param returnValue
130:             *            (Required) The value to be passed back if this option is
131:             *            selected.
132:             */
133:            public Option addOption(String returnValue) throws WingException {
134:                Option option = new Option(context, returnValue);
135:                options.add(option);
136:
137:                return option;
138:            }
139:
140:            /**
141:             * Add a select option.
142:             * 
143:             * @param selected
144:             *            (Required) Set the field as selected.
145:             * @param returnValue
146:             *            (Required) The value to be passed back if this option is
147:             *            selected.
148:             */
149:            public Option addOption(boolean selected, String returnValue)
150:                    throws WingException {
151:                if (selected)
152:                    setOptionSelected(returnValue);
153:                return addOption(returnValue);
154:            }
155:
156:            /**
157:             * Add a select option.
158:             * 
159:             * @param returnValue
160:             *            (Required) The value to be passed back if this option is
161:             *            selected.
162:             * @param characters
163:             *            (Required) The text to set as the visible option.
164:             */
165:            public void addOption(String returnValue, String characters)
166:                    throws WingException {
167:                Option option = this .addOption(returnValue);
168:                option.addContent(characters);
169:            }
170:
171:            /**
172:             * Add a select option.
173:             * 
174:             * @param selected
175:             *            (Required) Set the field as selected.
176:             * @param returnValue
177:             *            (Required) The value to be passed back if this option is
178:             *            selected.
179:             * @param characters
180:             *            (Required) The text to set as the visible option.
181:             */
182:            public void addOption(boolean selected, String returnValue,
183:                    String characters) throws WingException {
184:                if (selected)
185:                    setOptionSelected(returnValue);
186:                addOption(returnValue, characters);
187:            }
188:
189:            /**
190:             * Add a select option.
191:             * 
192:             * @param returnValue
193:             *            (Required) The value to be passed back if this option is
194:             *            selected.
195:             * @param characters
196:             *            (Required) The text to set as the visible option.
197:             */
198:            public void addOption(int returnValue, String characters)
199:                    throws WingException {
200:                Option option = this .addOption(String.valueOf(returnValue));
201:                option.addContent(characters);
202:            }
203:
204:            /**
205:             * Add a select option.
206:             * 
207:             * @param selected
208:             *            (Required) Set the field as selected.
209:             * @param returnValue
210:             *            (Required) The value to be passed back if this option is
211:             *            selected.
212:             * @param characters
213:             *            (Required) The text to set as the visible option.
214:             */
215:            public void addOption(boolean selected, int returnValue,
216:                    String characters) throws WingException {
217:                if (selected)
218:                    setOptionSelected(returnValue);
219:                addOption(returnValue, characters);
220:            }
221:
222:            /**
223:             * Add a select option.
224:             * 
225:             * @param returnValue
226:             *            (Required) The value to be passed back if this option is
227:             *            selected.
228:             * @param message
229:             *            (Required) The transalted text to set as the visible option.
230:             */
231:            public void addOption(String returnValue, Message message)
232:                    throws WingException {
233:                Option option = this .addOption(returnValue);
234:                option.addContent(message);
235:            }
236:
237:            /**
238:             * Add a select option.
239:             * 
240:             * @param selected
241:             *            (Required) Set the field as selected.
242:             * @param returnValue
243:             *            (Required) The value to be passed back if this option is
244:             *            selected.
245:             * @param message
246:             *            (Required) The transalted text to set as the visible option.
247:             */
248:            public void addOption(boolean selected, String returnValue,
249:                    Message message) throws WingException {
250:                if (selected)
251:                    setOptionSelected(returnValue);
252:                addOption(returnValue, message);
253:            }
254:
255:            /**
256:             * Add a select option.
257:             * 
258:             * @param returnValue
259:             *            (Required) The value to be passed back if this option is
260:             *            selected.
261:             * @param message
262:             *            (Required) The transalted text to set as the visible option.
263:             */
264:            public void addOption(int returnValue, Message message)
265:                    throws WingException {
266:                Option option = this .addOption(String.valueOf(returnValue));
267:                option.addContent(message);
268:            }
269:
270:            /**
271:             * Add a select option.
272:             * 
273:             * @param selected
274:             *            (Required) Set the field as selected.
275:             * @param returnValue
276:             *            (Required) The value to be passed back if this option is
277:             *            selected.
278:             * @param message
279:             *            (Required) The transalted text to set as the visible option.
280:             */
281:            public void addOption(boolean selected, int returnValue,
282:                    Message message) throws WingException {
283:                if (selected)
284:                    setOptionSelected(returnValue);
285:                addOption(returnValue, message);
286:            }
287:
288:            /**
289:             * Set the given option as selected.
290:             * 
291:             * @param returnValue
292:             *            (Required) The return value of the option to be selected.
293:             */
294:            public void setOptionSelected(String returnValue)
295:                    throws WingException {
296:                Value value = new Value(context, Value.TYPE_OPTION, returnValue);
297:                values.add(value);
298:            }
299:
300:            /**
301:             * Set the given option as selected.
302:             * 
303:             * @param returnValue
304:             *            (Required) The return value of the option to be selected.
305:             */
306:            public void setOptionSelected(int returnValue) throws WingException {
307:                Value value = new Value(context, Value.TYPE_OPTION, String
308:                        .valueOf(returnValue));
309:                values.add(value);
310:            }
311:
312:            /**
313:             * Add a field instance
314:             * @return instance
315:             */
316:            public Instance addInstance() throws WingException {
317:                Instance instance = new Instance(context);
318:                instances.add(instance);
319:                return instance;
320:            }
321:
322:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.