| com.sun.rave.web.ui.renderer.AbstractRenderer com.sun.rave.web.ui.renderer.RbCbRendererBase com.sun.rave.web.ui.renderer.RadioButtonRenderer
RadioButtonRenderer | public class RadioButtonRenderer extends RbCbRendererBase (Code) | |
The RadioButtonRenderer renders a
com.sun.rave.web.ui.component.RadioButton component.
Encoding
The RadioButtonRenderer renders a RadioButton as:
- An INPUT element of type radio for each radio button.
- An optional image. The component rendered for this feature is obtained
from a call to
getImageComponent() on the component being
rendered.
- An optional label. The component rendered for this feature is obtained
from a call to
getLabelComponent() on the component being
rendered.
The CSS selectors for the elements and components that comprise a
radio button are identified by java
constants defined in the
ThemeStyles class.
- RADIOBUTTON for the INPUT element
- RADIOBUTTON_DISABLED for the INPUT element of a disabled radio
button
- RADIOBUTTON_LABEL for label component if a label is rendered
- RADIOBUTTON_LABEL_DISABLED for a label component of a disabled
radio button, if a label is rendered
- RADIOBUTTON_IMAGE for an image component if an image is rendered
- RADIOBUTTON_IMAGE_DISABLED for an image component of a disabled
radio button if an image is rendered.
Note that these selectors are appended to any existing selectors
that may already exist on the styleClass property of the
RadioButton component and the optional image and label
components.
For more details on the encoding the
RadioButton component see the super class
com.sun.rave.web.ui.renderer.RbCbRendererBase
Decoding
If the INPUT element representing a radio button is selected on the
the client, the submitted request will contain a request parameter
whose name is the value of the name attribute of the selected
HTML INPUT element. The value of the request parameter will be the
value of the value attribute of the selected HTML INPUT element.
The component being decoded is selected if the component's
isDisabled and isReadOnly methods
return false and:
- a request parameter exists that is equal to its
name
property. If the name property is null, then a
request parameter exists that is equal to its clientId
property.
And
- the request parameter's value is
String.equal to the
the component's selectedValue property, after conversion
to a String , by calling
ConversionUtilities.convertValueToString . If the component
was encoded as a boolean control, then the request parameter's value
must be equal to the component's clientId property.
If selected, a String[1] array is assigned as the component's
submitted value where the single array element is the String
version of the selectedValue property or "true" if the
component was encoded as a boolean control.
If not selected, a String[0] array is assigned as the
component's submitted value or a String[1] array where the
single array element is "false" if the component was encoded as a
boolean control.
If the component's isDisabled or isReadOnly
methods return true no submitted value is assigned to the component,
and results in a null submitted value implying the component
was not submitted, and the state of the component is unchanged.
Since the RadioButtonRenderer only renders a single
RadioButton component it cannot enforce that at least
one radio button should be selected among a group of RadioButton
components with the same name property.
If the RadioButton is selected, the selected
property will be the same value as the selectedValue
property. If more than one RadioButton component is
encoded with the same name property and more than one
RadioButton 's is selectred,
the last selected RadioButton component that is encoded
will be appear as checked in the HTML page. Subsequently during the
next submit, only the checked RadioButton component
will be selected.
|
Method Summary | |
public void | decode(FacesContext context, UIComponent component) Decode the RadioButton selection.
If the value of the component's name property
has been set, the value is used to match a request parameter.
If it has not been set the component clientId is used to match
a request parameter. | protected String | getStyle(Theme theme, int styleCode) | protected boolean | isSelected(FacesContext context, UIComponent component) Return true if the component is selected, false
otherwise. | public void | renderEnd(FacesContext context, UIComponent component, ResponseWriter writer) RadioButtonRenderer renders the entire RadioButton
component within the renderEnd method. | public void | renderStart(FacesContext context, UIComponent component, ResponseWriter writer) Ensure that the component to be rendered is a RadioButton instance. |
RadioButtonRenderer | public RadioButtonRenderer()(Code) | | Creates a new instance of RadioButtonRenderer
|
decode | public void decode(FacesContext context, UIComponent component)(Code) | | Decode the RadioButton selection.
If the value of the component's name property
has been set, the value is used to match a request parameter.
If it has not been set the component clientId is used to match
a request parameter. If a match is found, and the value of the
of the request parameter matches the String value of the
component's selectedValue property, the
radio button is selected. The component's submitted value is
assigned a String[1] array where the single array
element is the matching parameter value.
If no matching request parameter or value is found, an instance of
String[0] is assigned as the submitted value,
meaning that this is a component was not selected.
If the component was encoded as a boolean control the
value of the matching request attribute will be the component's
clientId property if selected. If selected the
submitted value is new String[] { "true" }
and new String[] { "false" } if not selected.
It is the developer's responsibility to ensure the validity of the
name property (the name attribute on the
INPUT element) by ensuring that it is unique to the radio buttons
for a given group within a form.
Parameters: context - FacesContext for the request we are processing. Parameters: component - The RadioButton component to be decoded. |
getStyle | protected String getStyle(Theme theme, int styleCode)(Code) | | Return the style class name for the structural element indicated
by styleCode
Parameters: theme - The Theme for this request. Parameters: styleCode - identifies the style class for the element aboutto be rendered. |
isSelected | protected boolean isSelected(FacesContext context, UIComponent component)(Code) | | Return true if the component is selected, false
otherwise.
Parameters: context - FacesContext for the request we are processing. Parameters: component - UIComponent to test for selected. |
renderEnd | public void renderEnd(FacesContext context, UIComponent component, ResponseWriter writer) throws IOException(Code) | | RadioButtonRenderer renders the entire RadioButton
component within the renderEnd method.
Parameters: context - FacesContext for the request we are processing. Parameters: component - UIComponent to be decoded. |
renderStart | public void renderStart(FacesContext context, UIComponent component, ResponseWriter writer) throws IOException(Code) | | Ensure that the component to be rendered is a RadioButton instance.
Actual rendering occurs during renderEnd
Parameters: context - FacesContext for the request we are processing. Parameters: component - UIComponent to be decoded. |
Methods inherited from com.sun.rave.web.ui.renderer.RbCbRendererBase | public void encodeChildren(FacesContext context, UIComponent component) throws IOException(Code)(Java Doc) public Object getConvertedValue(FacesContext context, UIComponent component, Object submittedValue) throws ConverterException(Code)(Java Doc) abstract protected String getStyle(Theme theme, int styleCode)(Code)(Java Doc) abstract protected boolean isSelected(FacesContext context, UIComponent component)(Code)(Java Doc) protected void renderImage(FacesContext context, UIComponent component, Theme theme, ResponseWriter writer) throws IOException(Code)(Java Doc) protected void renderInput(FacesContext context, UIComponent component, Theme theme, ResponseWriter writer, String type) throws IOException(Code)(Java Doc) protected void renderLabel(FacesContext context, UIComponent component, Theme theme, ResponseWriter writer) throws IOException(Code)(Java Doc) protected void renderSelection(FacesContext context, UIComponent component, Theme theme, ResponseWriter writer, String type) throws IOException(Code)(Java Doc)
|
Methods inherited from com.sun.rave.web.ui.renderer.AbstractRenderer | protected void addBooleanAttributes(FacesContext context, UIComponent component, ResponseWriter writer, String names) throws IOException(Code)(Java Doc) protected void addCoreAttributes(FacesContext context, UIComponent component, ResponseWriter writer, String styles) throws IOException(Code)(Java Doc) protected void addIntegerAttributes(FacesContext context, UIComponent component, ResponseWriter writer, String names) throws IOException(Code)(Java Doc) protected static void addStringAttributes(FacesContext context, UIComponent component, ResponseWriter writer, String names) throws IOException(Code)(Java Doc) public void decode(FacesContext context, UIComponent component)(Code)(Java Doc) public void encodeBegin(FacesContext context, UIComponent component) throws IOException(Code)(Java Doc) public void encodeChildren(FacesContext context, UIComponent component) throws IOException(Code)(Java Doc) public void encodeEnd(FacesContext context, UIComponent component) throws IOException(Code)(Java Doc) protected Application getApplication()(Code)(Java Doc) protected Object getAsObject(FacesContext context, UIComponent component, String value)(Code)(Java Doc) protected String getAsString(FacesContext context, UIComponent component)(Code)(Java Doc) protected ExternalContext getExternalContext()(Code)(Java Doc) protected FacesContext getFacesContext()(Code)(Java Doc) protected Object getSubmittedValue(FacesContext context, UIComponent component)(Code)(Java Doc) protected boolean isDisabled(UIComponent component)(Code)(Java Doc) protected boolean isPortlet(FacesContext context)(Code)(Java Doc) protected boolean isReadOnly(UIComponent component)(Code)(Java Doc) protected void renderAttributes(FacesContext context, UIComponent component, ResponseWriter writer) throws IOException(Code)(Java Doc) protected void renderEnd(FacesContext context, UIComponent component, ResponseWriter writer) throws IOException(Code)(Java Doc) protected void renderMarkup(FacesContext context, UIComponent component, ResponseWriter writer, Markup markup) throws IOException(Code)(Java Doc) protected void renderStart(FacesContext context, UIComponent component, ResponseWriter writer) throws IOException(Code)(Java Doc) protected void setSubmittedValue(FacesContext context, UIComponent component)(Code)(Java Doc)
|
|
|