Class RadioRenderer
-
- All Implemented Interfaces:
ComponentSystemEventListener
,FacesListener
,EventListener
public class RadioRenderer extends SelectManyCheckboxListRenderer implements ComponentSystemEventListener
ReadoRenderer is a class that renders the current value ofUISelectOne
orUISelectMany
component as a list of radio buttons
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
RadioRenderer.Group
Keeps track of all<h:selectOneRadio group>
detail.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.-
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
Constructors Constructor Description RadioRenderer()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
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
-
-
-
-
Method Detail
-
processEvent
public void processEvent(ComponentSystemEvent event) throws AbortProcessingException
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
public void decode(FacesContext context, UIComponent component)
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
public void encodeEnd(FacesContext context, UIComponent component) throws IOException
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
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.
-
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
protected boolean isChecked(FacesContext context, UISelectOne radio, Object itemValue)
-
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
protected static RadioRenderer.Group getGroup(FacesContext context, UISelectOne radio)
-
-