org.apache.myfaces.trinidadinternal.ui
Class ElementRenderer

java.lang.Object
  extended by org.apache.myfaces.trinidadinternal.ui.BaseRenderer
      extended by org.apache.myfaces.trinidadinternal.ui.ElementRenderer
All Implemented Interfaces:
Renderer
Direct Known Subclasses:
BaseLafRenderer, HTMLElementRenderer

public class ElementRenderer
extends BaseRenderer

Renderer implementation that can output elements. This base implementation outputs no attributes; clients must override renderAttributes(). It will output the start and element tags, based on the return value of getElementName().

Version:
$Name: $ ($Revision: adfrt/faces/adf-faces-impl/src/main/java/oracle/adfinternal/view/faces/ui/ElementRenderer.java#0 $) $Date: 10-nov-2005.18:50:13 $
Author:
The Oracle ADF Faces Team

Field Summary
 
Fields inherited from class org.apache.myfaces.trinidadinternal.ui.BaseRenderer
NO_CHILD_INDEX
 
Constructor Summary
ElementRenderer()
          Creates an ElementRenderer
 
Method Summary
protected  java.lang.String getElementName(UIXRenderingContext context, UINode node)
          Called to retrieve the element name to render.
static Renderer getRenderer()
          Returns a shared instance of this renderer.
protected  void postrender(UIXRenderingContext context, UINode node)
          Called to render the portion after the contents.
protected  void prerender(UIXRenderingContext context, UINode node)
          Called to render the portion before the contents.
protected  void renderAttribute(UIXRenderingContext context, java.lang.String name, java.lang.Object value)
          Renders a single attribute.
protected  void renderAttribute(UIXRenderingContext context, UINode node, AttributeKey key, java.lang.Object defaultValue)
          Renders a single attribute, getting the value from the UINode, and substituting a default value if the node doesn't have that attribute set.
protected  void renderAttribute(UIXRenderingContext context, UINode node, java.lang.String name, AttributeKey valueKey)
          Renders a single attribute, getting the value from the UINode.
protected  void renderAttribute(UIXRenderingContext context, UINode node, java.lang.String name, AttributeKey valueKey, java.lang.Object defaultValue)
          Renders a single attribute, getting the value from the UINode, and substituting a default value if the node doesn't have that attribute set.
protected  void renderAttributes(UIXRenderingContext context, UINode node)
          Renders attributes of the current node.
 
Methods inherited from class org.apache.myfaces.trinidadinternal.ui.BaseRenderer
getNextRenderedChildIndex, getNextRenderedChildNode, getVisibleIndexedChildCount, render, renderBetweenIndexedChildren, renderBetweenIndexedChildren, renderChild, renderContent, renderIndexedChild, renderIndexedChild, renderNamedChild, renderNamedChild, skipChild, skipNode
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ElementRenderer

public ElementRenderer()
Creates an ElementRenderer

Method Detail

getRenderer

public static Renderer getRenderer()
Returns a shared instance of this renderer.


prerender

protected void prerender(UIXRenderingContext context,
                         UINode node)
                  throws java.io.IOException
Called to render the portion before the contents. This implementation will output a start element tag and call renderAttributes(). Uses the element name returned by getElementName().

Overrides:
prerender in class BaseRenderer
Parameters:
context - the rendering context
node - the current UINode
Throws:
java.io.IOException
See Also:
renderAttributes(org.apache.myfaces.trinidadinternal.ui.UIXRenderingContext, org.apache.myfaces.trinidadinternal.ui.UINode), getElementName(org.apache.myfaces.trinidadinternal.ui.UIXRenderingContext, org.apache.myfaces.trinidadinternal.ui.UINode)

postrender

protected void postrender(UIXRenderingContext context,
                          UINode node)
                   throws java.io.IOException
Called to render the portion after the contents. This implementation outputs a close element tag. Uses the element name returned by getElementName().

Overrides:
postrender in class BaseRenderer
Parameters:
context - the rendering context
node - the current UINode
Throws:
java.io.IOException
See Also:
getElementName(org.apache.myfaces.trinidadinternal.ui.UIXRenderingContext, org.apache.myfaces.trinidadinternal.ui.UINode)

renderAttributes

protected void renderAttributes(UIXRenderingContext context,
                                UINode node)
                         throws java.io.IOException
Renders attributes of the current node. The default implementation does not render any attributes; subclasses should override this method if they need to output attributes.

Parameters:
context - the rendering context
node - the current UINode
Throws:
java.io.IOException

renderAttribute

protected void renderAttribute(UIXRenderingContext context,
                               java.lang.String name,
                               java.lang.Object value)
                        throws java.io.IOException
Renders a single attribute. Default implementation does nothing if the value is null; otherwise, uses the current output method to render an attribute.

Parameters:
context - the rendering context
name - the attribute name for rendering
value - the attribute value
Throws:
java.io.IOException

renderAttribute

protected final void renderAttribute(UIXRenderingContext context,
                                     UINode node,
                                     java.lang.String name,
                                     AttributeKey valueKey)
                              throws java.io.IOException
Renders a single attribute, getting the value from the UINode.

Parameters:
context - the rendering context
node - the node to get the attribute from
name - the attribute name for rendering
valueKey - the key to use to retrieve the attribute
Throws:
java.io.IOException

renderAttribute

protected final void renderAttribute(UIXRenderingContext context,
                                     UINode node,
                                     java.lang.String name,
                                     AttributeKey valueKey,
                                     java.lang.Object defaultValue)
                              throws java.io.IOException
Renders a single attribute, getting the value from the UINode, and substituting a default value if the node doesn't have that attribute set.

Parameters:
context - the rendering context
node - the node to get the attribute from
name - the attribute name for rendering
valueKey - the key to use to retrieve the attribute
defaultValue - the default value to use if the attribute isn't set
Throws:
java.io.IOException

renderAttribute

protected final void renderAttribute(UIXRenderingContext context,
                                     UINode node,
                                     AttributeKey key,
                                     java.lang.Object defaultValue)
                              throws java.io.IOException
Renders a single attribute, getting the value from the UINode, and substituting a default value if the node doesn't have that attribute set. This convenience method will use the same name for rendering the attribute as for retrieving it from the UINode.

Parameters:
context - the rendering context
node - the node to get the attribute from
key - the attribute key for rendering and for retrieving the value
defaultValue - the default value to use if the attribute isn't set
Throws:
java.io.IOException

getElementName

protected java.lang.String getElementName(UIXRenderingContext context,
                                          UINode node)
Called to retrieve the element name to render. Default implementation returns null.

Parameters:
context - the rendering context
node - the current node


Copyright © 2001-2007 Apache Software Foundation. All Rights Reserved.