Checkbox Component |
You can drag the Checkbox component
from the Palette's Basic category to the Visual Designer to create a single checkbox with an optional label.
If you want a set of checkboxes that is preformatted with labels in a group, you can use a Checkbox List component instead.
You can drop a checkbox on a container component, like a table cell or group box.
A checkbox can represent any object, whether the object is of a predefined class like Boolean, Byte, Character, Double, Float, Integer, Long, Short, String, or of a class defined by the user. A checkbox can also represent a primitive
value.
A Boolean value is useful for indicating whether an item, such as a table row, is selected. A String value is useful for passing values for checkbox selections made in the interface. An application defined Object value or class instance can be used to hold more information related to a checkbox selection.
A single checkbox can be used to represent several types of data:
A group of checkboxes can be used to represent:
The checkbox component can be useful in situations where the Checkbox Group component layout is not desirable, such as in a table row.
If you right-click the component, you can choose one of the following pop-up menu items:
selected property to a data provider or an object so your application can evaluate it when the page is submitted. For more information, see Bind to Data Dialog Box.
common_timeoutSubmitForm(this.form, 'component-id');. At runtime, this code causes the form to be automatically submitted if the user changes the component value. Once the form is submitted, conversion and validation occur on the server and any value change listener methods execute, and then the page is redisplayed.
selected property to other objects or bean properties that update this component's properties automatically.
The checkbox component uses both the selected and selectedValue properties to pass information about the checkbox's selection status. The selected property is used to indicate that the checkbox is selected and a checkmark is displayed in the page. The selectedValue property is used to pass a data value for the checkbox. A checkbox is considered to be selected when the value of the selected property is equal to the value of the selectedValue property. You can display a checkbox as selected on the initial viewing of the page by assigning the same value to the selectedValue and the selected properties.
If the selectedValue property is not specified or its value is null, the checkbox behaves like a boolean control. If the checkbox is selected, the value of the selected property is a true Boolean instance. If the checkbox is not selected, the value of the selected property will be a false Boolean instance.
A value binding expression that evaluates to a primitive value can be assigned to the selected and selectedValue properties.
If the selectedValue property is not specified or its value is null, the checkbox behaves like a boolean control.
To use the checkbox as a boolean control, do not specify a value for the selectedValue property. The checkbox is selected if the selected property is not null and has the value of a true Boolean instance or a boolean primitive value. If the checkbox is not selected, then the value of the selected property is a false Boolean instance or boolean primitive.
true values. The selectedValue property can be assigned an application-defined object value to represent the value of a selected checkbox. If the checkbox is selected, the value of the selected property is assigned the value of the selectedValue property.
If the value of the selectedValue property is an application-defined object, a converter must be registered to convert to and from a String value. The converter is used to encode the checkbox value as the value of the HTML <input> element and to decode the submitted value in a request. In addition the object must support an equals() method that returns true when the value of the selectedValue property is compared to the selected property value in order to detect a selected checkbox.
| Legal Notices. Copyright © 2006 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. |