|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.faces.render.Renderer
com.sun.rave.web.ui.renderer.AbstractRenderer
com.sun.rave.web.ui.renderer.CheckboxRenderer
public class CheckboxRenderer
The CheckboxRenderer
renders a
Checkbox
component.
The CheckboxRenderer
renders a Checkbox
as:
getImageComponent()
on the component being
rendered. 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.
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
RbCbRendererBase
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:
name
property. If the name
property is null, then a
request parameter exists that is equal to its clientId
property.
And
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.
Field Summary | |
---|---|
protected static int |
IMAGE
The define constant indicating the style class for the IMG element. |
protected static int |
IMAGE_DIS
The define constant indicating the style class for a disabled IMG element. |
protected static int |
INPUT
The define constant indicating the style class for an INPUT element. |
protected static int |
INPUT_DIS
The define constant indicating the style class for a disabled INPUT element. |
protected static int |
LABEL
The define constant indicating the style class for the LABEL element. |
protected static int |
LABEL_DIS
The define constant indicating the style class for a disabled LABEL element. |
static java.lang.String[] |
RBCB_EVENTS_ATTRIBUTES
The list of attribute names for Rb and Cb |
protected static int |
SPAN
The define constant indicating the style class for for the containing span element |
protected static int |
SPAN_DIS
The define constant indicating the style class for for the containing span element, when disabled. |
protected java.lang.String[] |
styles
|
Fields inherited from class com.sun.rave.web.ui.renderer.AbstractRenderer |
---|
BUNDLE, EVENTS_ATTRIBUTES, I18N_ATTRIBUTES |
Constructor Summary | |
---|---|
CheckboxRenderer()
Creates a new instance of CheckboxRenderer |
Method Summary | |
---|---|
void |
decode(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component)
Decode the Checkbox selection. |
void |
encodeChildren(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component)
Render the child components of this UIComponent, following the rules described for encodeBegin() to acquire the appropriate value to be rendered. |
java.lang.Object |
getConvertedValue(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component,
java.lang.Object submittedValue)
Attempt to convert previously stored state information into an object of the type required for this component (optionally using the registered Converter for this component,
if there is one). |
protected java.lang.String |
getStyle(Theme theme,
int styleCode)
Return the style class name for the structural element indicated by styleCode |
protected boolean |
isSelected(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component)
Return true if the component is selected, false
otherwise. |
void |
renderEnd(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component,
javax.faces.context.ResponseWriter writer)
CheckboxRenderer renders the entire Checkbox component within the renderEnd method. |
protected void |
renderImage(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component,
Theme theme,
javax.faces.context.ResponseWriter writer)
Called from renderSelection to render an IMG element for the specified item control. |
protected void |
renderInput(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component,
Theme theme,
javax.faces.context.ResponseWriter writer,
java.lang.String type)
Called from renderSelection to render an INPUT element of type type for the specified component . |
protected void |
renderLabel(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component,
Theme theme,
javax.faces.context.ResponseWriter writer)
Called from renderSelection to render a LABEL. |
protected void |
renderSelection(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component,
Theme theme,
javax.faces.context.ResponseWriter writer,
java.lang.String type)
Render a radio button or a checkbox. |
void |
renderStart(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component,
javax.faces.context.ResponseWriter writer)
Ensure that the component to be rendered is a Checkbox instance. |
Methods inherited from class com.sun.rave.web.ui.renderer.AbstractRenderer |
---|
addBooleanAttributes, addCoreAttributes, addIntegerAttributes, addStringAttributes, encodeBegin, encodeEnd, getApplication, getAsObject, getAsString, getExternalContext, getFacesContext, getSubmittedValue, isDisabled, isPortlet, isReadOnly, renderAttributes, renderMarkup, setSubmittedValue |
Methods inherited from class javax.faces.render.Renderer |
---|
convertClientId, getRendersChildren |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.lang.String[] styles
protected static final int INPUT
protected static final int INPUT_DIS
protected static final int LABEL
protected static final int LABEL_DIS
protected static final int IMAGE
protected static final int IMAGE_DIS
protected static final int SPAN
protected static final int SPAN_DIS
public static final java.lang.String[] RBCB_EVENTS_ATTRIBUTES
The list of attribute names for Rb and Cb
Constructor Detail |
---|
public CheckboxRenderer()
Method Detail |
---|
public void decode(javax.faces.context.FacesContext context, javax.faces.component.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. 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.
decode
in class AbstractRenderer
context
- FacesContext for the request we are processing.component
- The Checkbox
component to be decoded.public void renderStart(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, javax.faces.context.ResponseWriter writer) throws java.io.IOException
renderEnd
renderStart
in class AbstractRenderer
context
- FacesContext for the request we are processing.component
- UIComponent to be decoded.writer
- ResponseWriter
to which the element
start should be rendered
java.io.IOException
- if an input/output error occurspublic void renderEnd(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, javax.faces.context.ResponseWriter writer) throws java.io.IOException
RbCbRendererBase
for
details on encoding a Checkbox
component.
renderEnd
in class AbstractRenderer
context
- FacesContext for the request we are processing.component
- UIComponent to be decoded.writer
- ResponseWriter
to which the element
start should be rendered
java.io.IOException
- if an input/output error occursprotected boolean isSelected(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component)
component
is selected, false
otherwise.
context
- FacesContext for the request we are processing.component
- UIComponent to test for selectedprotected java.lang.String getStyle(Theme theme, int styleCode)
styleCode
theme
- The Theme for this request.styleCode
- identifies the style class for the element about
to be rendered.public void encodeChildren(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component) throws java.io.IOException
encodeChildren
in class AbstractRenderer
context
- FacesContext for the request we are processing.component
- UIComponent to be decoded.
java.io.IOException
- if an input/output error occursprotected void renderSelection(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, Theme theme, javax.faces.context.ResponseWriter writer, java.lang.String type) throws java.io.IOException
context
- FacesContext for the request we are processing.component
- UIComponent to be decoded.writer
- ResponseWriter
to which the HTML will
be outputtype
- the INPUT element type attribute value.
java.io.IOException
protected void renderInput(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, Theme theme, javax.faces.context.ResponseWriter writer, java.lang.String type) throws java.io.IOException
type
for the specified component
.
context
- FacesContext for the request we are processing.component
- UIComponent to be rendered.writer
- ResponseWriter
to which the HTML will
be outputtype
- the INPUT element type attribute value.
java.io.IOException
protected void renderImage(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, Theme theme, javax.faces.context.ResponseWriter writer) throws java.io.IOException
item
control.
context
- FacesContext for the request we are processing.component
- UIComponent to be decoded.writer
- ResponseWriter
to which the HTML will
be output
java.io.IOException
protected void renderLabel(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, Theme theme, javax.faces.context.ResponseWriter writer) throws java.io.IOException
renderSelection
to render a LABEL.
context
- FacesContext for the request we are processing.component
- UIComponent to be decoded.writer
- ResponseWriter
to which the HTML will
be output
java.io.IOException
public java.lang.Object getConvertedValue(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, java.lang.Object submittedValue) throws javax.faces.convert.ConverterException
Attempt to convert previously stored state information into an
object of the type required for this component (optionally using the
registered Converter
for this component,
if there is one). If conversion is successful, the new value
is returned and if not, a
ConverterException
is thrown.
getConvertedValue
in class javax.faces.render.Renderer
context
- FacesContext
for the request we are processingcomponent
- component being renderer.submittedValue
- a value stored on the component during
decode
.
javax.faces.convert.ConverterException
- if the submitted value
cannot be converted successfully.
java.lang.NullPointerException
- if context
or component
is null
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |