Use the ui:checkboxGroup tag to display two or more
check boxes in a grid layout in the rendered HTML page. The
ui:checkboxGroup tag attributes that you
specify determine how the check boxes are displayed.
If the label attribute is specified a
com.sun.rave.web.ui.component.Label component
is rendered before the first checkbox and
identifies the checkbox group. The label component's
for attribute is
set to the id attribute of the first checkbox in
the rendered HTML page.
The check boxes are laid out in rows and columns in an HTML
<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.
The items attribute must be a value binding expression.
The value binding expression assigned to the items
property evaluates to an Object array of
com.sun.rave.web.ui.model.Option instances. Each
instance represents one checkbox. The value property
of an Option instance represents the value of a
selected checkbox.
If the items array is empty nothing is rendered.
Zero or more check boxes may be selected.
The selected attribute must also be a value binding
expression that is evaluated to read and write an Object
array. When an array is read from the value binding expression,
it identifies the selected checkboxes. Each element in the array
is an Object value. Each Object value must
be equal to the value property of at least one Option
instance specified in the array obtained from the value binding
expression assigned to the items attribute.
The write method of the selected attribute's value
binding expression is called during the UPDATE_MODEL_PHASE
of the JSF lifecyle. If one or more checkboxes are selected
an Object array is passed as an argument to the
write method. This array contains the Object
values of the selected checkboxes.
HTML Elements and Layout
A ui:checkboxGroup renders one
com.sun.rave.web.ui.component.Checkbox component for
each element in the items array.
See ui:checkbox for
details on the HTML elements and components rendered for a
checkbox.
The value of the name attribute of each
Checkbox component rendered is assigned the
clientId of the CheckboxGroup
component instance associated with this tag. The id
attribute of each Checkbox component rendered
is formed as follows, where cbgrpid is the id of the
CheckboxGroup instance and N is the nth
checkbox.
See ui:checkbox for
details on how the id properties of the components that make up the
checkbox are defined.
Client Side Javascript Functions
none.
Example
Example 1: Create a checkbox group
<ui:checkboxGroup items="#{rbcbGrp.selections}"
label="#{rbcbGrp.cbGrpLabel}"
toolTip="cbgrp-tooltip"
disabled="false"
tabIndex="4"
selected="#{rbcbGrp.cbvalue}">
</ui:checkboxGroup>
This example creates a checkbox group with an identifying
label for the group before the first checkbox. The
data for the checkboxes is obtained from the value binding
expression #{rbcbGrp.selections} . rbcbGrp
is an application defined managed bean and provides the values for
other attributes such as selected to receive the
value of the selected checkboxes in the group.
Auto-generated component class.
Do NOT modify; all changes
will be lost!
|