Checkbox Group Component |
You can drag the Checkbox Group component
from the Palette's Basic category to the Visual Designer to create a table of labeled checkboxes.
The checkboxes are rendered in rows and columns in an HTML <table> element. The number of rows is defined by the number of checkboxes. The number of columns is defined by the columns property. The default layout is a single vertical column. For example, if you want the checkboxes laid out in a single row, set columns property to the number of checkboxes.
The items property is bound to an array, a list, or a collection p of com.sun.rave.web.ui.model.Option objects that populate the list. Right-click the component and choose Bind to Data to set this property. In the Outline window, you can see the default object that populates the list, which has a name similar to checkboxGroup1DefaultOptions. The option labels become the checkbox labels. When the user selects
one or more checkboxes, the component's selected property contains an array of the selected values.
You set the selected property to associate the component with a model object that picks up the items selected by the user. The model object must be an array of objects whose values represent the values of the com.sun.rave.web.ui.model.Option objects in the list. The first time the component is rendered, the options that correspond to the value of the selected property, if there are any, are marked as selected.
For information on binding the component to an object to set up the list, see Bind to Data below.
After dragging the component to the Visual Designer, you can do a number of things with it:
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.
items property to an object or to a data provider, as described in Bind to Data Dialog Box.
items property to an object, select the Bind to Object tab and then select a bean property that will be used to populate the list. The bean property must be an Object array, map, or collection whose members are all subclasses of com.sun.rave.web.ui.model.Option. For a tutorial showing how to associate a listbox with an array, which is similar to associating a checkbox group with an array, see the following web page: items property to a data provider for a database table or JavaBeans object that will be used to populate the list, select the Bind to Data Provider tab and choose a data provider.
selected property, which you can bind to an Object array, or an array of primitives. You must have added the array to a managed bean, such as the session bean, as a property. You can use this bean property to evaluate what the user chose after the page is submitted.
checkboxgroup#defaultOptions object and change the displayed checkboxes. It is more likely that you will want to bind the items property to a database or object to use to set checkbox list items, as described above under Bind to Data.
for property is set to the first checkbox in the group.
label property. Values are 1 (largest), 2, and 3 (smallest). The default value is 2.
| Legal Notices. Copyright © 2006 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. |