org.apache.myfaces.custom.buffer
Class AbstractBuffer

java.lang.Object
  extended by javax.faces.component.UIComponent
      extended by javax.faces.component.UIComponentBase
          extended by org.apache.myfaces.custom.buffer.AbstractBuffer
All Implemented Interfaces:
java.util.EventListener, javax.faces.component.PartialStateHolder, javax.faces.component.StateHolder, javax.faces.event.ComponentSystemEventListener, javax.faces.event.FacesListener, javax.faces.event.SystemEventListenerHolder
Direct Known Subclasses:
Buffer

@JSFComponent(name="t:buffer",
              clazz="org.apache.myfaces.custom.buffer.Buffer",
              tagClass="org.apache.myfaces.custom.buffer.BufferTag")
@JSFJspProperties(properties={@JSFJspProperty(name="rendered",returnType="boolean",tagExcluded=true),@JSFJspProperty(name="binding",returnType="java.lang.String",tagExcluded=true),@JSFJspProperty(name="id",returnType="java.lang.String",tagExcluded=true)})
public abstract class AbstractBuffer
extends javax.faces.component.UIComponentBase

A component that renders its child components into an in-memory buffer rather than render them directly to the response stream.

Property "into" is an EL expression that specifies where to store a String holding the results of rendering all the children of this component; this is assigned to after rendering of this component (and its children) is complete.

Typically, an h:output tag is then used later in the same page to output the buffer contents.

This can be useful with JSF1.1/JSP2.0 to work around the well-known problem where on first render of a page, a component "A" cannot reference a component "B" which is defined later in the page because it has not yet been created. A solution is to define "B" before "A", but wrapped in a Buffer component. Component A can then be rendered and successfully reference "B" because it now exists. And later in the page, the buffer contents can then be output, preserving the original layout.

This can also be useful when rendering the same data block multiple times within a page. For example, a datatable can be rendered with a datascroller both before and after it; first render the table into a buffer B1, then render the datascroller into a buffer B2, then output buffers B2,B1,B2.

Since:
1.1.7
Version:
$Revision: 691871 $ $Date: 2008-09-03 23:32:08 -0500 (Wed, 03 Sep 2008) $
Author:
Sylvain Vieujot (latest modification by $Author: lu4242 $)

Field Summary
static java.lang.String COMPONENT_FAMILY
           
static java.lang.String COMPONENT_TYPE
           
 
Fields inherited from class javax.faces.component.UIComponent
BEANINFO_KEY, bindings, COMPOSITE_COMPONENT_TYPE_KEY, COMPOSITE_FACET_NAME, CURRENT_COMPONENT, CURRENT_COMPOSITE_COMPONENT, FACETS_KEY, VIEW_LOCATION_KEY
 
Constructor Summary
AbstractBuffer()
           
 
Method Summary
protected abstract  java.lang.String getInto()
          An EL expression that specifies where to store a String holding the results of rendering all the children of this component; this is assigned to after rendering of this component (and its children) is complete.
protected abstract  java.lang.String getLocalInto()
           
abstract  void setInto(java.lang.String into)
           
 
Methods inherited from class javax.faces.component.UIComponentBase
addClientBehavior, addFacesListener, broadcast, clearInitialState, decode, encodeBegin, encodeChildren, encodeEnd, findComponent, getAttributes, getChildCount, getChildren, getClientBehaviors, getClientId, getDefaultEventName, getEventNames, getFacesContext, getFacesListeners, getFacet, getFacetCount, getFacets, getFacetsAndChildren, getId, getParent, getRenderer, getRendererType, getRendersChildren, getValueBinding, initialStateMarked, invokeOnComponent, isRendered, isTransient, markInitialState, processDecodes, processRestoreState, processSaveState, processUpdates, processValidators, queueEvent, removeFacesListener, restoreAttachedState, restoreState, saveAttachedState, saveState, setId, setParent, setRendered, setRendererType, setTransient, setValueBinding, visitTree
 
Methods inherited from class javax.faces.component.UIComponent
encodeAll, getClientId, getCompositeComponentParent, getContainerClientId, getCurrentComponent, getCurrentCompositeComponent, getFamily, getListenersForEventClass, getNamingContainer, getResourceBundleMap, getStateHelper, getStateHelper, getValueExpression, isCompositeComponent, isInView, isVisitable, popComponentFromEL, processEvent, pushComponentToEL, setInView, setValueExpression, subscribeToEvent, unsubscribeFromEvent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COMPONENT_TYPE

public static final java.lang.String COMPONENT_TYPE
See Also:
Constant Field Values

COMPONENT_FAMILY

public static final java.lang.String COMPONENT_FAMILY
See Also:
Constant Field Values
Constructor Detail

AbstractBuffer

public AbstractBuffer()
Method Detail

getLocalInto

protected abstract java.lang.String getLocalInto()

setInto

public abstract void setInto(java.lang.String into)

getInto

@JSFProperty(required=true,
             localMethod=true)
protected abstract java.lang.String getInto()
An EL expression that specifies where to store a String holding the results of rendering all the children of this component; this is assigned to after rendering of this component (and its children) is complete.



Copyright © 2011 The Apache Software Foundation. All Rights Reserved.