Top Description Inners Fields Constructors Methods
com.sun.faces.renderkit.html_basic

public Class RadioRenderer

extends SelectManyCheckboxListRenderer
implements ComponentSystemEventListener
Class Inheritance
All Implemented Interfaces
javax.faces.event.ComponentSystemEventListener, javax.faces.event.FacesListener, java.util.EventListener
Annotations
@ListenerFor
systemEventClass:PostAddToViewEvent
Imports
java.io.IOException, java.text.MessageFormat, java.util.ArrayList, .Collection, .Collections, .HashMap, .Iterator, .List, .Map, java.util.logging.Level, javax.el.ELException, .ValueExpression, javax.faces.component.UIComponent, .UINamingContainer, .UISelectItem, .UISelectOne, javax.faces.context.FacesContext, .ResponseWriter, javax.faces.convert.Converter, javax.faces.event.AbortProcessingException, .ComponentSystemEvent, .ComponentSystemEventListener, .ListenerFor, .PostAddToViewEvent, javax.faces.model.SelectItem, com.sun.faces.RIConstants, com.sun.faces.renderkit.Attribute, .AttributeManager, .RenderKitUtils, .SelectItemsIterator, com.sun.faces.util.RequestStateManager, .Util

ReadoRenderer is a class that renders the current value of UISelectOne or UISelectMany component as a list of radio buttons

Nested and Inner Type Summary

Modifier and TypeClass and Description
protected static class
RadioRenderer.Group

Keeps track of all <h:selectoneradio group> detail.

public static class
RadioRenderer.GroupSelectItem

Used when a <h:selectoneradio group> doesn't have a select item; it will then get it via first radio of the group.

Field Summary

Modifier and TypeField and Description
private static final Attribute[]

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
decode(FacesContext
FacesContext for the request we are processing
context
,
UIComponent
UIComponent to be decoded.
component
)

Overrides com.sun.faces.renderkit.html_basic.MenuRenderer.decode.

This override delegates to decodeGroup(FacesContext, UISelectOne, String) when 'group' attribute is set.
protected void
decodeGroup(FacesContext context, UISelectOne radio, RadioRenderer.Group group)

