org.apache.myfaces.trinidadinternal.ui
Class BaseRenderer

java.lang.Object
  extended by org.apache.myfaces.trinidadinternal.ui.BaseRenderer
All Implemented Interfaces:
Renderer
Direct Known Subclasses:
ChildRenderer, ElementRenderer, ImportScriptRenderer, RawTextRenderer, SwitcherRenderer, TextRenderer

public class BaseRenderer
extends java.lang.Object
implements Renderer

Basic implementation of Renderer.

The protected hooks on this class are called in the following order:

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

Field Summary
protected static int NO_CHILD_INDEX
          Value passed to renderIndexedChild to indicate that no child exists.
 
Constructor Summary
BaseRenderer()
           
 
Method Summary
protected  int getNextRenderedChildIndex(UIXRenderingContext context, UINode parentNode, int afterChildIndex)
           
protected  UINode getNextRenderedChildNode(UIXRenderingContext context, UINode parentNode, int afterChildIndex)
          Returns the next child UINode that will be rendered after the passed in index.
protected  int getVisibleIndexedChildCount(UIXRenderingContext context, UINode node)
          Convenience function to return the number of non-skipped indexed children.
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.
 void render(UIXRenderingContext context, UINode node)
          Render a UINode in a RenderingContext.
protected  void renderBetweenIndexedChildren(UIXRenderingContext context, UINode node)
          Called to render between each set of rendered indexed children.
protected  void renderBetweenIndexedChildren(UIXRenderingContext context, UINode node, int nextIndex)
          Called to render between each set of rendered indexed children.
protected  void renderChild(UIXRenderingContext context, UINode child)
          Called to render a child.
protected  void renderContent(UIXRenderingContext context, UINode node)
           
protected  void renderIndexedChild(UIXRenderingContext context, UINode node, int childIndex)
          Called to render an indexed child.
protected  void renderIndexedChild(UIXRenderingContext context, UINode node, int currVisChildIndex, int prevVisChildIndex, int nextVisChildIndex, int ithRenderedChild)
          Called each time an indexed child needs to be rendered.
protected  void renderNamedChild(UIXRenderingContext context, UINode node, java.lang.String childName)
          Called to render a named child.
protected  void renderNamedChild(UIXRenderingContext context, UINode node, UINode child, java.lang.String childName)
          Called to render a named child.
protected  boolean skipChild(UIXRenderingContext context, UINode node, UINode child)
          Called to determine if a specific child should be skipped.
static boolean skipNode(UIXRenderingContext context, UINode node)
          Determines if a specific UINode should be skipped.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NO_CHILD_INDEX

protected static final int NO_CHILD_INDEX
Value passed to renderIndexedChild to indicate that no child exists.

See Also:
renderIndexedChild(org.apache.myfaces.trinidadinternal.ui.UIXRenderingContext, org.apache.myfaces.trinidadinternal.ui.UINode, int, int, int, int), Constant Field Values
Constructor Detail

BaseRenderer

public BaseRenderer()
Method Detail

skipNode

public static boolean skipNode(UIXRenderingContext context,
                               UINode node)
Determines if a specific UINode should be skipped.

Parameters:
context - the rendering context
node - the node under consideration
Returns:
true for nodes with a UIConstants.RENDERED_ATTR attribute set to Boolean.FALSE.

render

public void render(UIXRenderingContext context,
                   UINode node)
            throws java.io.IOException
Render a UINode in a RenderingContext. Subclassers should not need to override this method.

Specified by:
render in interface Renderer
Parameters:
context - the rendering context
node - the current UINode
Throws:
java.io.IOException

renderContent

protected void renderContent(UIXRenderingContext context,
                             UINode node)
                      throws java.io.IOException
Throws:
java.io.IOException

getNextRenderedChildNode

protected final UINode getNextRenderedChildNode(UIXRenderingContext context,
                                                UINode parentNode,
                                                int afterChildIndex)
Returns the next child UINode that will be rendered after the passed in index.

See Also:
getNextRenderedChildIndex(org.apache.myfaces.trinidadinternal.ui.UIXRenderingContext, org.apache.myfaces.trinidadinternal.ui.UINode, int)

getNextRenderedChildIndex

protected int getNextRenderedChildIndex(UIXRenderingContext context,
                                        UINode parentNode,
                                        int afterChildIndex)
