- All Implemented Interfaces:
ComponentSystemEventListener,FacesListener,EventListener
public class RadioRenderer
extends SelectManyCheckboxListRenderer
implements ComponentSystemEventListener
ReadoRenderer is a class that renders the current value of
UISelectOne or UISelectMany
component as a list of radio buttons-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classKeeps track of all<h:selectOneRadio group>detail.static classUsed when a<h:selectOneRadio group>doesn't have a select item; it will then get it via first radio of the group.Nested classes/interfaces inherited from class com.sun.faces.renderkit.html_basic.HtmlBasicRenderer
HtmlBasicRenderer.OptionComponentInfo, HtmlBasicRenderer.Param -
Field Summary
Fields inherited from class com.sun.faces.renderkit.html_basic.HtmlBasicRenderer
EMPTY_PARAMS, loggerFields inherited from class jakarta.faces.render.Renderer
PASSTHROUGH_RENDERER_LOCALNAME_KEY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddecode(FacesContext context, UIComponent component) This override delegates todecodeGroup(FacesContext context, UISelectOne radio, Group group)when 'group' attribute is set.protected voiddecodeGroup(FacesContext context, UISelectOne radio, RadioRenderer.Group group) The difference with default decoding is: Submitted value is obtained by group name.voidencodeEnd(FacesContext context, UIComponent component) This override delegates toencodeEndGroup(FacesContext context, UISelectOne radio, Group group)when 'group' attribute is set.protected voidencodeEndGroup(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.protected static RadioRenderer.GroupgetGroup(FacesContext context, UISelectOne radio) protected booleanisChecked(FacesContext context, UISelectOne radio, Object itemValue) voidprocessEvent(ComponentSystemEvent event) After adding component to view, if component has group attribute set, then pre-collect the components by group.protected voidrenderInput(FacesContext context, ResponseWriter writer, UIComponent component, String clientId, Object itemValue, Converter<?> converter, boolean checked, boolean disabled, RadioRenderer.Group group) protected voidrenderLabel(ResponseWriter writer, UIComponent component, String forClientId, SelectItem curItem, HtmlBasicRenderer.OptionComponentInfo optionInfo) protected voidrenderOption(FacesContext context, UIComponent component, Converter converter, SelectItem curItem, Object currentSelections, Object[] submittedValues, Boolean newTableRow, int itemNumber, HtmlBasicRenderer.OptionComponentInfo optionInfo) Methods inherited from class com.sun.faces.renderkit.html_basic.SelectManyCheckboxListRenderer
isBehaviorSource, renderBeginText, renderEndTextMethods inherited from class com.sun.faces.renderkit.html_basic.MenuRenderer
bestGuess, cloneValue, coerceToModelType, containsaValue, convertSelectManyValue, convertSelectManyValuesForArray, convertSelectManyValuesForCollection, convertSelectManyValuesForModel, convertSelectOneValue, createCollection, createCollectionFromHint, encodeBegin, getConvertedValue, getCurrentSelectedValues, getMultipleText, getSubmittedSelectedValues, isHideNoSelection, isSelected, renderOption, renderOptions, renderSelect, writeDefaultSizeMethods inherited from class com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer
getNonOnChangeBehaviors, getNonOnClickSelectBehaviors, getValue, setSubmittedValueMethods inherited from class com.sun.faces.renderkit.html_basic.HtmlBasicRenderer
augmentIdReference, convertClientId, decodeBehaviors, encodeRecursive, getBehaviorParameters, getChildren, getCurrentValue, getEndTextToRender, getFacet, getForComponent, getFormattedValue, getFormattedValue, getMessageIter, getParamList, getPassThruBehaviors, getRendersChildren, rendererParamsNotNull, shouldDecode, shouldEncode, shouldEncodeChildren, shouldWriteIdAttribute, writeIdAttributeIfNecessaryMethods inherited from class jakarta.faces.render.Renderer
encodeChildren
-
Constructor Details
-
RadioRenderer
public RadioRenderer()
-
-
Method Details
-
processEvent
After adding component to view, if component has group attribute set, then pre-collect the components by group.- Specified by:
processEventin interfaceComponentSystemEventListener- Parameters:
event- theComponentSystemEventinstance that is being processed.- Throws:
AbortProcessingException- if lifecycle processing should cease for this request.
-
decode
This override delegates todecodeGroup(FacesContext context, UISelectOne radio, Group group)when 'group' attribute is set. It will only decode when the current component is the first one of group.- Overrides:
decodein classMenuRenderer- Parameters:
context-FacesContextfor the request we are processingcomponent-UIComponentto be decoded.
-
encodeEnd
This override delegates toencodeEndGroup(FacesContext context, UISelectOne radio, Group group)when 'group' attribute is set.- Overrides:
encodeEndin classSelectManyCheckboxListRenderer- Parameters:
context-FacesContextfor the response we are creatingcomponent-UIComponentto be rendered- Throws:
IOException- if an input/output error occurs while rendering
-
decodeGroup
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.
-
encodeEndGroup
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.
- Throws:
IOException
-
isChecked
-
renderOption
protected void renderOption(FacesContext context, UIComponent component, Converter converter, SelectItem curItem, Object currentSelections, Object[] submittedValues, Boolean newTableRow, int itemNumber, HtmlBasicRenderer.OptionComponentInfo optionInfo) throws IOException - Overrides:
renderOptionin classSelectManyCheckboxListRenderer- Throws:
IOException
-
renderInput
protected void renderInput(FacesContext context, ResponseWriter writer, UIComponent component, String clientId, Object itemValue, Converter<?> converter, boolean checked, boolean disabled, RadioRenderer.Group group) throws IOException - Throws:
IOException
-
renderLabel
protected void renderLabel(ResponseWriter writer, UIComponent component, String forClientId, SelectItem curItem, HtmlBasicRenderer.OptionComponentInfo optionInfo) throws IOException - Throws:
IOException
-
getGroup
-