Source Code Cross Referenced for ListChoice.java in  » J2EE » wicket » org » apache » wicket » markup » html » form » 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 » J2EE » wicket » org.apache.wicket.markup.html.form 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Licensed to the Apache Software Foundation (ASF) under one or more
003:         * contributor license agreements.  See the NOTICE file distributed with
004:         * this work for additional information regarding copyright ownership.
005:         * The ASF licenses this file to You under the Apache License, Version 2.0
006:         * (the "License"); you may not use this file except in compliance with
007:         * the License.  You may obtain a copy of the License at
008:         *
009:         *      http://www.apache.org/licenses/LICENSE-2.0
010:         *
011:         * Unless required by applicable law or agreed to in writing, software
012:         * distributed under the License is distributed on an "AS IS" BASIS,
013:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         * See the License for the specific language governing permissions and
015:         * limitations under the License.
016:         */
017:        package org.apache.wicket.markup.html.form;
018:
019:        import java.util.List;
020:
021:        import org.apache.wicket.markup.ComponentTag;
022:        import org.apache.wicket.model.IModel;
023:
024:        /**
025:         * Essentially a drop down choice that doesn't drop down. Instead, it scrolls
026:         * and displays a given number of rows.
027:         * 
028:         * @author Jonathan Locke
029:         * @author Johan Compagner
030:         * @author Eelco Hillenius
031:         */
032:        public class ListChoice extends DropDownChoice {
033:            private static final long serialVersionUID = 1L;
034:
035:            /** The default maximum number of rows to display. */
036:            private static int defaultMaxRows = 8;
037:
038:            /** The maximum number of rows to display. */
039:            private int maxRows;
040:
041:            /**
042:             * Gets the default maximum number of rows to display.
043:             * 
044:             * @return Returns the defaultMaxRows.
045:             */
046:            protected static int getDefaultMaxRows() {
047:                return defaultMaxRows;
048:            }
049:
050:            /**
051:             * Sets the default maximum number of rows to display.
052:             * 
053:             * @param defaultMaxRows
054:             *            The defaultMaxRows to set.
055:             */
056:            protected static void setDefaultMaxRows(final int defaultMaxRows) {
057:                ListChoice.defaultMaxRows = defaultMaxRows;
058:            }
059:
060:            /**
061:             * @see org.apache.wicket.markup.html.form.AbstractChoice#AbstractChoice(String)
062:             */
063:            public ListChoice(final String id) {
064:                this (id, null, (List) null, null, defaultMaxRows);
065:            }
066:
067:            /**
068:             * @see org.apache.wicket.markup.html.form.AbstractChoice#AbstractChoice(String,
069:             *      List)
070:             */
071:            public ListChoice(final String id, final List choices) {
072:                this (id, null, choices, null, defaultMaxRows);
073:            }
074:
075:            /**
076:             * @param id
077:             *            See Component
078:             * @param choices
079:             *            The collection of values in the list
080:             * @param renderer
081:             *            See AbstractChoice
082:             * @see org.apache.wicket.markup.html.form.AbstractChoice#AbstractChoice(String,
083:             *      List,IChoiceRenderer)
084:             */
085:            public ListChoice(final String id, final List choices,
086:                    final IChoiceRenderer renderer) {
087:                this (id, null, choices, renderer, defaultMaxRows);
088:            }
089:
090:            /**
091:             * @param id
092:             *            See Component
093:             * @param model
094:             *            See Component
095:             * @param choices
096:             *            The collection of values in the list
097:             * @see DropDownChoice#DropDownChoice(String, IModel, List)
098:             */
099:            public ListChoice(final String id, final IModel model,
100:                    final List choices) {
101:                this (id, model, choices, null, defaultMaxRows);
102:            }
103:
104:            /**
105:             * @param id
106:             *            See Component
107:             * @param model
108:             *            See Component
109:             * @param choices
110:             *            The collection of values in the list
111:             * @param maxRows
112:             *            Maximum number of rows to show
113:             * @see DropDownChoice#DropDownChoice(String, IModel, List)
114:             */
115:            public ListChoice(final String id, final IModel model,
116:                    final List choices, final int maxRows) {
117:                this (id, model, choices, null, maxRows);
118:            }
119:
120:            /**
121:             * @param id
122:             *            See Component
123:             * @param model
124:             *            See Component
125:             * @param choices
126:             *            The collection of values in the list
127:             * @param renderer
128:             *            See AbstractChoice
129:             * @see DropDownChoice#DropDownChoice(String, IModel, List)
130:             */
131:            public ListChoice(final String id, final IModel model,
132:                    final List choices, final IChoiceRenderer renderer) {
133:                this (id, model, choices, renderer, defaultMaxRows);
134:            }
135:
136:            /**
137:             * @param id
138:             *            See Component
139:             * @param model
140:             *            See Component
141:             * @param choices
142:             *            The collection of values in the list
143:             * @param renderer
144:             *            See AbstractChoice
145:             * @param maxRows
146:             *            Maximum number of rows to show
147:             * @see DropDownChoice#DropDownChoice(String, IModel, List)
148:             */
149:            public ListChoice(final String id, final IModel model,
150:                    final List choices, final IChoiceRenderer renderer,
151:                    final int maxRows) {
152:                super (id, model, choices, renderer);
153:                this .maxRows = maxRows;
154:            }
155:
156:            /**
157:             * @see org.apache.wicket.markup.html.form.AbstractChoice#AbstractChoice(String,
158:             *      IModel)
159:             */
160:            public ListChoice(String id, IModel choices) {
161:                this (id, null, choices, null, defaultMaxRows);
162:            }
163:
164:            /**
165:             * @see org.apache.wicket.markup.html.form.AbstractChoice#AbstractChoice(String,
166:             *      IModel,IModel)
167:             */
168:            public ListChoice(String id, IModel model, IModel choices) {
169:                this (id, model, choices, null, defaultMaxRows);
170:            }
171:
172:            /**
173:             * @see org.apache.wicket.markup.html.form.AbstractChoice#AbstractChoice(String,
174:             *      IModel,IChoiceRenderer)
175:             */
176:            public ListChoice(String id, IModel choices,
177:                    IChoiceRenderer renderer) {
178:                this (id, null, choices, renderer, defaultMaxRows);
179:            }
180:
181:            /**
182:             * @see org.apache.wicket.markup.html.form.AbstractChoice#AbstractChoice(String,
183:             *      IModel, IModel,IChoiceRenderer)
184:             */
185:            public ListChoice(String id, IModel model, IModel choices,
186:                    IChoiceRenderer renderer) {
187:                this (id, model, choices, renderer, defaultMaxRows);
188:            }
189:
190:            /**
191:             * @see org.apache.wicket.markup.html.form.AbstractChoice#AbstractChoice(String,
192:             *      IModel, IModel,IChoiceRenderer)
193:             */
194:            public ListChoice(String id, IModel model, IModel choices,
195:                    IChoiceRenderer renderer, int maxRows) {
196:                super (id, model, choices, renderer);
197:                this .maxRows = maxRows;
198:            }
199:
200:            /**
201:             * Gets the maximum number of rows to display.
202:             * 
203:             * @return the maximum number of rows to display
204:             */
205:            public final int getMaxRows() {
206:                return maxRows;
207:            }
208:
209:            /**
210:             * Sets the maximum number of rows to display.
211:             * 
212:             * @param maxRows
213:             *            the maximum number of rows to display
214:             * @return This
215:             */
216:            public final ListChoice setMaxRows(int maxRows) {
217:                this .maxRows = maxRows;
218:                return this ;
219:            }
220:
221:            /**
222:             * @see org.apache.wicket.Component#onComponentTag(ComponentTag)
223:             */
224:            protected final void onComponentTag(final ComponentTag tag) {
225:                super .onComponentTag(tag);
226:                if (!tag.getAttributes().containsKey("size")) {
227:                    tag.put("size", maxRows);
228:                }
229:            }
230:
231:            /**
232:             * @see org.apache.wicket.markup.html.form.FormComponent#supportsPersistence()
233:             */
234:            protected final boolean supportsPersistence() {
235:                return true;
236:            }
237:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.