Parameters:
afterChildIndex - The indexed children coming after this index, will be considered. To find the first rendered child use NO_CHILD_INDEX
Returns:
the index of the next child UINode that must be rendered, or NO_CHILD_INDEX if there is none.
See Also:
getNextRenderedChildNode(org.apache.myfaces.trinidadinternal.ui.UIXRenderingContext, org.apache.myfaces.trinidadinternal.ui.UINode, int)

renderIndexedChild

protected void renderIndexedChild(UIXRenderingContext context,
                                  UINode node,
                                  int currVisChildIndex,
                                  int prevVisChildIndex,
                                  int nextVisChildIndex,
                                  int ithRenderedChild)
                           throws java.io.IOException
Called each time an indexed child needs to be rendered. The previous visible child is passed in to provide renderers with additional context information.

The default implementation is call the three-argument version of renderIndexedChild().

Throws:
java.io.IOException
See Also:
renderChild(org.apache.myfaces.trinidadinternal.ui.UIXRenderingContext, org.apache.myfaces.trinidadinternal.ui.UINode)

prerender

protected void prerender(UIXRenderingContext context,
                         UINode node)
                  throws java.io.IOException
Called to render the portion before the contents. Default implementation does nothing.

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

postrender

protected void postrender(UIXRenderingContext context,
                          UINode node)
                   throws java.io.IOException
Called to render the portion after the contents. Default implementation does nothing.

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

renderBetweenIndexedChildren

protected void renderBetweenIndexedChildren(UIXRenderingContext context,
                                            UINode node)
                                     throws java.io.IOException
Called to render between each set of rendered indexed children.

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

renderBetweenIndexedChildren

protected void renderBetweenIndexedChildren(UIXRenderingContext context,
                                            UINode node,
                                            int nextIndex)
                                     throws java.io.IOException
Called to render between each set of rendered indexed children.

Parameters:
context - the rendering context
node - the current UINode
index - the index of the next child to be rendered
Throws:
java.io.IOException

skipChild

protected boolean skipChild(UIXRenderingContext context,
                            UINode node,
                            UINode child)
Called to determine if a specific child should be skipped. This method is called for both named children and indexed children. The default implementation returns true for nodes with a rendered attribute set to Boolean.FALSE.

Parameters:
context - the rendering context
node - the current UINode
child - the child under consideration

See Also:
getVisibleIndexedChildCount(org.apache.myfaces.trinidadinternal.ui.UIXRenderingContext, org.apache.myfaces.trinidadinternal.ui.UINode)

renderIndexedChild

protected void renderIndexedChild(UIXRenderingContext context,
                                  UINode node,
                                  int childIndex)
                           throws java.io.IOException
Called to render an indexed child. The default implementation will update the context as needed (e.g., calling pushChild() and popChild()) and then call renderChild().

Throws:
java.io.IOException
See Also:
renderChild(org.apache.myfaces.trinidadinternal.ui.UIXRenderingContext, org.apache.myfaces.trinidadinternal.ui.UINode)

renderNamedChild

protected final void renderNamedChild(UIXRenderingContext context,
                                      UINode node,
                                      java.lang.String childName)
                               throws java.io.IOException
Called to render a named child. Retrieves the child, then calls the four-argument version of this function.

Throws:
java.io.IOException
See Also:
renderChild(org.apache.myfaces.trinidadinternal.ui.UIXRenderingContext, org.apache.myfaces.trinidadinternal.ui.UINode)

renderNamedChild

protected void renderNamedChild(UIXRenderingContext context,
                                UINode node,
                                UINode child,
                                java.lang.String childName)
                         throws java.io.IOException
Called to render a named child. Renderers that render named children should call this method to do the actual rendering. The default implementation will update the context as needed (e.g., calling pushChild() and popChild()) and render the child.

Throws:
java.io.IOException
See Also:
renderChild(org.apache.myfaces.trinidadinternal.ui.UIXRenderingContext, org.apache.myfaces.trinidadinternal.ui.UINode)

renderChild

protected void renderChild(UIXRenderingContext context,
                           UINode child)
                    throws java.io.IOException
Called to render a child. This method does not update the rendering context (by calling pushChild() and popChild() as needed); subclasses need to use renderIndexedChild() or renderNamedChild() for that purpose.

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

getVisibleIndexedChildCount

protected int getVisibleIndexedChildCount(UIXRenderingContext context,
                                          UINode node)
Convenience function to return the number of non-skipped indexed children.

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

See Also:
skipChild(org.apache.myfaces.trinidadinternal.ui.UIXRenderingContext, org.apache.myfaces.trinidadinternal.ui.UINode, org.apache.myfaces.trinidadinternal.ui.UINode)


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