com.sun.rave.web.ui.renderer
Class AbstractRenderer

java.lang.Object
  extended by javax.faces.render.Renderer
      extended by com.sun.rave.web.ui.renderer.AbstractRenderer
Direct Known Subclasses:
AlertRenderer, AnchorRenderer, BodyRenderer, BreadcrumbsRenderer, ButtonRenderer, CalendarMonthRenderer, CheckboxGroupRenderer, CheckboxRenderer, FormRenderer, FrameRenderer, FrameSetRenderer, HeadRenderer, HelpInlineRenderer, HtmlRenderer, HyperlinkRenderer, ImageRenderer, LegendRenderer, LinkRenderer, MarkupRenderer, MessageGroupRenderer, MessageRenderer, MetaRenderer, PageAlertRenderer, PageSeparatorRenderer, PanelGroupRenderer, PanelLayoutRenderer, RadioButtonGroupRenderer, RadioButtonRenderer, ScriptRenderer, SkipHyperlinkRenderer, StaticTextRenderer, TabSetRenderer

public abstract class AbstractRenderer
extends javax.faces.render.Renderer

Abstract base class for concrete implementations of javax.faces.render.Renderer for JavaServer Faces component libraries.


Field Summary
protected static java.lang.String BUNDLE
          Base naem of the resource bundle we will use for localization.
static java.lang.String[] EVENTS_ATTRIBUTES
          The list of attribute names in the HTML 4.01 Specification that correspond to the entity type %events;.
static java.lang.String[] I18N_ATTRIBUTES
          The list of attribute names in the HTML 4.01 Specification that correspond to the entity type %i18n;.
 
Constructor Summary
AbstractRenderer()
           
 
Method Summary
protected  void addBooleanAttributes(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, javax.faces.context.ResponseWriter writer, java.lang.String[] names)
          Render any boolean attributes on the specified list that have true values on the corresponding attribute of the specified UIComponent.
protected  void addCoreAttributes(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, javax.faces.context.ResponseWriter writer, java.lang.String styles)
          Render the "core" set of attributes for this UIComponent.
protected  void addIntegerAttributes(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, javax.faces.context.ResponseWriter writer, java.lang.String[] names)
          Render any Integer attributes on the specified list that do not have Integer.MIN_VALUE values on the corresponding attribute of the specified UIComponent.
protected static void addStringAttributes(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, javax.faces.context.ResponseWriter writer, java.lang.String[] names)
          Add any attributes on the specified list directly to the specified ResponseWriter for which the specified UIComponent has a non-null String value.
 void decode(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component)
          Decode any new state of the specified UIComponent from the request contained in the specified FacesContext, and store that state on the UIComponent.
 void encodeBegin(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component)
          Render the beginning of the specified UIComponent to the output stream or writer associated with the response we are creating.
 void encodeChildren(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component)
          Render the children of the specified UIComponent to the output stream or writer associated with the response we are creating.
 void encodeEnd(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component)
          Render the ending of the specified UIComponent to the output stream or writer associated with the response we are creating.
protected  javax.faces.application.Application getApplication()
          Return the Application instance for this web application.
protected  java.lang.Object getAsObject(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, java.lang.String value)
          Return the value to be stored, as an Object that has been converted from the String representation (if necessary), or null if the String representation is null.
protected  java.lang.String getAsString(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component)
          Return the value to be rendered, as a String (converted if necessary), or null if the value is null.
protected  javax.faces.context.ExternalContext getExternalContext()
          Return the ExternalContext instance for the current request.
protected  javax.faces.context.FacesContext getFacesContext()
          Return the FacesContext instance for the current request.
protected  java.lang.Object getSubmittedValue(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component)
          Retrieve the submitted value from the request parameters for this request.
protected  boolean isDisabled(javax.faces.component.UIComponent component)
          Return true if the specified component is disabled.
protected  boolean isPortlet(javax.faces.context.FacesContext context)
          Return true if we are we running in a portlet environment, as opposed to a servlet based web application.
protected  boolean isReadOnly(javax.faces.component.UIComponent component)
          Return true if the specified component is read only.
protected  void renderAttributes(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, javax.faces.context.ResponseWriter writer)
          Render the element attributes for the generated markup related to this component.
protected  void renderEnd(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, javax.faces.context.ResponseWriter writer)
          Render the element end for the generated markup related to this component.
protected  void renderMarkup(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, javax.faces.context.ResponseWriter writer, Markup markup)
          Render the specified markup to the current response.
protected  void renderStart(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, javax.faces.context.ResponseWriter writer)
          Render the element start for the generated markup related to this component.
protected  void setSubmittedValue(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component)
          If a submitted value was included on this request, store it in the component as appropriate.
 
Methods inherited from class javax.faces.render.Renderer
convertClientId, getConvertedValue, getRendersChildren
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BUNDLE

protected static final java.lang.String BUNDLE

Base naem of the resource bundle we will use for localization.

See Also:
Constant Field Values

EVENTS_ATTRIBUTES

