com.sun.rave.web.ui.component
Class RadioButtonGroupBase

java.lang.Object
  extended byjavax.faces.component.UIComponent
      extended byjavax.faces.component.UIComponentBase
          extended byjavax.faces.component.UIOutput
              extended byjavax.faces.component.UIInput
                  extended bycom.sun.rave.web.ui.component.SelectorBase
                      extended bycom.sun.rave.web.ui.component.Selector
                          extended bycom.sun.rave.web.ui.component.RadioButtonGroupBase
All Implemented Interfaces:
javax.faces.component.EditableValueHolder, SelectorManager, javax.faces.component.StateHolder, javax.faces.component.ValueHolder
Direct Known Subclasses:
RadioButtonGroup

public abstract class RadioButtonGroupBase
extends Selector

Use the ui:radioButtonGroup tag to display two or more radio buttons in a grid layout in the rendered HTML page. The ui:radioButtonGroup tag attributes that you specify determine how the radio buttons are displayed.

If the label attribute is specified a com.sun.rave.web.ui.component.Label component is rendered before the first radio button and identifies the radio button group. The label component's for attribute is set to the id attribute of the first radio button in the rendered HTML page.

The radio buttons 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 radio button. The value property of an Option instance represents the value of a selected radio button. If the items array is empty nothing is rendered.

At least one radio button should be selected by the application. The selected attribute must also be a value binding expression that is evaluated to read and write an Object. When an Object value is read from the value binding expression, it identifies the selected radio button. The 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 value binding expression is called during the UPDATE_MODEL_PHASE of the JSF lifecyle. If a radio button 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.

HTML Elements and Layout

A ui:radioButtonGroup renders one com.sun.rave.web.ui.component.RadioButton component for each element in the items array. See ui:radioButton for details on the HTML elements and components rendered for a radio button.

The value of the name attribute of each RadioButton component rendered is assigned the clientId of the RadioButtonGroup component instance associated with this tag. The id attribute of each RadioButton component rendered is formed as follows, where rbgrpid is the id of the RadioButtonGroup instance and N is the nth radio button.

See ui:radioButton for details on how the id properties of the components that make up the radio button are defined.

Client Side Javascript Functions

none.

Example

Example 1: Create a radio button group

 <ui:radioButtonGroup items="#{rbcbGrp.selections}"
    label="#{rbcbGrp.rbGrpLabel}"
    toolTip="rbgrp-tooltip"
    tabIndex="1"
    columns="3"
    labelLevel="2"
    selected="#{rbcbGrp.selection}">
 </ui:radioButtonGroup>

This example creates a radio button group with an identifying label for the group before the first radio button. The data for the radio buttons is obtained from the value binding expression #{rbcbGrp.selections} where rbcbGrp is an application defined managed bean. The bean provides the values for other attributes such as selected to receive the value of the selected radio button in the group.

Auto-generated component class. Do NOT modify; all changes will be lost!


Field Summary
 
Fields inherited from class com.sun.rave.web.ui.component.Selector
valueTypeEvaluator
 
Fields inherited from class javax.faces.component.UIInput
COMPONENT_FAMILY, COMPONENT_TYPE, CONVERSION_MESSAGE_ID, REQUIRED_MESSAGE_ID
 
Constructor Summary
RadioButtonGroupBase()
          Construct a new RadioButtonGroupBase.
 
Method Summary
 int getColumns()
          Defines how many columns may be used to layout the radio buttons.
 java.lang.String getFamily()
          Return the family for this component.
 boolean isVisible()
          Use the visible attribute to indicate whether the component should be viewable by the user in the rendered HTML page.
 void restoreState(javax.faces.context.FacesContext _context, java.lang.Object _state)
          Restore the state of this component.
 java.lang.Object saveState(javax.faces.context.FacesContext _context)
          Save the state of this component.
 void setColumns(int columns)
          Defines how many columns may be used to layout the radio buttons.
 void setVisible(boolean visible)
          Use the visible attribute to indicate whether the component should be viewable by the user in the rendered HTML page.
 
Methods inherited from class com.sun.rave.web.ui.component.Selector
compareValues, getConvertedValue, getLabelLevel, getRendersChildren, getValueAsReadOnly, isMultiple, setMultiple, setSelected, toString
 
