| com.sun.rave.web.ui.renderer.AbstractRenderer com.sun.rave.web.ui.renderer.RbCbRendererBase com.sun.rave.web.ui.renderer.CheckboxRenderer
CheckboxRenderer | public class CheckboxRenderer extends RbCbRendererBase (Code) | |
The CheckboxRenderer renders a
com.sun.rave.web.ui.component.Checkbox component.
Encoding
The CheckboxRenderer renders a Checkbox as:
- An INPUT element of type checkbox for each checkbox.
- 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
checkbox are identified by java
constants defined in the
ThemeStyles class.
- CHECKBOX for the INPUT element
- CHECKBOX_DISABLED for the INPUT element of a disabled radio
button
- CHECKBOX_LABEL for label component if a label is rendered
- CHECKBOX_LABEL_DISABLED for a label component of a disabled
radio button, if a label is rendered
- CHECKBOX_IMAGE for an image component if an image is rendered
- CHECKBOX_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
Checkbox component and the optional image and label
components.
For more details on the logic for actual renderering of HTML for
a Checkbox component see the super class
com.sun.rave.web.ui.renderer.RbCbRendererBase
Decoding
If the INPUT element representing a checkbox 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.
If more than one checkbox INPUT element has the same value for
the name attribute, then the value of the request parameter will
be an array of those INPUT element values.
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 an array that contains an element
that 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 an element the request parameter's
array 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.
|
Method Summary | |
public void | decode(FacesContext context, UIComponent component) Decode the Checkbox selection.
If the component's isDisabled and isReadOnly
methods return false,
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) CheckboxRenderer renders the entire Checkbox
component within the renderEnd method. | public void | renderStart(FacesContext context, UIComponent component, ResponseWriter writer) Ensure that the component to be rendered is a Checkbox instance. |
CheckboxRenderer | public CheckboxRenderer()(Code) | | Creates a new instance of CheckboxRenderer
|
decode | public void decode(FacesContext context, UIComponent component)(Code) | | Decode the Checkbox selection.
If the component's isDisabled and isReadOnly
methods return false,
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 Checkbox 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) | | CheckboxRenderer renders the entire Checkbox
component within the renderEnd method.
See
com.sun.rave.web.ui.renderer.RbCbRendererBase for
details on encoding a Checkbox component.
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 Checkbox 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)
|
|
|