The difference with default decoding is:

  • Submitted value is obtained by group name.
  • Submitted value is prefixed with client ID of radio button component, this need to be compared and trimmed.
  • If any submitted value does not belong to current radio button component, reset its value.
  • public void
    encodeEnd(FacesContext
    FacesContext for the response we are creating
    context
    ,
    UIComponent
    UIComponent to be rendered
    component
    )

    Overrides com.sun.faces.renderkit.html_basic.SelectManyCheckboxListRenderer.encodeEnd.

    This override delegates to encodeEndGroup(FacesContext, UISelectOne, String) when 'group' attribute is set.
    protected void
    encodeEndGroup(FacesContext context, UISelectOne radio, RadioRenderer.Group group)

    The difference with default encoding is:

  • Every radio button of same 'group' will have same 'name' attribute rendered, relative to UIForm parent.
  • The 'value' attribute of every radio button is prefixed with client ID of radio button component itself.
  • No additional (table) markup is being rendered.
  • Label, if any, is rendered directly after radio button element, without additional markup.
  • protected static RadioRenderer.Group
    protected boolean
    isChecked(FacesContext context, UISelectOne radio, Object itemValue)

    public void
    processEvent(ComponentSystemEvent
    the ComponentSystemEvent instance that is being processed.
    event
    )

    Implements javax.faces.event.ComponentSystemEventListener.processEvent.

    After adding component to view, if component has group attribute set, then pre-collect the components by group.
    protected void
    renderInput(FacesContext context, ResponseWriter writer, UIComponent component, String clientId, Object itemValue, Converter<?> converter, boolean checked, boolean disabled, RadioRenderer.Group group)

    protected void
    renderLabel(ResponseWriter writer, UIComponent component, String forClientId, SelectItem curItem, HtmlBasicRenderer.OptionComponentInfo optionInfo)

    protected void
    renderOption(FacesContext context, UIComponent component, Converter<T> converter, SelectItem curItem, Object currentSelections, Object[] submittedValues, boolean alignVertical, int itemNumber, HtmlBasicRenderer.OptionComponentInfo optionInfo)

    Overrides com.sun.faces.renderkit.html_basic.SelectManyCheckboxListRenderer.renderOption.

    Inherited from com.sun.faces.renderkit.html_basic.SelectManyCheckboxListRenderer:
    getSelectedTextStringisBehaviorSourcerenderBeginTextrenderEndText

    Constructor Detail

    RadioRendererback to summary
    public RadioRenderer()

    Method Detail

    decodeback to summary
    public void decode(FacesContext context, UIComponent component)

    Overrides com.sun.faces.renderkit.html_basic.MenuRenderer.decode.

    This override delegates to decodeGroup(FacesContext, UISelectOne, String) when 'group' attribute is set. It will only decode when the current component is the first one of group.

    Parameters
    context:FacesContext

    Doc from javax.faces.render.Renderer.decode.

    FacesContext for the request we are processing

    component:UIComponent

    Doc from javax.faces.render.Renderer.decode.

    UIComponent to be decoded.

    Annotations
    @Override
    decodeGroupback to summary
    protected void decodeGroup(FacesContext context, UISelectOne radio, RadioRenderer.Group group)

    The difference with default decoding is:

  • Submitted value is obtained by group name.
  • Submitted value is prefixed with client ID of radio button component, this need to be compared and trimmed.
  • If any submitted value does not belong to current radio button component, reset its value.
  • encodeEndback to summary
    public void encodeEnd(FacesContext context, UIComponent component) throws IOException

    Overrides com.sun.faces.renderkit.html_basic.SelectManyCheckboxListRenderer.encodeEnd.

    This override delegates to encodeEndGroup(FacesContext, UISelectOne, String) when 'group' attribute is set.

    Parameters
    context:FacesContext

    Doc from javax.faces.render.Renderer.encodeEnd.

    FacesContext for the response we are creating

    component:UIComponent

    Doc from javax.faces.render.Renderer.encodeEnd.

    UIComponent to be rendered

    Annotations
    @Override
    Exceptions
    IOException:

    Doc from javax.faces.render.Renderer.encodeEnd.

    if an input/output error occurs while rendering

    encodeEndGroupback to summary
    protected void encodeEndGroup(FacesContext context, UISelectOne radio, RadioRenderer.Group group) throws IOException

    The difference with default encoding is:

  • Every radio button of same 'group' will have same 'name' attribute rendered, relative to UIForm parent.
  • The 'value' attribute of every radio button is prefixed with client ID of radio button component itself.
  • No additional (table) markup is being rendered.
  • Label, if any, is rendered directly after radio button element, without additional markup.
  • getGroupback to summary
    protected static RadioRenderer.Group getGroup(FacesContext context, UISelectOne radio)
    isCheckedback to summary
    protected boolean isChecked(FacesContext context, UISelectOne radio, Object itemValue)
    processEventback to summary
    public void processEvent(ComponentSystemEvent event) throws AbortProcessingException

    Implements javax.faces.event.ComponentSystemEventListener.processEvent.

    After adding component to view, if component has group attribute set, then pre-collect the components by group.

    Parameters
    event:ComponentSystemEvent

    Doc from javax.faces.event.ComponentSystemEventListener.processEvent.

    the ComponentSystemEvent instance that is being processed.

    Annotations
    @Override
    Exceptions
    AbortProcessingException:

    Doc from javax.faces.event.ComponentSystemEventListener.processEvent.

    if lifecycle processing should cease for this request.

    renderInputback to summary
    protected void renderInput(FacesContext context, ResponseWriter writer, UIComponent component, String clientId, Object itemValue, Converter<?> converter, boolean checked, boolean disabled, RadioRenderer.Group group) throws IOException
    renderLabelback to summary
    protected void renderLabel(ResponseWriter writer, UIComponent component, String forClientId, SelectItem curItem, HtmlBasicRenderer.OptionComponentInfo optionInfo) throws IOException
    renderOptionback to summary
    protected void renderOption(FacesContext context, UIComponent component, Converter<T> converter, SelectItem curItem, Object currentSelections, Object[] submittedValues, boolean alignVertical, int itemNumber, HtmlBasicRenderer.OptionComponentInfo optionInfo) throws IOException

    Overrides com.sun.faces.renderkit.html_basic.SelectManyCheckboxListRenderer.renderOption.

    Annotations
    @Override
    com.sun.faces.renderkit.html_basic back to summary

    protected Class RadioRenderer.Group

    extends Object
    Class Inheritance

    Keeps track of all detail.

    Field Summary

    Modifier and TypeField and Description
    private final List<String>
    private final String
    private ValueExpression

    Constructor Summary

    AccessConstructor and Description
    public
    Group(FacesContext context, String clientName)

    Method Summary

    Modifier and TypeMethod and Description
    public void
    public String
    Inherited from java.lang.Object:
    cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

    Field Detail

    clientIdsback to summary
    private final List<String> clientIds
    clientNameback to summary
    private final String clientName
    valueback to summary
    private ValueExpression value

    Constructor Detail

    Groupback to summary
    public Group(FacesContext context, String clientName)

    Method Detail

    addRadioback to summary
    public void addRadio(FacesContext context, UISelectOne radio)
    getClientNameback to summary
    public String getClientName()
    com.sun.faces.renderkit.html_basic back to summary

    public Class RadioRenderer.GroupSelectItem

    extends UISelectItem
    Class Inheritance

    Used when a doesn't have a select item; it will then get it via first radio of the group.

    Field Summary

    Modifier and TypeField and Description
    private SelectItem
    Inherited from javax.faces.component.UISelectItem:
    COMPONENT_FAMILYCOMPONENT_TYPE

    Constructor Summary

    AccessConstructor and Description
    public

    Method Summary

    Modifier and TypeMethod and Description
    public String
    getItemDescription()

    Overrides javax.faces.component.UISelectItem.getItemDescription.

    Return the description for this selection item.

    public String
    getItemLabel()

    Overrides javax.faces.component.UISelectItem.getItemLabel.

    Return the localized label for this selection item.

    public Object
    getItemValue()

    Overrides javax.faces.component.UISelectItem.getItemValue.

    Return the server value for this selection item.

    private SelectItem
    public boolean
    isItemDisabled()

    Overrides javax.faces.component.UISelectItem.isItemDisabled.

    Return the disabled setting for this selection item.

    public boolean
    isItemEscaped()

    Overrides javax.faces.component.UISelectItem.isItemEscaped.

    Return the escape setting for the label of this selection item.

    public boolean
    isNoSelectionOption()

    Overrides javax.faces.component.UISelectItem.isNoSelectionOption.

    Return the value of the noSelectionOption property.

    Inherited from javax.faces.component.UISelectItem:
    getFamilygetValuesetItemDescriptionsetItemDisabledsetItemEscapedsetItemLabelsetItemValuesetNoSelectionOptionsetValue

    Field Detail

    selectItemback to summary
    private SelectItem selectItem

    Constructor Detail

    GroupSelectItemback to summary
    public GroupSelectItem()

    Method Detail

    getItemDescriptionback to summary
    public String getItemDescription()

    Overrides javax.faces.component.UISelectItem.getItemDescription.

    Doc from javax.faces.component.UISelectItem.getItemDescription.

    Return the description for this selection item.

    Returns:String

    the item description.

    Annotations
    @Override
    getItemLabelback to summary
    public String getItemLabel()

    Overrides javax.faces.component.UISelectItem.getItemLabel.

    Doc from javax.faces.component.UISelectItem.getItemLabel.

    Return the localized label for this selection item.

    Returns:String

    the item label.

    Annotations
    @Override
    getItemValueback to summary
    public Object getItemValue()

    Overrides javax.faces.component.UISelectItem.getItemValue.

    Doc from javax.faces.component.UISelectItem.getItemValue.

    Return the server value for this selection item.

    Returns:Object

    the item value.

    Annotations
    @Override
    getSelectItemback to summary
    private SelectItem getSelectItem()
    Annotations
    @SuppressWarnings:unchecked
    isItemDisabledback to summary
    public boolean isItemDisabled()

    Overrides javax.faces.component.UISelectItem.isItemDisabled.

    Doc from javax.faces.component.UISelectItem.isItemDisabled.

    Return the disabled setting for this selection item.

    Returns:boolean

    true is the item disabled, false otherwise.

    Annotations
    @Override
    isItemEscapedback to summary
    public boolean isItemEscaped()

    Overrides javax.faces.component.UISelectItem.isItemEscaped.

    Doc from javax.faces.component.UISelectItem.isItemEscaped.

    Return the escape setting for the label of this selection item.

    Returns:boolean

    true if the item is escaped, false otherwise.

    Annotations
    @Override
    isNoSelectionOptionback to summary
    public boolean isNoSelectionOption()

    Overrides javax.faces.component.UISelectItem.isNoSelectionOption.

    Doc from javax.faces.component.UISelectItem.isNoSelectionOption.

    Return the value of the noSelectionOption property. If the value of this property is true, the system interprets the option represented by this UISelectItem instance as representing a "no selection" option. See UISelectOne#validateValue and UISelectMany#validateValue for usage.

    Returns:boolean

    the no selection option.

    Annotations
    @Override