You see the Properties window for a Checkbox Group component when you select the component on a page you are editing in the Visual Designer. This JavaServer Faces 1.2 component has the following properties.
Type: String
id
attribute. In the page bean, this property's value is the name of the CheckboxGroup
object.Type: int
<table>
element. The number of rows is defined by the length of the items
array. The number of columns is defined by the columns attribute. The default layout is a single vertical column. Type: String
for
property is set to the first checkbox in the group.
label
property is not as flexible as the Label component. You can use the Label component if you want more control over the label's appearance, such as positioning of the label relative to the component. Type: int
label
property is set. Type: String
position: absolute; left: 288px; top: 312px
You can enter values directly or click the ellipsis (...) button to use the Style Editor.
For a list of CSS2 style attributes, see the web page at
Type: String
style
property description for an explanation of why a class added to this property might appear to have no effect on the component. Type: Converter
enum
class as a parameter, as described in Enum Converter. Type: Object
com.sun.webui.jsf.model.Option
. Each Option
instance represents one checkbox. The value
property of an Option
instance represents the value of a selected checkbox. If the items
property is empty or the array, map or collection is empty, nothing is rendered.
For more information on com.sun.webui.jsf.model.Option
, include this class in the Java view of a page, put the cursor on the class name, and press Alt-F1 to see its Javadoc description.
By default, this property is associated with a com.sun.webui.jsf.model.MultipleSelectOptionsList
object with a name similar to checkboxGroup1DefaultOptions
, whose node you can see in the This object serves simply to populate the group with default checkboxes. It is in the page bean.
Type: boolean
for
property to this component, an error message will be displayed if the user tries to submit the page without selecting an item.
Type: Object
The Checkbox Group component can have more than one value, which has implications about what type of value you can use.
Object
array or an array of primitives. The individual elements in this array represent the currently selected values from the set of all possible options. checkboxGroup.getValue()
is an Object
array.A common way to process the values chosen by the user is to bind this component to an Object
array and check the array values when the user submits the page. The selected
property must be a value binding expression that is evaluated to read and write an Object
. An Object
value read from the value binding expression identifies the selected checkbox. The Object
value must be equal to the value
attribute of at least one Option
instance specified in the array obtained from the value binding expression assigned to the items
property.
The write method of the selected
property's value binding expression is called during the UPDATE_MODEL_PHASE
of the JavaServer Faces lifecyle. If a checkbox is selected, an Object
value is passed as an argument to the write
method. The Object
value is the value of the selected radio button.
See the link to the Listbox Components tutorial at the end of the page for more information.
Type: MethodExpression
Choose a validator from the drop down list. If you choose (null)
, no validator is called.If you choose a validator, you might also want to select the required
property to ensure that the user enters a value.
Set the event properties by right-clicking the component in the Visual Designer and choosing Edit Event Handler > eventname.
null
. You typically define this method in the page bean by right-clicking the component in the Visual Designer and choosing Edit Event Handler > processValueChange. The default name for the method is component-id_processValueChange
, where component-id is the value of the component's id
property.validatorExpression
property, right-click the component and choose Edit Event Handler > validate. The default name for the method is component-id_validate
, where component-id is the value of the component's id
property. When you define this method in this way, the validator
and validate
properties are automatically set for you. If you define a validator, you might also want to select the required
property to ensure that the user enters a value.
validatorExpression
property. If you define your own validate method, do not separately change the value of the validatorExpression
property, or you will lose the connection to your validate method. Type: boolean
readOnly
property concerning the effects of using the disabled
property versus the effects of using the readOnly
property. Type: boolean
disabled
property, JavaServer Faces does not detect that any value at all was submitted. Type: String
title
attribute for the component. The text value of this property displays if the user hovers the mouse cursor over the checkbox group's label.
Type: boolean
rendered
property. Type: String
Type: String
Type: String
Type: String
Type: String
Type: String
Type: String
Type: String
Type: String
Type: String
Type: String
Type: boolean
The most common example of an immediate action is a Cancel button. You make it immediate so that the normal validation and update steps can be skipped, but the action handler can still do whatever is necessary. Typically, the action handler will navigate back to some previous page. In some designs the action handler might also enqueue an informational message like "Transaction cancelled". It is possible to do more: for example, an application might record the fact that the user cancelled the current operation.
Type: boolean
visible
property instead of this property.
You can bind this property to a JavaBeans property that determines when the component does get rendered. For example, an airline reservation form might show a component for frequent flyers and not show it for the general public. To bind this property, click the ellipsis button (...) to the right of the property and choose Use Binding in the dialog box.