| com.sun.rave.web.ui.renderer.AbstractRenderer com.sun.rave.web.ui.renderer.RbCbRendererBase
All known Subclasses: com.sun.rave.web.ui.renderer.CheckboxRenderer, com.sun.rave.web.ui.renderer.RadioButtonRenderer,
RbCbRendererBase | abstract class RbCbRendererBase extends AbstractRenderer (Code) | |
The RbCbRendererBase class is the abstract base class for
com.sun.rave.web.ui.renderer.RadioButtonRenderer and
com.sun.rave.web.ui.renderer.CheckboxRenderer .
RbCbRendererBase provides encoding functionality for
the RadioButtonRenderer and CheckboxRenderer .
This includes an implementation of getConvertedValue , and
a method called renderSelection which a subclass calls to render
either a Checkbox or a RadioButton component
at the appropriate time.
The renderer subclass must implement
isSelected in order for this class to generically render
either component
getStyle so the specific subclass can specify the
appropriate ThemeStyle constants.
Decoding
See
com.sun.rave.web.ui.renderer.RadioButtonRenderer and
com.sun.rave.web.ui.renderer.CheckboxRenderer for details on
decoding requests.
Encoding
The renderer emits the following HTML elements.
The ID attributes for HTML elements are constructed as follows,
where <cid> is the clientId of the
component being rendered.
<cid> for the INPUT element
<cid>_image for the image component
<cid>_label for the label component
Encoding the INPUT element
If the name property of the component is null
the name attribute of the INPUT element will be set to the
value of the component's clientId and the control will
not be part of a group, and behave as an individual control.
If the name property is not null then its
value is used as the value of the name attribute of the HTML INPUT
element and the control will behave as part of a group.
The ConversionUtilities.getValueAsString method is called with
the value of the component's selectedValue property
and the result is used as the value of the HTML INPUT element's
value attribute. The String value that is returned may be
the actual value of the selectedValue property or
the result of a conversion of a developer defined object value
to a String or "true" if the selectedValue
property was null or never assigned a value.The components
com.sun.rave.web.ui.component.RadioButton and
com.sun.rave.web.ui.component.Checkbox implement the behavior
of returning "true" when selectedValue is null. Therefore
if the component parameter is not one of these classes then this behavior
may vary.
If isSelected returns true the
the value of the HTML INPUT element's checked attribute is set to "checked",
otherwise the checked attribute is not rendered.
The following component properties are obtained and rendered in turn and
equivalent to the HTML INPUT element's attributes of the same name, but
rendered in all lowercase.
- disabled
- readOnly
- tabIndex
- style
The component's toolTip property if not null is rendered as the
value of the HTML INPUT element's title attribute.
The HTML INPUT element's class attribute is set to the
component's styleClass property appended with
the value returned from a call to the getStyle method.
Rendering the image component
The renderer calls the component's getImageComponent
method to obtain an instance of a
com.sun.rave.web.ui.component.ImageComponent component. If
null is returned, no image will appear with the control.
If a non null instance is returned, the appropriate disabled or
enabled style class returned by getStyle
is appended to the image's styleClass property.
RenderingUtilities.renderComponent is called to render
the component.
If an image is rendered it appears to the immediate left of the
control.
Encoding the label component
The renderer calls the component's getLabelComponent
method to obtain an instance of a
com.sun.rave.web.ui.component.Label component. If
null is returned, no label will appear with the control.
If a non null instance is returned, the appropriate disabled or
enabled style class returned by getStyle
is appended to the label's styleClass property.
RenderingUtilities.renderComponent is called to render
the component.
|
Field Summary | |
final protected static int | IMAGE The define constant indicating the style class
for the IMG element. | final protected static int | IMAGE_DIS The define constant indicating the style class
for a disabled IMG element. | final protected static int | INPUT The define constant indicating the style class
for an INPUT element. | final protected static int | INPUT_DIS The define constant indicating the style class
for a disabled INPUT element. | final protected static int | LABEL The define constant indicating the style class
for the LABEL element. | final protected static int | LABEL_DIS The define constant indicating the style class
for a disabled LABEL element. | final public static String | RBCB_EVENTS_ATTRIBUTES | final protected static int | SPAN | final protected static int | SPAN_DIS The define constant indicating the style class for
for the containing span element, when disabled. |
Method Summary | |
public void | encodeChildren(FacesContext context, UIComponent component) Render the child components of this UIComponent, following the rules
described for encodeBegin() to acquire the appropriate value to be
rendered. | public Object | getConvertedValue(FacesContext context, UIComponent component, Object submittedValue)
Attempt to convert previously stored state information into an
object of the type required for this component (optionally using the
registered
javax.faces.convert.Converter for this component,
if there is one). | abstract protected String | getStyle(Theme theme, int styleCode) The getStlye method is implemented by subclasses
to return the actual CSS style class name for
the given structural element of the rendered component. | abstract protected boolean | isSelected(FacesContext context, UIComponent component) Implemented in the subclass to determine if the item
is the currently selected control. | protected void | renderImage(FacesContext context, UIComponent component, Theme theme, ResponseWriter writer) Called from renderSelection to render an IMG element for the
specified item control. | protected void | renderInput(FacesContext context, UIComponent component, Theme theme, ResponseWriter writer, String type) Called from renderSelection to render an INPUT element of type
type for the specified component . | protected void | renderLabel(FacesContext context, UIComponent component, Theme theme, ResponseWriter writer) Called from renderSelection to render a LABEL. | protected void | renderSelection(FacesContext context, UIComponent component, Theme theme, ResponseWriter writer, String type) Render a radio button or a checkbox. |
IMAGE | final protected static int IMAGE(Code) | | The define constant indicating the style class
for the IMG element.
|
IMAGE_DIS | final protected static int IMAGE_DIS(Code) | | The define constant indicating the style class
for a disabled IMG element.
|
INPUT | final protected static int INPUT(Code) | | The define constant indicating the style class
for an INPUT element.
|
INPUT_DIS | final protected static int INPUT_DIS(Code) | | The define constant indicating the style class
for a disabled INPUT element.
|
LABEL | final protected static int LABEL(Code) | | The define constant indicating the style class
for the LABEL element.
|
LABEL_DIS | final protected static int LABEL_DIS(Code) | | The define constant indicating the style class
for a disabled LABEL element.
|
RBCB_EVENTS_ATTRIBUTES | final public static String RBCB_EVENTS_ATTRIBUTES(Code) | | The list of attribute names for Rb and Cb
|
SPAN | final protected static int SPAN(Code) | | The define constant indicating the style class for
for the containing span element
|
SPAN_DIS | final protected static int SPAN_DIS(Code) | | The define constant indicating the style class for
for the containing span element, when disabled.
|
RbCbRendererBase | public RbCbRendererBase()(Code) | | Creates a new instance of RbCbRendererBase
|
encodeChildren | public void encodeChildren(FacesContext context, UIComponent component) throws IOException(Code) | | Render the child components of this UIComponent, following the rules
described for encodeBegin() to acquire the appropriate value to be
rendered. This method will only be called if the rendersChildren property
of this component is true.
Parameters: context - FacesContext for the request we are processing. Parameters: component - UIComponent to be decoded. |
getConvertedValue | public Object getConvertedValue(FacesContext context, UIComponent component, Object submittedValue) throws ConverterException(Code) | |
Attempt to convert previously stored state information into an
object of the type required for this component (optionally using the
registered
javax.faces.convert.Converter for this component,
if there is one). If conversion is successful, the new value
is returned and if not, a
javax.faces.convert.ConverterException is thrown.
Parameters: context - FacesContext for the request we are processing Parameters: component - component being renderer. Parameters: submittedValue - a value stored on the component duringdecode . exception: ConverterException - if the submitted valuecannot be converted successfully. exception: NullPointerException - if context or component is null |
getStyle | abstract protected String getStyle(Theme theme, int styleCode)(Code) | | The getStlye method is implemented by subclasses
to return the actual CSS style class name for
the given structural element of the rendered component.
Parameters: theme - Theme for the request we are processing. Parameters: styleCode - one of the previously defined constants. |
isSelected | abstract protected boolean isSelected(FacesContext context, UIComponent component)(Code) | | Implemented in the subclass to determine if the item
is the currently selected control.
Parameters: Object - selectedValue contol value. Parameters: currentValue - the value of the currently selected control. |
renderImage | protected void renderImage(FacesContext context, UIComponent component, Theme theme, ResponseWriter writer) throws IOException(Code) | | Called from renderSelection to render an IMG element for the
specified item control.
Parameters: context - FacesContext for the request we are processing. Parameters: component - UIComponent to be decoded. Parameters: writer - ResponseWriter to which the HTML willbe output |
renderInput | protected void renderInput(FacesContext context, UIComponent component, Theme theme, ResponseWriter writer, String type) throws IOException(Code) | | Called from renderSelection to render an INPUT element of type
type for the specified component .
Parameters: context - FacesContext for the request we are processing. Parameters: component - UIComponent to be rendered. Parameters: writer - ResponseWriter to which the HTML willbe output Parameters: type - the INPUT element type attribute value. |
renderLabel | protected void renderLabel(FacesContext context, UIComponent component, Theme theme, ResponseWriter writer) throws IOException(Code) | | Called from renderSelection to render a LABEL.
Parameters: context - FacesContext for the request we are processing. Parameters: component - UIComponent to be decoded. Parameters: writer - ResponseWriter to which the HTML willbe output |
renderSelection | protected void renderSelection(FacesContext context, UIComponent component, Theme theme, ResponseWriter writer, String type) throws IOException(Code) | | Render a radio button or a checkbox.
Parameters: context - FacesContext for the request we are processing. Parameters: component - UIComponent to be decoded. Parameters: writer - ResponseWriter to which the HTML willbe output Parameters: type - the INPUT element type attribute value. |
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)
|
|
|