public static final java.lang.String[] EVENTS_ATTRIBUTES

The list of attribute names in the HTML 4.01 Specification that correspond to the entity type %events;.


I18N_ATTRIBUTES

public static final java.lang.String[] I18N_ATTRIBUTES

The list of attribute names in the HTML 4.01 Specification that correspond to the entity type %i18n;.

Constructor Detail

AbstractRenderer

public AbstractRenderer()
Method Detail

decode

public void decode(javax.faces.context.FacesContext context,
                   javax.faces.component.UIComponent component)

Decode any new state of the specified UIComponent from the request contained in the specified FacesContext, and store that state on the UIComponent.

The default implementation calls setSubmittedValue() on components that implement EditableValueHolder (i.e. input fields)

Overrides:
decode in class javax.faces.render.Renderer
Parameters:
context - FacesContext for the current request
component - UIComponent to be decoded
Throws:
java.lang.NullPointerException - if context or component is null

encodeBegin

public void encodeBegin(javax.faces.context.FacesContext context,
                        javax.faces.component.UIComponent component)
                 throws java.io.IOException

Render the beginning of the specified UIComponent to the output stream or writer associated with the response we are creating.

The default implementation calls renderStart() and renderAttributes().

Overrides:
encodeBegin in class javax.faces.render.Renderer
Parameters:
context - FacesContext for the current request
component - UIComponent to be decoded
Throws:
java.lang.NullPointerException - if context or component is null
java.io.IOException - if an input/output error occurs

encodeChildren

public void encodeChildren(javax.faces.context.FacesContext context,
                           javax.faces.component.UIComponent component)
                    throws java.io.IOException

Render the children of the specified UIComponent to the output stream or writer associated with the response we are creating.

The default implementation iterates through the children of this component and renders them.

Overrides:
encodeChildren in class javax.faces.render.Renderer
Parameters:
context - FacesContext for the current request
component - UIComponent to be decoded
Throws:
java.lang.NullPointerException - if context or component is null
java.io.IOException - if an input/output error occurs

encodeEnd

public void encodeEnd(javax.faces.context.FacesContext context,
                      javax.faces.component.UIComponent component)
               throws java.io.IOException

Render the ending of the specified UIComponent to the output stream or writer associated with the response we are creating.

The default implementation calls renderEnd().

Overrides:
encodeEnd in class javax.faces.render.Renderer
Parameters:
context - FacesContext for the current request
component - UIComponent to be decoded
Throws:
java.lang.NullPointerException - if context or component is null
java.io.IOException - if an input/output error occurs

addBooleanAttributes

protected void addBooleanAttributes(javax.faces.context.FacesContext context,
                                    javax.faces.component.UIComponent component,
                                    javax.faces.context.ResponseWriter writer,
                                    java.lang.String[] names)
                             throws java.io.IOException

Render any boolean attributes on the specified list that have true values on the corresponding attribute of the specified UIComponent. Attribute names are converted to lower case in the rendered output.

Parameters:
context - FacesContext for the current request
component - EditableValueHolder component whose submitted value is to be stored
writer - ResponseWriter to which the element start should be rendered
names - List of attribute names to be passed through
Throws:
java.io.IOException - if an input/output error occurs

addCoreAttributes

protected void addCoreAttributes(javax.faces.context.FacesContext context,
                                 javax.faces.component.UIComponent component,
                                 javax.faces.context.ResponseWriter writer,
                                 java.lang.String styles)
                          throws java.io.IOException

Render the "core" set of attributes for this UIComponent. The default implementation conditionally generates the following attributes with values as specified.

Parameters:
context - FacesContext for the current request
component - EditableValueHolder component whose submitted value is to be stored
writer - ResponseWriter to which the element start should be rendered
styles - Space-separated list of CSS style classes to add to the class attribute, or null for none
Throws:
java.io.IOException - if an input/output error occurs

addIntegerAttributes

protected void addIntegerAttributes(javax.faces.context.FacesContext context,
                                    javax.faces.component.UIComponent component,
                                    javax.faces.context.ResponseWriter writer,
                                    java.lang.String[] names)
                             throws java.io.IOException

Render any Integer attributes on the specified list that do not have Integer.MIN_VALUE values on the corresponding attribute of the specified UIComponent. Attribute names are converted to lower case in the rendered output.

Parameters:
context - FacesContext for the current request
component - EditableValueHolder component whose submitted value is to be stored
writer - ResponseWriter to which the element start should be rendered
names - List of attribute names to be passed through
Throws:
java.io.IOException - if an input/output error occurs

addStringAttributes

protected static void addStringAttributes(javax.faces.context.FacesContext context,
                                          javax.faces.component.UIComponent component,
                                          javax.faces.context.ResponseWriter writer,
                                          java.lang.String[] names)
                                   throws java.io.IOException

Add any attributes on the specified list directly to the specified ResponseWriter for which the specified UIComponent has a non-null String value. This method may be used to "pass through" commonly used attribute name/value pairs with a minimum of code. Attribute names are converted to lower case in the rendered output.

