com.icesoft.faces.async.render
Class GroupAsyncRenderer

java.lang.Object
  extended bycom.icesoft.faces.async.render.GroupAsyncRenderer
All Implemented Interfaces:
AsyncRenderer
Direct Known Subclasses:
OnDemandRenderer

public class GroupAsyncRenderer
extends java.lang.Object
implements AsyncRenderer

The GroupAsyncRenderer is the foundation class for other types of renderers that are designed to operate on a group of Renderables. It implements the AsyncRenderer interface and is mainly responsible for smartly managing a group of Renderable instances.

Groups of Renderables are stored as WeakReferences in special sets that are copied before each render pass so that Renderables can be safely added and removed from the group while a render pass is in progress.

Although it is possible to create and use GroupRenderers directly, developers are advised to use the RenderManager to create and use named render groups.

Author:
ICEsoft Technologies, Inc.
See Also:
RenderManager, OnDemandRenderer, IntervalRenderer, DelayRenderer

Field Summary
protected  java.util.Set group
           
protected  java.lang.String name
           
protected  RenderManager renderManager
           
protected  boolean stopRequested
           
 
Constructor Summary
GroupAsyncRenderer()
           
 
Method Summary
 void add(Renderable renderable)
          Adds a Renderable, via a WeakReference, to the set of Renderables of this group.
 void clear()
          Removes all Renderables from the group.
 void dispose()
          Remove all Renderables from the group and removes the reference to the RenderHub.
 java.lang.String getName()
          Get the current name of this AsyncRenderer.
 void remove(Renderable renderable)
          Removes a Renderable, via a WeakReference, from the set of Renderables of this group.
 void requestRender()
          Request a render pass on all the Renderables in the group.
 void requestStop()
          The method called by dispose to halt a render pass at the current Renderables.
 void setName(java.lang.String name)
          Set the current name of this AsyncRenderer.
 void setRenderManager(RenderManager renderManager)
          Used by the RenderManager to provide a reference to itself for this AsyncRenderer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

name

protected java.lang.String name

group

protected java.util.Set group

renderManager

protected RenderManager renderManager

stopRequested

protected boolean stopRequested
Constructor Detail

GroupAsyncRenderer

public GroupAsyncRenderer()
Method Detail

getName

public java.lang.String getName()
Description copied from interface: AsyncRenderer
Get the current name of this AsyncRenderer. Names are used by the RenderManager to manage the various Renderers so that they can be easily accessed from different parts of the application.

Specified by:
getName in interface AsyncRenderer
Returns:
The current name of the AsyncRenderer.

setName

public void setName(java.lang.String name)
Description copied from interface: AsyncRenderer
Set the current name of this AsyncRenderer. Names are used by the RenderManager to manage the various Renderers so that they can be easily accessed from different parts of the application.

Specified by:
setName in interface AsyncRenderer
Parameters:
name - The desired name of the renderer.

setRenderManager

public void setRenderManager(RenderManager renderManager)
Description copied from interface: AsyncRenderer
Used by the RenderManager to provide a reference to itself for this AsyncRenderer.

Specified by:
setRenderManager in interface AsyncRenderer
Parameters:
renderManager - The RenderManager to use for this AsyncRenderer

add

public void add(Renderable renderable)
Adds a Renderable, via a WeakReference, to the set of Renderables of this group. If the Renderable is already in this set, it is not added again.

Parameters:
renderable - the Renderable instance to add to the group.

remove

public void remove(Renderable renderable)
Removes a Renderable, via a WeakReference, from the set of Renderables of this group.

Parameters:
renderable - the Renderable instance to remove

clear

public void clear()
Removes all Renderables from the group.


requestRender

public void requestRender()
Request a render pass on all the Renderables in the group. Render calls that generate exceptions are passed back to the Renderable.renderException

Specified by:
requestRender in interface AsyncRenderer
Throws:
java.lang.IllegalStateException - If a reference to a RenderHub has not yet been set.

requestStop

public void requestStop()
The method called by dispose to halt a render pass at the current Renderables.

Specified by:
requestStop in interface AsyncRenderer

dispose

public void dispose()
Remove all Renderables from the group and removes the reference to the RenderHub. Once disposed, a GroupAsyncRenderer cannot be re-used. This method is typically used by the RenderManager to cleanly dispose of all managed Renderers when the application is shutting down.

Specified by:
dispose in interface AsyncRenderer