Rewrite old-style renderers (ui subpackage) in new architecture (renderkit.core.xhtml)

List of components

PanelAccordion

in progress

ProcessTrain

DONE

Select*Shuttles

ProcessChoiceBar

PanelChoice

PanelRadio

(known) Contributors:

New Renderers are being buit in org.apache.myfaces.trinidadinternal.renderkit.core.xhtml. XhtmlRenderer extends CoreRenderer is the base class for (most) of our renderers.

These renderers no longer necessarily have a pre- and post- phase. Instead:

  protected void encodeAll(
    FacesContext        context,
    RenderingContext    arc,
    UIComponent         component,
    FacesBean           bean) throws IOException

  protected void encodeBegin(
    FacesContext        context,
    RenderingContext    arc,
    UIComponent         component,
    FacesBean           bean) throws IOException
  protected void encodeEnd(
    FacesContext        context,
    RenderingContext    arc,
    UIComponent         component,
    FacesBean           bean) throws IOException

Retrieving properties

Property retrieval should always go via the bean, not by the component and never, ever by the attribute map. Every time you want a property from a renderer, you do the following:

Example:

  protected void findTypeConstants(FacesBean.Type type)
  {
    super.findTypeConstants(type);
    _shortDescKey = type.findKey("shortDesc");
    // etc...
  }

  protected String getShortDesc(FacesBean bean)
  { 
    // toString() is a convenience function on CoreRenderer
    return toString(bean.getProperty(_shortDescKey));
  }

  private PropertyKey _shortDescKey;

By this strategy, a property like shortDesc that is actually defined at the leaves of our component type heirarchy can be generically referred to in a base renderer.

Rules

The following rules apply:

Replacements for old UIX functionality

RenderingContext replaces most of the UIX!RenderingContext functionality.

One special thing about RenderingContext.getProperties(): if you store an old UIX!RenderingContext property, using the MARLIN_NAMESPACE namespace, it actually goes into the RenderingContext properties Map! So, as long as you use exactly the same key, old- and new-style code can communicate.

Instead of providing PDA or BLAF renderers that just subclass a few things, lean on Skin properties. For example, when deciding whether to show the last "breadCrumb"/"menuPath" item, we now use a Skin property.

Do not refer to UIConstants or XhtmlLafConstants; use XhtmlConstants.

FacesMajor_Renderers (last edited 2009-09-20 23:01:50 by localhost)