Parameters:
context - FacesContext for the current request
component - EditableValueHolder component whose submitted value is to be stored
writer - ResponseWriter to which the element start should be rendered
names - List of attribute names to be passed through
Throws:
java.io.IOException - if an input/output error occurs

getApplication

protected javax.faces.application.Application getApplication()

Return the Application instance for this web application.


getAsObject

protected java.lang.Object getAsObject(javax.faces.context.FacesContext context,
                                       javax.faces.component.UIComponent component,
                                       java.lang.String value)

Return the value to be stored, as an Object that has been converted from the String representation (if necessary), or null if the String representation is null.

Parameters:
context - FacesContext for the current request
component - Component whose value is being processed (must be a component that implements ValueHolder
value - String representation of the value

getAsString

protected java.lang.String getAsString(javax.faces.context.FacesContext context,
                                       javax.faces.component.UIComponent component)

Return the value to be rendered, as a String (converted if necessary), or null if the value is null.

Parameters:
context - FacesContext for the current request
component - Component whose value is to be retrieved (must be a component that implements ValueHolder)

getExternalContext

protected javax.faces.context.ExternalContext getExternalContext()

Return the ExternalContext instance for the current request.


getFacesContext

protected javax.faces.context.FacesContext getFacesContext()

Return the FacesContext instance for the current request.


getSubmittedValue

protected java.lang.Object getSubmittedValue(javax.faces.context.FacesContext context,
                                             javax.faces.component.UIComponent component)

Retrieve the submitted value from the request parameters for this request. The default implementation retrieves the parameter value that corresponds to the client identifier of this component.

Parameters:
context - FacesContext for the current request
component - UIComponent whose submitted value is to be retrieved

isDisabled

protected boolean isDisabled(javax.faces.component.UIComponent component)

Return true if the specified component is disabled.

Parameters:
component - UIComponent to be checked

isPortlet

protected boolean isPortlet(javax.faces.context.FacesContext context)

Return true if we are we running in a portlet environment, as opposed to a servlet based web application.

Parameters:
context - FacesContext for the current request

isReadOnly

protected boolean isReadOnly(javax.faces.component.UIComponent component)

Return true if the specified component is read only.

Parameters:
component - UIComponent to be checked

renderAttributes

protected void renderAttributes(javax.faces.context.FacesContext context,
                                javax.faces.component.UIComponent component,
                                javax.faces.context.ResponseWriter writer)
                         throws java.io.IOException

Render the element attributes for the generated markup related to this component. Simple renderers that create a single markup element for this component should override this method and include calls to to writeAttribute() and writeURIAttribute on the specified ResponseWriter.

The default implementation does nothing.

Parameters:
context - FacesContext for the current request
component - EditableValueHolder component whose submitted value is to be stored
writer - ResponseWriter to which the element start should be rendered
Throws:
java.io.IOException - if an input/output error occurs

renderEnd

protected void renderEnd(javax.faces.context.FacesContext context,
                         javax.faces.component.UIComponent component,
                         javax.faces.context.ResponseWriter writer)
                  throws java.io.IOException

Render the element end for the generated markup related to this component. Simple renderers that create a single markup element for this component should override this method and include a call to endElement() on the specified ResponseWriter.

The default implementation does nothing.

Parameters:
context - FacesContext for the current request
component - EditableValueHolder component whose submitted value is to be stored
writer - ResponseWriter to which the element start should be rendered
Throws:
java.io.IOException - if an input/output error occurs

renderMarkup

protected void renderMarkup(javax.faces.context.FacesContext context,
                            javax.faces.component.UIComponent component,
                            javax.faces.context.ResponseWriter writer,
                            Markup markup)
                     throws java.io.IOException

Render the specified markup to the current response.

Parameters:
context - FacesContext for the current request
component - UIComponent associated with this markup
writer - ResponseWriter to which the markup should be rendered
markup - Markup to be rendered
Throws:
java.io.IOException

renderStart

protected void renderStart(javax.faces.context.FacesContext context,
                           javax.faces.component.UIComponent component,
                           javax.faces.context.ResponseWriter writer)
                    throws java.io.IOException

Render the element start for the generated markup related to this component. Simple renderers that create a single markup element for this component should override this method and include a call to startElement() on the specified ResponseWriter.

The default implementation does nothing.

Parameters:
context - FacesContext for the current request
component - EditableValueHolder component whose submitted value is to be stored
writer - ResponseWriter to which the element start should be rendered
Throws:
java.io.IOException - if an input/output error occurs

setSubmittedValue

protected void setSubmittedValue(javax.faces.context.FacesContext context,
                                 javax.faces.component.UIComponent component)

If a submitted value was included on this request, store it in the component as appropriate.

The default implementation determines whether this component implements EditableValueHolder. If so, it checks for a request parameter with the same name as the clientId of this UIComponent. If there is such a parameter, its value is passed (as a String) to the setSubmittedValue() method on the EditableValueHolder component.

Parameters:
context - FacesContext for the current request
component - EditableValueHolder component whose submitted value is to be stored