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

java.lang.Object
  extended by javax.faces.render.Renderer
      extended by com.sun.rave.web.ui.renderer.ListRendererBase
Direct Known Subclasses:
AddRemoveRenderer, DropDownRenderer, EditableListRenderer, ListboxRenderer, OrderableListRenderer, SelectRenderer

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

The ListRendererBase is the base class for the listbox renderers (Drop-down Menu and Selectable List). These are both rendered using the same HTML tag (select) so a lot of the renderering functionality is shared.


Field Summary
protected static java.lang.String SEPARATOR
           
static java.lang.String[] STRING_ATTRIBUTES
          The list of attribute names in the HTML 4.01 Specification that correspond to the entity type %events;.
 
Constructor Summary
ListRendererBase()
           
 
Method Summary
 void decode(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component)
          Retrieve user input from the UI.
protected  void decode(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, java.lang.String id)
          Retrieve user input from the UI.
 void encodeChildren(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component)
          Overrides encodeChildren of Renderer to do nothing.
protected  java.lang.String getOnChangeJavaScript(ListManager component, java.lang.String functionName, javax.faces.context.FacesContext context)
          Append the webui component's own JavaScript function at the end of any component-specific event handling code.
 boolean getRendersChildren()
          The list is not responsible for rendering any child components, so this method returns false.
protected  void renderHiddenValue(javax.faces.component.UIComponent component, javax.faces.context.FacesContext context, javax.faces.context.ResponseWriter writer, java.lang.String hiddenStyle)
           
protected  void renderList(ListManager component, java.lang.String id, javax.faces.context.FacesContext context, java.lang.String[] styles)
          This is the base method for rendering a HTML select element.
protected  void renderOpenEncloser(ListManager component, javax.faces.context.FacesContext context, java.lang.String element, java.lang.String hiddenStyle)
          Renders the opening div tag.
 
Methods inherited from class javax.faces.render.Renderer
convertClientId, encodeBegin, encodeEnd, getConvertedValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STRING_ATTRIBUTES

public static final java.lang.String[] STRING_ATTRIBUTES

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


SEPARATOR

protected static final java.lang.String SEPARATOR
See Also:
Constant Field Values
Constructor Detail

ListRendererBase

public ListRendererBase()
Method Detail

encodeChildren

public void encodeChildren(javax.faces.context.FacesContext context,
                           javax.faces.component.UIComponent component)
                    throws java.io.IOException
Overrides encodeChildren of Renderer to do nothing. This renderer renders its own children, but not through this method.

Overrides:
encodeChildren in class javax.faces.render.Renderer
Parameters:
context - The FacesContext of the request
component - The component associated with the renderer. Must be a subclass of ListSelector.
Throws:
java.io.IOException

renderOpenEncloser

protected void renderOpenEncloser(ListManager component,
                                  javax.faces.context.FacesContext context,
                                  java.lang.String element,
                                  java.lang.String hiddenStyle)
                           throws java.io.IOException

Renders the opening div tag.

Parameters:
component - The component associated with the renderer. Must implement ListManager
context - The FacesContext of the request
element - One of "span" or "div"
Throws:
java.io.IOException - if the renderer fails to write to the response

renderHiddenValue

protected void renderHiddenValue(javax.faces.component.UIComponent component,
                                 javax.faces.context.FacesContext context,
                                 javax.faces.context.ResponseWriter writer,
                                 java.lang.String hiddenStyle)
                          throws java.io.IOException
Throws:
java.io.IOException

renderList

protected void renderList(ListManager component,
                          java.lang.String id,
                          javax.faces.context.FacesContext context,
                          java.lang.String[] styles)
                   throws java.io.IOException
This is the base method for rendering a HTML select element. This method is based on the functionality of the RI version, so it invokes a method renderSelectItems which in term invokes renderSelectItem. Currently, this renderer requires for the options to be specified using the JSF SelectItem construct, but this should be replaced with a Lockhart version, because the JSF version lacks the ability to associate an id with the list item. I'm not sure whether it should be possible to use SelectItem as well yet.

Parameters:
component - The UI Component associated with the renderer.
context - The FacesContext of the request
styles - A String array of styles used to render the component. The first item of the array is the name of the JavaScript method that handles change event. The second item is the style used when the list is enabled. The third style is the one to use when the list is disabled. The fourth item is the style to use for an item that is enabled, the fifth to use for an item that is disabled, and the sixth to use when the item is selected.
Throws:
java.io.IOException - if the renderer fails to write to the response

getOnChangeJavaScript

protected java.lang.String getOnChangeJavaScript(ListManager component,
                                                 java.lang.String functionName,
                                                 javax.faces.context.FacesContext context)
Append the webui component's own JavaScript function at the end of any component-specific event handling code.

Parameters:
component - The ListManager for which we create the function call
functionName - The name of the function
context - The FacesContext of this request

decode

public void decode(javax.faces.context.FacesContext context,
                   javax.faces.component.UIComponent component)
Retrieve user input from the UI.

Overrides:
decode in class javax.faces.render.Renderer
Parameters:
context - The FacesContext of this request
component - The component associated with the renderer

decode

protected void decode(javax.faces.context.FacesContext context,
                      javax.faces.component.UIComponent component,
                      java.lang.String id)
Retrieve user input from the UI. The expected format of the request parameter of interest is valuevalue ... If a value is an empty string the format is If there is no value there is a single separator.

Parameters:
context - The FacesContext of this request
component - The component associated with the renderer
id - The DOM id of the select element which represents the value of the list

getRendersChildren

public boolean getRendersChildren()
The list is not responsible for rendering any child components, so this method returns false. (This is unintuitive, but it causes the right behaviour). I need to understand this better.

Overrides:
getRendersChildren in class javax.faces.render.Renderer