Methods inherited from class com.sun.rave.web.ui.component.SelectorBase
getItems, getLabel, getOnBlur, getOnChange, getOnClick, getOnDblClick, getOnFocus, getOnKeyDown, getOnKeyPress, getOnKeyUp, getOnMouseDown, getOnMouseMove, getOnMouseOut, getOnMouseOver, getOnMouseUp, getOnSelect, getSelected, getStyle, getStyleClass, getTabIndex, getToolTip, getValueBinding, isDisabled, isReadOnly, setDisabled, setItems, setLabel, setLabelLevel, setOnBlur, setOnChange, setOnClick, setOnDblClick, setOnFocus, setOnKeyDown, setOnKeyPress, setOnKeyUp, setOnMouseDown, setOnMouseMove, setOnMouseOut, setOnMouseOver, setOnMouseUp, setOnSelect, setReadOnly, setStyle, setStyleClass, setTabIndex, setToolTip, setValueBinding
 
Methods inherited from class javax.faces.component.UIInput
addValidator, addValueChangeListener, broadcast, decode, getSubmittedValue, getValidator, getValidators, getValueChangeListener, getValueChangeListeners, isImmediate, isLocalValueSet, isRequired, isValid, processDecodes, processUpdates, processValidators, removeValidator, removeValueChangeListener, setImmediate, setLocalValueSet, setRequired, setSubmittedValue, setValid, setValidator, setValue, setValueChangeListener, updateModel, validate, validateValue
 
Methods inherited from class javax.faces.component.UIOutput
getConverter, getLocalValue, getValue, setConverter
 
Methods inherited from class javax.faces.component.UIComponentBase
addFacesListener, encodeBegin, encodeChildren, encodeEnd, findComponent, getAttributes, getChildCount, getChildren, getClientId, getFacesContext, getFacesListeners, getFacet, getFacets, getFacetsAndChildren, getId, getParent, getRenderer, getRendererType, isRendered, isTransient, processRestoreState, processSaveState, queueEvent, removeFacesListener, restoreAttachedState, saveAttachedState, setId, setParent, setRendered, setRendererType, setTransient
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.sun.rave.web.ui.component.SelectorManager
getClientId, getOnChange, getStyle, getStyleClass, getTabIndex, isDisabled, isReadOnly
 
Methods inherited from interface javax.faces.component.ValueHolder
getConverter, getLocalValue, getValue, setConverter
 

Constructor Detail

RadioButtonGroupBase

public RadioButtonGroupBase()

Construct a new RadioButtonGroupBase.

Method Detail

getFamily

public java.lang.String getFamily()

Return the family for this component.

Overrides:
getFamily in class SelectorBase

getColumns

public int getColumns()

Defines how many columns may be used to layout the radio buttons. The value must be greater than or equal to one. The default value is one. Invalid values are ignored and the value is set to one.


setColumns

public void setColumns(int columns)

Defines how many columns may be used to layout the radio buttons. The value must be greater than or equal to one. The default value is one. Invalid values are ignored and the value is set to one.

See Also:
getColumns()

isVisible

public boolean isVisible()

Use the visible attribute to indicate whether the component should be viewable by the user in the rendered HTML page. If set to false, the HTML code for the component is present in the page, but the component is hidden with style attributes. By default, visible is set to true, so HTML for the component HTML is included and visible to the user. If the component is not visible, it can still be processed on subsequent form submissions because the HTML is present.

Overrides:
isVisible in class SelectorBase

setVisible

public void setVisible(boolean visible)

Use the visible attribute to indicate whether the component should be viewable by the user in the rendered HTML page. If set to false, the HTML code for the component is present in the page, but the component is hidden with style attributes. By default, visible is set to true, so HTML for the component HTML is included and visible to the user. If the component is not visible, it can still be processed on subsequent form submissions because the HTML is present.

Overrides:
setVisible in class SelectorBase
See Also:
isVisible()

restoreState

public void restoreState(javax.faces.context.FacesContext _context,
                         java.lang.Object _state)

Restore the state of this component.

Specified by:
restoreState in interface javax.faces.component.StateHolder
Overrides:
restoreState in class SelectorBase

saveState

public java.lang.Object saveState(javax.faces.context.FacesContext _context)

Save the state of this component.

Specified by:
saveState in interface javax.faces.component.StateHolder
Overrides:
saveState in class SelectorBase