Source Code Cross Referenced for CheckboxGroupBase.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:         * <p>
051:         * 	Use the <code>ui:checkboxGroup</code> tag to display two or more
052:         * 	check boxes in a grid layout in the rendered HTML page. The
053:         * 	<code>ui:checkboxGroup</code> tag attributes that you
054:         * 	specify determine how the check boxes are displayed. 
055:         * </p>
056:         * <p>
057:         * 	If the <code>label</code> attribute is specified a
058:         * 	<code>com.sun.rave.web.ui.component.Label</code> component
059:         * 	is rendered before the first checkbox and
060:         * 	identifies the checkbox group. The label component's
061:         * 	<code>for</code> attribute is 
062:         * 	set to the <code>id</code> attribute of the first checkbox in
063:         * 	the rendered HTML page.
064:         * </p>
065:         * <p>
066:         * 	The check boxes are laid out in rows and columns in an HTML 
067:         * 	&lt;table&gt; element. The number of rows is defined by the length 
068:         * 	of the items array. The number of columns is defined by the columns
069:         * 	attribute. The default layout is a single vertical column.
070:         * </p>
071:         * <p>
072:         * </p>
073:         * <p>
074:         * 	The <code>items</code> attribute must be a value binding expression.
075:         * 	The value binding expression assigned to the <code>items</code>
076:         * 	property evaluates to an <code>Object</code> array of 
077:         * 	<code>com.sun.rave.web.ui.model.Option</code> instances. Each
078:         * 	instance represents one checkbox. The <code>value</code> property
079:         * 	of an <code>Option</code> instance represents the value of a
080:         * 	selected checkbox.
081:         * 	If the <code>items</code> array is empty nothing is rendered.
082:         * </p>
083:         * <p>	
084:         * 	Zero or more check boxes may be selected.
085:         * 	The <code>selected</code> attribute must also be a value binding
086:         * 	expression that is evaluated to read and write an <code>Object</code>
087:         * 	array. When an array is read from the value binding expression,
088:         * 	it identifies the selected checkboxes. Each element in the array
089:         * 	is an <code>Object</code> value. Each <code>Object</code> value must
090:         * 	be equal to the value property of at least one <code>Option</code>
091:         * 	instance specified in the array obtained from the value binding
092:         * 	expression assigned to the <code>items</code> attribute.
093:         * </p>
094:         * <p>
095:         * 	The write method of the <code>selected</code> attribute's value
096:         * 	binding expression is called during the <code>UPDATE_MODEL_PHASE</code>
097:         * 	of the JSF lifecyle. If one or more checkboxes are selected
098:         * 	an <code>Object</code> array is passed as an argument to the
099:         * 	write method. This array contains the <code>Object</code>
100:         * 	values of the selected checkboxes.
101:         * </p>
102:         * 	<h3>HTML Elements and Layout</h3>
103:         * <p>
104:         * 	A <code>ui:checkboxGroup</code> renders one
105:         * 	<code>com.sun.rave.web.ui.component.Checkbox</code> component for
106:         * 	each element in the <code>items</code> array.
107:         * 	See <a href="checkbox.html" target="tagFrame">ui:checkbox</a> for
108:         * 	details on the HTML elements and components rendered for a 
109:         * 	checkbox.
110:         * </p>
111:         * <p>
112:         * 	The value of the <code>name</code> attribute of each 
113:         * 	<code>Checkbox</code> component rendered is assigned the
114:         * 	<code>clientId</code> of the <code>CheckboxGroup<code>
115:         * 	component instance associated with this tag. The <code>id</code>
116:         * 	attribute of each <code>Checkbox</code> component rendered 
117:         * 	is formed as follows, where <em>cbgrpid</em> is the id of the
118:         * 	<code>CheckboxGroup</code> instance and <em>N</em> is the nth
119:         * 	checkbox.
120:         * </p>
121:         * 	<ul>
122:         * 	<li> <em>cbgrpid_N</em></li>
123:         * 	</ul>
124:         * <p>
125:         * 	See <a href="checkbox.html" target="tagFrame">ui:checkbox</a> for
126:         * 	details on how the id properties of the components that make up the 
127:         * 	checkbox are defined.
128:         * </p>
129:         * 	<h3>Client Side Javascript Functions</h3>
130:         * <p>
131:         * 	none.
132:         * </p>
133:         * 
134:         * 	<h3>Example</h3>
135:         * 	<b>Example 1: Create a checkbox group</b>
136:         * <p>
137:         * 	<code>
138:         * 	&nbsp;&lt;ui:checkboxGroup items="#{rbcbGrp.selections}"</br>
139:         * 	&nbsp;&nbsp;&nbsp;&nbsp;label="#{rbcbGrp.cbGrpLabel}"</br>
140:         * 	&nbsp;&nbsp;&nbsp;&nbsp;toolTip="cbgrp-tooltip"</br>
141:         * 	&nbsp;&nbsp;&nbsp;&nbsp;disabled="false"</br>
142:         * 	&nbsp;&nbsp;&nbsp;&nbsp;tabIndex="4"</br>
143:         * 	&nbsp;&nbsp;&nbsp;&nbsp;selected="#{rbcbGrp.cbvalue}"&gt;</br>
144:         * 	&nbsp;&lt;/ui:checkboxGroup&gt;</br>
145:         * 	</code>
146:         * </p>
147:         * <p>
148:         * 	This example creates a checkbox group with an identifying
149:         * 	label for the group before the first checkbox. The 
150:         * 	data for the checkboxes is obtained from the value binding
151:         * 	expression <code>#{rbcbGrp.selections}</code>. <code>rbcbGrp</code>
152:         * 	is an application defined managed bean and provides the values for
153:         * 	other attributes such as <code>selected</code> to receive the
154:         * 	value of the selected checkboxes in the group.
155:         * </p>
156:         * 	<!--
157:         * 	<h3>Theme Identifiers</h3>
158:         * <p>
159:         * 	<ul>
160:         * 	<li>CbGrp for the TABLE element.</li>
161:         * 	<li>CbGrpCpt for the TD element containing the group label</li>
162:         * 	<li>CbGrpLbl for the LABEL element used as the CAPTION</li>
163:         * 	<li>CbGrpLblDis for the LABEL used as the CAPTION if the group is disabled</li>
164:         * 	<li>CbGrpRwEv for even TR elements</li>
165:         * 	<li>CbGrpRwOd for odd TR elements</li>
166:         * 	<li>CbGrpClEv for even TD elements</li>
167:         * 	<li>CbGrpClOd for odd TD elements</li>
168:         * 	<li>Cb for the INPUT element</li>
169:         * 	<li>CbDis for the INPUT element for disabled check box </li>
170:         * 	<li>CbLbl for a LABEL element of a check box</li>
171:         * 	<li>CbLblDis for a LABEL element of a disabled check box</li>
172:         * 	<li>CbImg for an IMG element of a check box</li>
173:         * 	<li>CbImgDis for an IMG element of a disabled check box</li>
174:         * 	<li>CbGrp - for the <em>span</em> element that encloses the
175:         * 	  entire set of elements rendered for the <code>checkboxGroup</code>.
176:         * 	</li>
177:         * 	</ul>
178:         * </p>
179:         * 	-->
180:         * <p>Auto-generated component class.
181:         * Do <strong>NOT</strong> modify; all changes
182:         * <strong>will</strong> be lost!</p>
183:         */
184:
185:        public abstract class CheckboxGroupBase extends
186:                com.sun.rave.web.ui.component.Selector {
187:
188:            /**
189:             * <p>Construct a new <code>CheckboxGroupBase</code>.</p>
190:             */
191:            public CheckboxGroupBase() {
192:                super ();
193:                setRendererType("com.sun.rave.web.ui.CheckboxGroup");
194:            }
195:
196:            /**
197:             * <p>Return the identifier of the component family to which this
198:             * component belongs.  This identifier, in conjunction with the value
199:             * of the <code>rendererType</code> property, may be used to select
200:             * the appropriate {@link Renderer} for this component instance.</p>
201:             */
202:            public String getFamily() {
203:                return "com.sun.rave.web.ui.CheckboxGroup";
204:            }
205:
206:            // columns
207:            private int columns = Integer.MIN_VALUE;
208:            private boolean columns_set = false;
209:
210:            /**
211:             * <p>Defines how many columns may be used to lay out the check boxes.
212:             *         The value must be greater than or equal to one. The default value is one.
213:             *         Invalid values are ignored and the value is set to one.</p>
214:             */
215:            public int getColumns() {
216:                if (this .columns_set) {
217:                    return this .columns;
218:                }
219:                ValueBinding _vb = getValueBinding("columns");
220:                if (_vb != null) {
221:                    Object _result = _vb.getValue(getFacesContext());
222:                    if (_result == null) {
223:                        return Integer.MIN_VALUE;
224:                    } else {
225:                        return ((Integer) _result).intValue();
226:                    }
227:                }
228:                return 1;
229:            }
230:
231:            /**
232:             * <p>Defines how many columns may be used to lay out the check boxes.
233:             *         The value must be greater than or equal to one. The default value is one.
234:             *         Invalid values are ignored and the value is set to one.</p>
235:             * @see #getColumns()
236:             */
237:            public void setColumns(int columns) {
238:                this .columns = columns;
239:                this .columns_set = true;
240:            }
241:
242:            // visible
243:            private boolean visible = false;
244:            private boolean visible_set = false;
245:
246:            /**
247:             * <p>Use the visible attribute to indicate whether the component should be
248:             *     viewable by the user in the rendered HTML page. If set to false, the
249:             *     HTML code for the component is present in the page, but the component
250:             *     is hidden with style attributes. By default, visible is set to true, so
251:             *     HTML for the component HTML is included and visible to the user. If the
252:             *     component is not visible, it can still be processed on subsequent form
253:             *     submissions because the HTML is present.</p>
254:             */
255:            public boolean isVisible() {
256:                if (this .visible_set) {
257:                    return this .visible;
258:                }
259:                ValueBinding _vb = getValueBinding("visible");
260:                if (_vb != null) {
261:                    Object _result = _vb.getValue(getFacesContext());
262:                    if (_result == null) {
263:                        return false;
264:                    } else {
265:                        return ((Boolean) _result).booleanValue();
266:                    }
267:                }
268:                return true;
269:            }
270:
271:            /**
272:             * <p>Use the visible attribute to indicate whether the component should be
273:             *     viewable by the user in the rendered HTML page. If set to false, the
274:             *     HTML code for the component is present in the page, but the component
275:             *     is hidden with style attributes. By default, visible is set to true, so
276:             *     HTML for the component HTML is included and visible to the user. If the
277:             *     component is not visible, it can still be processed on subsequent form
278:             *     submissions because the HTML is present.</p>
279:             * @see #isVisible()
280:             */
281:            public void setVisible(boolean visible) {
282:                this .visible = visible;
283:                this .visible_set = true;
284:            }
285:
286:            /**
287:             * <p>Restore the state of this component.</p>
288:             */
289:            public void restoreState(FacesContext _context, Object _state) {
290:                Object _values[] = (Object[]) _state;
291:                super .restoreState(_context, _values[0]);
292:                this .columns = ((Integer) _values[1]).intValue();
293:                this .columns_set = ((Boolean) _values[2]).booleanValue();
294:                this .visible = ((Boolean) _values[3]).booleanValue();
295:                this .visible_set = ((Boolean) _values[4]).booleanValue();
296:            }
297:
298:            /**
299:             * <p>Save the state of this component.</p>
300:             */
301:            public Object saveState(FacesContext _context) {
302:                Object _values[] = new Object[5];
303:                _values[0] = super .saveState(_context);
304:                _values[1] = new Integer(this .columns);
305:                _values[2] = this .columns_set ? Boolean.TRUE : Boolean.FALSE;
306:                _values[3] = this .visible ? Boolean.TRUE : Boolean.FALSE;
307:                _values[4] = this.visible_set ? Boolean.TRUE : Boolean.FALSE;
308:                return _values;
309:            }
310:
311:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.