Source Code Cross Referenced for ListboxBase.java in  » IDE-Netbeans » visualweb.api.designer » com » sun » rave » web » ui » component » 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 » IDE Netbeans » visualweb.api.designer » com.sun.rave.web.ui.component 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003:         *
004:         * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005:         *
006:         * The contents of this file are subject to the terms of either the GNU
007:         * General Public License Version 2 only ("GPL") or the Common
008:         * Development and Distribution License("CDDL") (collectively, the
009:         * "License"). You may not use this file except in compliance with the
010:         * License. You can obtain a copy of the License at
011:         * http://www.netbeans.org/cddl-gplv2.html
012:         * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013:         * specific language governing permissions and limitations under the
014:         * License.  When distributing the software, include this License Header
015:         * Notice in each file and include the License file at
016:         * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
017:         * particular file as subject to the "Classpath" exception as provided
018:         * by Sun in the GPL Version 2 section of the License file that
019:         * accompanied this code. If applicable, add the following below the
020:         * License Header, with the fields enclosed by brackets [] replaced by
021:         * your own identifying information:
022:         * "Portions Copyrighted [year] [name of copyright owner]"
023:         *
024:         * Contributor(s):
025:         *
026:         * The Original Software is NetBeans. The Initial Developer of the Original
027:         * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
028:         * Microsystems, Inc. All Rights Reserved.
029:         *
030:         * If you wish your version of this file to be governed by only the CDDL
031:         * or only the GPL Version 2, indicate your decision by adding
032:         * "[Contributor] elects to include this software in this distribution
033:         * under the [CDDL or GPL Version 2] license." If you do not indicate a
034:         * single choice of license, a recipient has the option to distribute
035:         * your version of this file under either the CDDL, the GPL Version 2 or
036:         * to extend the choice of license to its licensees as provided above.
037:         * However, if you add GPL Version 2 code and therefore, elected the GPL
038:         * Version 2 license, then the option applies only if the new code is
039:         * made subject to such option by the copyright holder.
040:         */
041:        package com.sun.rave.web.ui.component;
042:
043:        import java.io.IOException;
044:        import javax.faces.component.UIComponent;
045:        import javax.faces.context.FacesContext;
046:        import javax.faces.el.MethodBinding;
047:        import javax.faces.el.ValueBinding;
048:
049:        /**
050:         * <h4>About this tag</h4>
051:         * 
052:         *     <p>This tag renders a listbox. Use the <code>selected</code>
053:         *     attribute to associate the component with a model object that
054:         *     represents the current choice, by setting the value to an EL
055:         *     expression that corresponds to a property of a
056:         *     managed bean.</p> 
057:         * 
058:         *     <h4>Configuring the listbox tag</h4>
059:         * 
060:         *     <p>Use the <code>multiple</code> attribute to specify whether the
061:         *     component accepts multiple selections. By default this is set to
062:         *     false. If multiple selections are allowed, the model object
063:         *     property must be either an array of primitives, an array of
064:         *     objects, or a (subclass of) <code>java.util.List</code>.</p> 
065:         * 
066:         *     <p>Use the <code>items</code> attribute to specify the options
067:         *     from which the web application user can choose. The value must be
068:         *     an EL expression that identifies an array, a
069:         *     <code>java.util.Collection</code> or a <code>java.util.Map</code>
070:         *     of <code>com.sun.rave.web.ui.Option</code>. </p> 
071:         * 
072:         *     <p>The first time the component is rendered, the options which
073:         *     correspond to the value of the <code>selected</code> model object
074:         *     property is marked as selected, using the <code>equals</code>
075:         *     method on the model object. </p> 
076:         * 
077:         *     <p>The number of list items simultaneously shown can be specified
078:         *     using the <code>rows</code> attribute, and the component will be
079:         *     rendered using a monospaced font if the <code>useMonospace</code>
080:         *     attribute is set to true.</p>
081:         * 
082:         *     <p>To optionally specify a label for the component, use the
083:         *     <code>label</code> attribute, or specify a label facet.</p>
084:         * 
085:         *     <h4>Facets</h4>
086:         * 
087:         *     <ul>
088:         *     <li><code>label</code>: use this facet to specify a custom 
089:         *     component for the label.</li>
090:         *     </ul>
091:         * 
092:         *     <h4>Client-side JavaScript functions</h4>
093:         * 
094:         *     <ul>
095:         *     <li><code>listbox_setDisabled(&lt;id&gt;, &lt;disabled&gt;)</code>: use
096:         *     this function to enable/disable the listbox. <code>&lt;id&gt;</code>
097:         *     must be the generated id of the component. Set
098:         *     <code>&lt;disabled&gt;</code> to true to disable the component, 
099:         *     false to enable it. </li>
100:         *     <li><code>listbox_changed(&lt;id&gt;)</code>: this 
101:         *     function is automatically invoked by the listbox's
102:         *     <code>onchange</code> handler. <code>&lt;id&gt;</code>
103:         *     must be the generated id of the component.</li>
104:         *     </ul>
105:         * 
106:         *     <h4>Examples</h4>
107:         * <pre>
108:         * 
109:         *     &lt;ui:listbox selected="#{flightSearch.leaveAirport}" 
110:         *                  items="#{dataBean.airports}" 
111:         *                  rows="6"
112:         *                  id="leaveAirport" 
113:         *                  toolTip="#{msgs.chooseAirport}"
114:         *                  label="#{msgs.chooseDepartureAirport)" /&gt;
115:         * 
116:         *     &lt;ui:listbox selected="#{flightSearch.leaveAirport}" 
117:         *                  items="#{dataBean.airports}" 
118:         *                  rows="6"
119:         *  	         id="leaveAirport" 
120:         *                  toolTip="#{msgs.chooseAirport}"
121:         *                  label="#{msgs.chooseDepartureAirport)" &gt;
122:         *         &lt;f:facet name="label"&gt;
123:         *             &lt;facet component goes here&gt;
124:         *         &lt;/f:facet&gt;
125:         *     &lt;/ui:listbox&gt;
126:         * </pre>
127:         * <p>Auto-generated component class.
128:         * Do <strong>NOT</strong> modify; all changes
129:         * <strong>will</strong> be lost!</p>
130:         */
131:
132:        public abstract class ListboxBase extends
133:                com.sun.rave.web.ui.component.ListSelector {
134:
135:            /**
136:             * <p>Construct a new <code>ListboxBase</code>.</p>
137:             */
138:            public ListboxBase() {
139:                super ();
140:                setRendererType("com.sun.rave.web.ui.Listbox");
141:            }
142:
143:            /**
144:             * <p>Return the identifier of the component family to which this
145:             * component belongs.  This identifier, in conjunction with the value
146:             * of the <code>rendererType</code> property, may be used to select
147:             * the appropriate {@link Renderer} for this component instance.</p>
148:             */
149:            public String getFamily() {
150:                return "com.sun.rave.web.ui.Listbox";
151:            }
152:
153:            // monospace
154:            private boolean monospace = false;
155:            private boolean monospace_set = false;
156:
157:            /**
158:             * <p>A property which indicates whether monospaced fonts should be
159:             *       used.</p>
160:             */
161:            public boolean isMonospace() {
162:                if (this .monospace_set) {
163:                    return this .monospace;
164:                }
165:                ValueBinding _vb = getValueBinding("monospace");
166:                if (_vb != null) {
167:                    Object _result = _vb.getValue(getFacesContext());
168:                    if (_result == null) {
169:                        return false;
170:                    } else {
171:                        return ((Boolean) _result).booleanValue();
172:                    }
173:                }
174:                return false;
175:            }
176:
177:            /**
178:             * <p>A property which indicates whether monospaced fonts should be
179:             *       used.</p>
180:             * @see #isMonospace()
181:             */
182:            public void setMonospace(boolean monospace) {
183:                this .monospace = monospace;
184:                this .monospace_set = true;
185:            }
186:
187:            // multiple
188:            private boolean multiple = false;
189:            private boolean multiple_set = false;
190:
191:            /**
192:             * <p>Flag indicating that the application user may make select
193:             * 	more than one option from the listbox .</p>
194:             */
195:            public boolean isMultiple() {
196:                if (this .multiple_set) {
197:                    return this .multiple;
198:                }
199:                ValueBinding _vb = getValueBinding("multiple");
200:                if (_vb != null) {
201:                    Object _result = _vb.getValue(getFacesContext());
202:                    if (_result == null) {
203:                        return false;
204:                    } else {
205:                        return ((Boolean) _result).booleanValue();
206:                    }
207:                }
208:                return false;
209:            }
210:
211:            /**
212:             * <p>Flag indicating that the application user may make select
213:             * 	more than one option from the listbox .</p>
214:             * @see #isMultiple()
215:             */
216:            public void setMultiple(boolean multiple) {
217:                this .multiple = multiple;
218:                this .multiple_set = true;
219:            }
220:
221:            /**
222:             * <p>Restore the state of this component.</p>
223:             */
224:            public void restoreState(FacesContext _context, Object _state) {
225:                Object _values[] = (Object[]) _state;
226:                super .restoreState(_context, _values[0]);
227:                this .monospace = ((Boolean) _values[1]).booleanValue();
228:                this .monospace_set = ((Boolean) _values[2]).booleanValue();
229:                this .multiple = ((Boolean) _values[3]).booleanValue();
230:                this .multiple_set = ((Boolean) _values[4]).booleanValue();
231:            }
232:
233:            /**
234:             * <p>Save the state of this component.</p>
235:             */
236:            public Object saveState(FacesContext _context) {
237:                Object _values[] = new Object[5];
238:                _values[0] = super .saveState(_context);
239:                _values[1] = this .monospace ? Boolean.TRUE : Boolean.FALSE;
240:                _values[2] = this .monospace_set ? Boolean.TRUE : Boolean.FALSE;
241:                _values[3] = this .multiple ? Boolean.TRUE : Boolean.FALSE;
242:                _values[4] = this.multiple_set ? Boolean.TRUE : Boolean.FALSE;
243:                return _values;
244:            }
245:
246:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.