- 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
Modifier and TypeClassDescriptionprotected static class
Keeps track of all<h:selectOneRadio group>
detail.static class
Used 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, logger
Fields inherited from class jakarta.faces.render.Renderer
PASSTHROUGH_RENDERER_LOCALNAME_KEY
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
decode
(FacesContext context, UIComponent component) This override delegates todecodeGroup(FacesContext context, UISelectOne radio, Group group)
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.void
encodeEnd
(FacesContext context, UIComponent component) This override delegates toencodeEndGroup(FacesContext context, UISelectOne radio, Group group)
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.protected static RadioRenderer.Group
getGroup
(FacesContext context, UISelectOne radio) protected boolean
isChecked
(FacesContext context, UISelectOne radio, Object itemValue) void
processEvent
(ComponentSystemEvent event) 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 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, renderEndText
Methods 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, writeDefaultSize
Methods inherited from class com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer
getNonOnChangeBehaviors, getNonOnClickSelectBehaviors, getValue, setSubmittedValue
Methods 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, writeIdAttributeIfNecessary
Methods 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:
processEvent
in interfaceComponentSystemEventListener
- Parameters:
event
- theComponentSystemEvent
instance 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:
decode
in classMenuRenderer
- Parameters:
context
-FacesContext
for the request we are processingcomponent
-UIComponent
to be decoded.
-
encodeEnd
This override delegates toencodeEndGroup(FacesContext context, UISelectOne radio, Group group)
when 'group' attribute is set.- Overrides:
encodeEnd
in classSelectManyCheckboxListRenderer
- Parameters:
context
-FacesContext
for the response we are creatingcomponent
-UIComponent
to 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:
renderOption
in 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
-