org.apache.myfaces.trinidad.component
Class UIXCollection

java.lang.Object
  extended by javax.faces.component.UIComponent
      extended by org.apache.myfaces.trinidad.component.UIXComponent
          extended by org.apache.myfaces.trinidad.component.UIXComponentBase
              extended by org.apache.myfaces.trinidad.component.UIXCollection
All Implemented Interfaces:
EventListener, javax.faces.component.NamingContainer, javax.faces.component.PartialStateHolder, javax.faces.component.StateHolder, javax.faces.event.ComponentSystemEventListener, javax.faces.event.FacesListener, javax.faces.event.SystemEventListenerHolder
Direct Known Subclasses:
UIXHierarchy, UIXIterator

@JSFComponent
public abstract class UIXCollection
extends UIXComponentBase
implements javax.faces.component.NamingContainer

Base class for components that do stamping. This class set the EL 'var' variable correctly when the rowData changes. And it wraps events that are queued, so that the correct rowData can be restored on this component when the event is broadcast.


Nested Class Summary
protected static class UIXCollection.NoColumnFacetsVisitContext
          VisitContext implementation that doesn't visit any of the Facets of UIXColumn children.
 
Field Summary
static FacesBean.Type TYPE
           
static PropertyKey VAR_KEY
           
 
Fields inherited from class org.apache.myfaces.trinidad.component.UIXComponentBase
BINDING_KEY, ID_KEY, RENDERED_KEY, RENDERER_TYPE_KEY, TRANSIENT_KEY
 
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
 
Fields inherited from interface javax.faces.component.NamingContainer
SEPARATOR_CHAR
 
Constructor Summary
protected UIXCollection()
           
protected UIXCollection(String rendererType)
           
 
Method Summary
 boolean areRowsAvailable(int rowCount)
          Check if a range of rows is available starting from the current position
 boolean areRowsAvailable(int startIndex, int rowCount)
          Check if a range of rows is available from a starting index without requiring the client to iterate over the rows
 boolean areRowsAvailable(Object startRowKey, int rowCount)
          Check if a range of rows is available from a starting row key without requiring the client to iterate over the rows
 boolean areRowsLocallyAvailable(int rowCount)
          Check if a range of rows is locally available starting from current position
 boolean areRowsLocallyAvailable(int startIndex, int rowCount)
          Check if a range of rows is locally available starting from a row index
 boolean areRowsLocallyAvailable(Object startRowKey, int rowCount)
          Check if a range of rows is locally available starting from a row key
 void broadcast(javax.faces.event.FacesEvent event)
          Delivers a wrapped event to the appropriate component.
 void clearCachedRow(int index)
          Clear a row from the local cache by row index
 void clearCachedRow(Object rowKey)
          Clear a row from the local cache by row key
 void clearCachedRows(int startingIndex, int rowsToClear)
          Clear the requested range of rows from the local cache
 void clearCachedRows(Object startingRowKey, int rowsToClear)
          Clear the requested range of rows from the local cache
protected  void clearCurrencyStringCache()
          Deprecated. Have your Renderer implement ClientRowKeyManagerFactory and create your own ClientRowKeyManager instances. Then you can manage the lifecycle of each key inside your ClientRowKeyManager.
 void clearLocalCache()
          clear all rows from the local cache
protected abstract  CollectionModel createCollectionModel(CollectionModel current, Object value)
          Creates the CollectionModel to use with this component.
protected  Map<String,Object> createVarStatusMap()
          Gets the Map to use as the "varStatus".
protected  void decodeChildrenImpl(javax.faces.context.FacesContext context)
          Calls processDecodes on all facets and children of this component.
protected  boolean defaultVisitChildren(javax.faces.component.visit.VisitContext visitContext, javax.faces.component.visit.VisitCallback callback)
          Default implementation of child visiting of UIXCollection subclasses for cases where a UIXCollection subclass wants to restore the default implementation that one of its superclasses have overridden.
 void encodeBegin(javax.faces.context.FacesContext context)
          Clears all the currency strings.
 void encodeEnd(javax.faces.context.FacesContext context)
           
 LocalRowKeyIndex.LocalCachingStrategy getCachingStrategy()
          Indicates the caching strategy supported by the model
 String getClientRowKey()
          Gets a String version of the current rowkey.
 ClientRowKeyManager getClientRowKeyManager()
          Gets the ClientRowKeyManager that is used to handle the getClientRowKey() and setClientRowKey(java.lang.String) methods.
protected  CollectionModel getCollectionModel()
          Gets the CollectionModel to use with this component.
protected  CollectionModel getCollectionModel(boolean createIfNull)
          Gets the CollectionModel to use with this component.
 String getContainerClientId(javax.faces.context.FacesContext context)
          Gets the client-id of this component, without any NamingContainers.
 String getCurrencyString()
          Deprecated. use getClientRowKey
 int getEstimatedRowCount()
          Convenient API to return a row count estimate.
 LocalRowKeyIndex.Confidence getEstimatedRowCountConfidence()
          Helper API to determine if the row count returned from getEstimatedRowCount() is EXACT, or an ESTIMATE
 int getRowCount()
          Gets the total number of rows in this table.
 Object getRowData()
          Gets the data for the current row.
 Object getRowData(int rowIndex)
          Gets the rowData at the given index.
 Object getRowData(Object rowKey)
          Get row data by row key.
 int getRowIndex()
          Gets the index of the current row.
 Object getRowKey()
          Gets the rowKey of the current row.
 List<SortCriterion> getSortCriteria()
          Gets the criteria that this collection is sorted by.
protected  List<javax.faces.component.UIComponent> getStamps()
          Gets the UIComponents that are considered stamps.
protected abstract  Object getValue()
          Gets the value that must be converted into a CollectionModel
 String getVar()
          Gets the name of the EL variable used to reference each element of this collection.
abstract  String getVarStatus()
          Gets the EL variable name to use to expose the varStatusMap.
 boolean invokeOnComponent(javax.faces.context.FacesContext context, String clientId, javax.faces.component.ContextCallback callback)
          Override to calls the hooks for setting up and tearing down the context before the children are visited.
 boolean isRowAvailable()
          Checks to see if the current row is available.
 boolean isRowAvailable(int rowIndex)
          Checks to see if the row at the given index is available.
 boolean isRowAvailable(Object rowKey)
          Check for an available row by row key.
 boolean isRowLocallyAvailable(int rowIndex)
          Given a row index, check if a row is locally available
 boolean isRowLocallyAvailable(Object rowKey)
          Given a row key, check if a row is locally available
 boolean isSortable(String property)
           
protected  void postCreateCollectionModel(CollectionModel model)
          Hook called with the result of createCollectionModel.
protected  void postRowDataChange()
          Sets up this component to use the new rowData.
protected  void preRowDataChange()
          Prepares this component for a change in the rowData.
protected  void processComponent(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, javax.faces.event.PhaseId phaseId)
          Process a component.
 void processDecodes(javax.faces.context.FacesContext context)
          Decodes this component before decoding the facets.
 void processEvent(javax.faces.event.ComponentSystemEvent event)
           
protected abstract  void processFacetsAndChildren(javax.faces.context.FacesContext context, javax.faces.event.PhaseId phaseId)
          Process this component's facets and children.
 void processRestoreState(javax.faces.context.FacesContext context, Object state)
           
 Object processSaveState(javax.faces.context.FacesContext context)
           
 void processUpdates(javax.faces.context.FacesContext context)
           
 void processValidators(javax.faces.context.FacesContext context)
           
 void queueEvent(javax.faces.event.FacesEvent event)
          Queues an event.
 void resetStampState()
          Resets this component's stamps to their uninitialized state.
protected  void restoreStampState(javax.faces.context.FacesContext context, javax.faces.component.UIComponent stamp, Object stampState)
          Restores the state of a stamp.
 void restoreState(javax.faces.context.FacesContext context, Object state)
           
protected  Object saveStampState(javax.faces.context.FacesContext context, javax.faces.component.UIComponent stamp)
          Saves the state of a stamp.
 Object saveState(javax.faces.context.FacesContext context)
           
 void setClientRowKey(String clientRowKey)
          Restores this component's rowData to be what it was when the given client rowKey string was created.
 void setCurrencyString(String currency)
          Deprecated. use setClientRowKey
 void setRowIndex(int rowIndex)
          Makes a row current.
 void setRowKey(Object rowKey)
          Makes a row current.
 void setSortCriteria(List<SortCriterion> criteria)
          Sorts this collection by the given criteria.
protected  void setupVisitingContext(javax.faces.context.FacesContext context)
          Sets up the context necessary to visit or invoke the component for all phases.
 void setVar(String var)
          Sets the name of the EL variable used to reference each element of this collection.
protected  void tearDownVisitingContext(javax.faces.context.FacesContext context)
          Tears down context created in order to visit or invoke the component for all phases.
protected  void updateChildrenImpl(javax.faces.context.FacesContext context)
           
protected  void validateChildrenImpl(javax.faces.context.FacesContext context)
          Calls processValidators on all facets and children of this component.
protected  boolean visitChildren(javax.faces.component.visit.VisitContext visitContext, javax.faces.component.visit.VisitCallback callback)
           Override default children visiting code to visit the facets and facets of the columns before delegating to the visitData to visit the individual rows of data.
protected  boolean visitChildrenWithoutIterating(javax.faces.component.visit.VisitContext visitContext, javax.faces.component.visit.VisitCallback callback)
          Performs a non-iterating visit of the children.
protected abstract  boolean visitData(javax.faces.component.visit.VisitContext visitContext, javax.faces.component.visit.VisitCallback callback)
          Visit the rows and children of the columns of the collection per row-index.
protected  boolean visitUnstampedFacets(javax.faces.component.visit.VisitContext visitContext, javax.faces.component.visit.VisitCallback callback)
          Hook method for subclasses to override to change the behavior of how unstamped facets of the UIXCollection are visited.
 
Methods inherited from class org.apache.myfaces.trinidad.component.UIXComponentBase
adaptMethodBinding, addAttributeChange, addAttributeChangeListener, addClientBehavior, addComponentChange, addComponentChange, addFacesListener, broadcastToMethodBinding, broadcastToMethodExpression, clearInitialState, createFacesBean, decode, decodeChildren, encodeChildren, findComponent, getAttributeChangeListener, getAttributeChangeListeners, getAttributes, getBeanType, getBooleanProperty, getChildCount, getChildren, getClientBehaviors, getClientId, getContainerClientId, getDefaultEventName, getFacesBean, getFacesContext, getFacesListeners, getFacet, getFacetCount, getFacetNames, getFacets, getFacetsAndChildren, getFamily, getId, getIntProperty, getLifecycleRenderer, getListenersForEventClass, getParent, getProperty, getPropertyKey, getRenderedFacetsAndChildren, getRenderer, getRendererType, getRendersChildren, getValueBinding, getValueExpression, initialStateMarked, invokeOnChildrenComponents, invokeOnNamingContainerComponent, isRendered, isTransient, markInitialState, removeAttributeChangeListener, removeFacesListener, satisfiesPartialTrigger, setAttributeChangeListener, setAttributeChangeListener, setBooleanProperty, setId, setIntProperty, setParent, setProperty, setRendered, setRendererType, setTransient, setupFlattenedChildrenContext, setupFlattenedContext, setValueBinding, setValueExpression, subscribeToEvent, tearDownFlattenedChildrenContext, tearDownFlattenedContext, toString, unsubscribeFromEvent, updateChildren, validateChildren
 
Methods inherited from class org.apache.myfaces.trinidad.component.UIXComponent
addPartialTarget, clearCachedClientIds, clearCachedClientIds, encodeFlattenedChild, encodeFlattenedChildren, getLogicalParent, getLogicalParent, getStateHelper, getStateHelper, isVisitable, partialEncodeVisit, processFlattenedChildren, processFlattenedChildren, processFlattenedChildren, processFlattenedChildren, setPartialTarget, setupChildrenEncodingContext, setupChildrenVisitingContext, setupEncodingContext, setUpEncodingContext, tearDownChildrenEncodingContext, tearDownChildrenVisitingContext, tearDownEncodingContext, visitAllChildren, visitChildren, visitTree, visitTree
 
Methods inherited from class javax.faces.component.UIComponent
encodeAll, getClientId, getCompositeComponentParent, getCurrentComponent, getCurrentCompositeComponent, getNamingContainer, getResourceBundleMap, isCompositeComponent, isInView, popComponentFromEL, pushComponentToEL, setInView
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TYPE

public static final FacesBean.Type TYPE

VAR_KEY

public static final PropertyKey VAR_KEY
Constructor Detail

UIXCollection

protected UIXCollection(String rendererType)

UIXCollection

protected UIXCollection()
Method Detail

getVar

public final String getVar()
Gets the name of the EL variable used to reference each element of this collection. Once this component has completed rendering, this variable is removed (or reverted back to its previous value).


setVar

public final void setVar(String var)
Sets the name of the EL variable used to reference each element of this collection. Once this component has completed rendering, this variable is removed (or reverted back to its previous value).


queueEvent

public void queueEvent(javax.faces.event.FacesEvent event)
Queues an event. If there is a currency set on this table, then the event will be wrapped so that when it is finally delivered, the correct currency will be restored.

Overrides:
queueEvent in class UIXComponentBase
Parameters:
event - a FacesEvent

broadcast

public void broadcast(javax.faces.event.FacesEvent event)
               throws javax.faces.event.AbortProcessingException
Delivers a wrapped event to the appropriate component. If the event is a special wrapped event, it is unwrapped.

Overrides:
broadcast in class UIXComponentBase
Parameters:
event - a FacesEvent
Throws:
javax.faces.event.AbortProcessingException

processDecodes

public final void processDecodes(javax.faces.context.FacesContext context)
Decodes this component before decoding the facets. Decodes the children as many times as they are stamped.

Overrides:
processDecodes in class UIXComponentBase
Parameters:
context - the FacesContext

decodeChildrenImpl

protected void decodeChildrenImpl(javax.faces.context.FacesContext context)
Description copied from class: UIXComponentBase
Calls processDecodes on all facets and children of this component.

Overrides:
decodeChildrenImpl in class UIXComponentBase
Parameters:
context - the current FacesContext

validateChildrenImpl

protected void validateChildrenImpl(javax.faces.context.FacesContext context)
Description copied from class: UIXComponentBase
Calls processValidators on all facets and children of this component.

Overrides:
validateChildrenImpl in class UIXComponentBase
Parameters:
context - the current FacesContext

updateChildrenImpl

protected void updateChildrenImpl(javax.faces.context.FacesContext context)
Overrides:
updateChildrenImpl in class UIXComponentBase

resetStampState

public void resetStampState()
Resets this component's stamps to their uninitialized state. This is useful when the user wants to undo any edits made to an editable table.


processSaveState

public Object processSaveState(javax.faces.context.FacesContext context)
Overrides:
processSaveState in class UIXComponentBase

saveState

public Object saveState(javax.faces.context.FacesContext context)
Specified by:
saveState in interface javax.faces.component.StateHolder
Overrides:
saveState in class UIXComponentBase

restoreState

public void restoreState(javax.faces.context.FacesContext context,
                         Object state)
Specified by:
restoreState in interface javax.faces.component.StateHolder
Overrides:
restoreState in class UIXComponentBase

isRowAvailable

public final boolean isRowAvailable()
Checks to see if the current row is available. This is useful when the total number of rows is not known.

Returns:
true iff the current row is available.
See Also:
DataModel.isRowAvailable()

isRowAvailable

public final boolean isRowAvailable(Object rowKey)
Check for an available row by row key.

Parameters:
rowKey - the row key for the row to check.
Returns:
true if a value exists; false otherwise.

getRowData

public final Object getRowData(Object rowKey)
Get row data by row key.

Parameters:
rowKey - the row key for the row to get data.
Returns:
row data

areRowsAvailable

public final boolean areRowsAvailable(int rowCount)
Check if a range of rows is available starting from the current position

Parameters:
rowCount - number of rows to check
Returns:
true if all rows in range are available

areRowsAvailable

public final boolean areRowsAvailable(int startIndex,
                                      int rowCount)
Check if a range of rows is available from a starting index without requiring the client to iterate over the rows

Parameters:
startIndex - the starting index for the range
rowCount - number of rows to check
Returns:
true if all rows in range are available

areRowsAvailable

public final boolean areRowsAvailable(Object startRowKey,
                                      int rowCount)
Check if a range of rows is available from a starting row key without requiring the client to iterate over the rows

Parameters:
startRowKey - the starting row key for the range
rowCount - number of rows to check
Returns:
true if all rows in range are available

getRowCount

public final int getRowCount()
Gets the total number of rows in this table.

Returns:
-1 if the total number is not known.
See Also:
DataModel.getRowCount()

getRowIndex

public final int getRowIndex()
Gets the index of the current row.

Returns:
-1 if the current row is unavailable.
See Also:
DataModel.getRowIndex()

getRowKey

public final Object getRowKey()
Gets the rowKey of the current row.

Returns:
null if the current row is unavailable.
See Also:
CollectionModel.getRowKey()

getRowData

public final Object getRowData()
Gets the data for the current row.

Returns:
null if the current row is unavailable
See Also:
CollectionModel.getRowData(int)

isRowAvailable

public boolean isRowAvailable(int rowIndex)
Checks to see if the row at the given index is available.

Parameters:
rowIndex - the index of the row to check.
Returns:
true if data for the row exists.
See Also:
CollectionModel.isRowAvailable(int)

getRowData

public Object getRowData(int rowIndex)
Gets the rowData at the given index.

Parameters:
rowIndex - the index of the row to get data from.
Returns:
the data for the given row.
See Also:
CollectionModel.getRowData(int)

getVarStatus

public abstract String getVarStatus()
Gets the EL variable name to use to expose the varStatusMap.

See Also:
createVarStatusMap()

setRowKey

public void setRowKey(Object rowKey)
Makes a row current. This method calls preRowDataChange() and postRowDataChange() as appropriate.

Parameters:
rowKey - The rowKey of the row that should be made current. Use null to clear the current row.
See Also:
CollectionModel.setRowKey(java.lang.Object)

setRowIndex

public void setRowIndex(int rowIndex)
Makes a row current. This method calls preRowDataChange() and postRowDataChange() as appropriate.

Parameters:
rowIndex - The rowIndex of the row that should be made current. Use -1 to clear the current row.
See Also:
DataModel.setRowIndex(int)

isSortable

public final boolean isSortable(String property)
Parameters:
property - a property name in the model
Returns:
true if the model is sortable by the given property.
See Also:
CollectionModel.isSortable(java.lang.String)

setSortCriteria

public void setSortCriteria(List<SortCriterion> criteria)
Sorts this collection by the given criteria.

Parameters:
criteria - Each element in this List must be of type SortCriterion.
See Also:
SortCriterion, CollectionModel.setSortCriteria(java.util.List)

getSortCriteria

public final List<SortCriterion> getSortCriteria()
Gets the criteria that this collection is sorted by.

Returns:
each element in this List is of type SortCriterion. An empty list is returned if this collection is not sorted.
See Also:
SortCriterion, CollectionModel.getSortCriteria()

clearCurrencyStringCache

@Deprecated
protected void clearCurrencyStringCache()
Deprecated. Have your Renderer implement ClientRowKeyManagerFactory and create your own ClientRowKeyManager instances. Then you can manage the lifecycle of each key inside your ClientRowKeyManager.

Clear the rowKey-to-currencyString cache. The cache is not cleared immediately; instead it will be cleared when encodeBegin(FacesContext) is called.


encodeBegin

public final void encodeBegin(javax.faces.context.FacesContext context)
                       throws IOException
Clears all the currency strings.

Overrides:
encodeBegin in class UIXComponentBase
Throws:
IOException

encodeEnd

public void encodeEnd(javax.faces.context.FacesContext context)
               throws IOException
Overrides:
encodeEnd in class UIXComponentBase
Throws:
IOException

setupVisitingContext

protected void setupVisitingContext(javax.faces.context.FacesContext context)
Description copied from class: UIXComponent

Sets up the context necessary to visit or invoke the component for all phases.

The default implementation does nothing.

If a subclass overrides this method, it should override tearDownVisitingContext as well.

It is guaranteed that if setupVisitingContext completes tearDownVisitingContext will be called for this component

Overrides:
setupVisitingContext in class UIXComponent
Parameters:
context - FacesContext
See Also:
UIXComponent.tearDownVisitingContext(javax.faces.context.FacesContext), UIXComponent.setupEncodingContext(javax.faces.context.FacesContext, org.apache.myfaces.trinidad.context.RenderingContext), UIXComponent.tearDownEncodingContext(javax.faces.context.FacesContext, org.apache.myfaces.trinidad.context.RenderingContext), #setupChildrenVistingContext

tearDownVisitingContext

protected void tearDownVisitingContext(javax.faces.context.FacesContext context)
Description copied from class: UIXComponent

Tears down context created in order to visit or invoke the component for all phases.

The default implementation does nothing.

A subclass should only override this method if it overrode setupVisitingContext as well

It is guaranteed that tearDownVisitingContext will be called only after setupVisitingContext has been called for this component

Overrides:
tearDownVisitingContext in class UIXComponent
Parameters:
context - FacesContext
See Also:
UIXComponent.setupVisitingContext(javax.faces.context.FacesContext), UIXComponent.setupEncodingContext(javax.faces.context.FacesContext, org.apache.myfaces.trinidad.context.RenderingContext), UIXComponent.tearDownEncodingContext(javax.faces.context.FacesContext, org.apache.myfaces.trinidad.context.RenderingContext)

getCurrencyString

@Deprecated
public String getCurrencyString()
Deprecated. use getClientRowKey

See Also:
getClientRowKey()

setCurrencyString

@Deprecated
public void setCurrencyString(String currency)
Deprecated. use setClientRowKey

See Also:
setClientRowKey(java.lang.String)

getClientRowKey

public String getClientRowKey()
Gets a String version of the current rowkey. The contents of the String are controlled by the current ClientRowKeyManager. This String can be passed into the setClientRowKey(java.lang.String) method to restore the current rowData. The lifetime of this String is short and it may not be valid during future requests; however, it is guaranteed to be valid for the next subsequent request.

See Also:
setClientRowKey(java.lang.String), getClientRowKeyManager(), ClientRowKeyManager.getClientRowKey(javax.faces.context.FacesContext, javax.faces.component.UIComponent, java.lang.Object)

setClientRowKey

public void setClientRowKey(String clientRowKey)
Restores this component's rowData to be what it was when the given client rowKey string was created.

See Also:
getClientRowKey()

processRestoreState

public void processRestoreState(javax.faces.context.FacesContext context,
                                Object state)
Overrides:
processRestoreState in class UIXComponentBase

processUpdates

public void processUpdates(javax.faces.context.FacesContext context)
Overrides:
processUpdates in class UIXComponentBase

processValidators

public void processValidators(javax.faces.context.FacesContext context)
Overrides:
processValidators in class UIXComponentBase

processEvent

public void processEvent(javax.faces.event.ComponentSystemEvent event)
                  throws javax.faces.event.AbortProcessingException
Specified by:
processEvent in interface javax.faces.event.ComponentSystemEventListener
Overrides:
processEvent in class javax.faces.component.UIComponent
Throws:
javax.faces.event.AbortProcessingException

getContainerClientId

public final String getContainerClientId(javax.faces.context.FacesContext context)
Gets the client-id of this component, without any NamingContainers. This id changes depending on the currency Object. Because this implementation uses currency strings, the local client ID is not stable for very long. Its lifetime is the same as that of a currency string.

Overrides:
getContainerClientId in class javax.faces.component.UIComponent
Returns:
the local clientId
See Also:
getClientRowKey()

preRowDataChange

protected final void preRowDataChange()
Prepares this component for a change in the rowData. This method should be called right before the rowData changes. It saves the internal states of all the stamps of this component so that they can be restored when the rowData is reverted.


postRowDataChange

protected final void postRowDataChange()
Sets up this component to use the new rowData. This method should be called right after the rowData changes. It sets up the var EL variable to be the current rowData. It also sets up the internal states of all the stamps of this component to match this new rowData.


getStamps

protected List<javax.faces.component.UIComponent> getStamps()
Gets the UIComponents that are considered stamps. This implementation simply returns the children of this component.

Returns:
each element must be of type UIComponent.

saveStampState

protected Object saveStampState(javax.faces.context.FacesContext context,
                                javax.faces.component.UIComponent stamp)
Saves the state of a stamp. This method is called when the currency of this component is changed so that the state of this stamp can be preserved, before the stamp is updated with the state corresponding to the new currency. This method recurses for the children and facets of the stamp.

Returns:
this object must be Serializable if client-side state saving is used.

restoreStampState

protected void restoreStampState(javax.faces.context.FacesContext context,
                                 javax.faces.component.UIComponent stamp,
                                 Object stampState)
Restores the state of a stamp. This method is called after the currency of this component is changed so that the state of this stamp can be changed to match the new currency. This method recurses for the children and facets of the stamp.


processComponent

protected final void processComponent(javax.faces.context.FacesContext context,
                                      javax.faces.component.UIComponent component,
                                      javax.faces.event.PhaseId phaseId)
Process a component. This method calls processDecodes(FacesContext), processValidators(javax.faces.context.FacesContext) or processUpdates(javax.faces.context.FacesContext) depending on the {#link PhaseId}.


processFacetsAndChildren

protected abstract void processFacetsAndChildren(javax.faces.context.FacesContext context,
                                                 javax.faces.event.PhaseId phaseId)
Process this component's facets and children. This method should call processComponent(javax.faces.context.FacesContext, javax.faces.component.UIComponent, javax.faces.event.PhaseId) as many times as necessary for each facet and child. processComponent(javax.faces.context.FacesContext, javax.faces.component.UIComponent, javax.faces.event.PhaseId) may be called repeatedly for the same child if that child is being stamped.


getCollectionModel

protected final CollectionModel getCollectionModel()
Gets the CollectionModel to use with this component.


getClientRowKeyManager

public final ClientRowKeyManager getClientRowKeyManager()
Gets the ClientRowKeyManager that is used to handle the getClientRowKey() and setClientRowKey(java.lang.String) methods. If the manager does not already exist a new one is created. In order to create your own manager, your Renderer (for this component) must implement ClientRowKeyManagerFactory


invokeOnComponent

public boolean invokeOnComponent(javax.faces.context.FacesContext context,
                                 String clientId,
                                 javax.faces.component.ContextCallback callback)
                          throws javax.faces.FacesException
Description copied from class: UIXComponentBase
Override to calls the hooks for setting up and tearing down the context before the children are visited.

Overrides:
invokeOnComponent in class UIXComponentBase
Throws:
javax.faces.FacesException
See Also:
UIXComponent.setupVisitingContext(javax.faces.context.FacesContext), UIXComponent.tearDownVisitingContext(javax.faces.context.FacesContext)

visitChildren

protected boolean visitChildren(javax.faces.component.visit.VisitContext visitContext,
                                javax.faces.component.visit.VisitCallback callback)

Override default children visiting code to visit the facets and facets of the columns before delegating to the visitData to visit the individual rows of data.

Subclasses should override this method if they wish to change the way in which the non-stamped children are visited. If they wish to change the wash the the stamped children are visited, they should override visitData instead.

Overrides:
visitChildren in class UIXComponent
Parameters:
visitContext -
callback -
Returns:
true if all of the children to visit have been visited
See Also:
visitData(javax.faces.component.visit.VisitContext, javax.faces.component.visit.VisitCallback)

visitChildrenWithoutIterating

protected boolean visitChildrenWithoutIterating(javax.faces.component.visit.VisitContext visitContext,
                                                javax.faces.component.visit.VisitCallback callback)
Performs a non-iterating visit of the children. The default implementation visits all of the children. If the UIXCollection subclass doesn't visit some of its children in certain cases, it needs to override this method.

Parameters:
visitContext -
callback -
Returns:

defaultVisitChildren

protected final boolean defaultVisitChildren(javax.faces.component.visit.VisitContext visitContext,
                                             javax.faces.component.visit.VisitCallback callback)
Default implementation of child visiting of UIXCollection subclasses for cases where a UIXCollection subclass wants to restore the default implementation that one of its superclasses have overridden.

Parameters:
visitContext -
callback -
Returns:

visitUnstampedFacets

protected boolean visitUnstampedFacets(javax.faces.component.visit.VisitContext visitContext,
                                       javax.faces.component.visit.VisitCallback callback)
Hook method for subclasses to override to change the behavior of how unstamped facets of the UIXCollection are visited. The Default implementation visits all of the facets of the UIXCollection.


visitData

protected abstract boolean visitData(javax.faces.component.visit.VisitContext visitContext,
                                     javax.faces.component.visit.VisitCallback callback)
Visit the rows and children of the columns of the collection per row-index. This should not visit row index -1 (it will be perfomed in the visitTree method). The columns themselves should not be visited, only their children in this function.

Parameters:
visitContext - The visiting context
callback - The visit callback
Returns:
true if the visiting should stop
See Also:
visitChildren(VisitContext, VisitCallback)

getCollectionModel

protected final CollectionModel getCollectionModel(boolean createIfNull)
Gets the CollectionModel to use with this component.

Parameters:
createIfNull - creates the collection model if necessary

createCollectionModel

protected abstract CollectionModel createCollectionModel(CollectionModel current,
                                                         Object value)
Creates the CollectionModel to use with this component. The state of the UIComponent with the new model instance is not fully initialized until after this method returns. As a result, other component attributes that need a fully initialized model should not be initialized in this method. Instead, model-dependent initialization should be done in postCreateCollectionModel

Parameters:
current - the current CollectionModel, or null if there is none.
value - this is the value returned from getValue()
See Also:
postCreateCollectionModel(org.apache.myfaces.trinidad.model.CollectionModel)

postCreateCollectionModel

protected void postCreateCollectionModel(CollectionModel model)
Hook called with the result of createCollectionModel. Subclasses can use this method to perform initialization after the CollectionModel is fully initialized. Subclassers should call super before accessing any component state to ensure that superclass initialization has been performed.

Parameters:
model - The model instance returned by
See Also:
createCollectionModel(org.apache.myfaces.trinidad.model.CollectionModel, java.lang.Object)

getValue

protected abstract Object getValue()
Gets the value that must be converted into a CollectionModel


createVarStatusMap

protected Map<String,Object> createVarStatusMap()
Gets the Map to use as the "varStatus". This implementation supports the following keys:
  • model - returns the CollectionModel
  • index - returns the current rowIndex
  • rowKey - returns the current rowKey
  • current - returns the current rowData
  • "hierarchicalIndex" - returns an array containing zero based row index.
  • "hierarchicalLabel" - returns a string label representing 1 based index of this row.


isRowLocallyAvailable

public boolean isRowLocallyAvailable(int rowIndex)
Given a row index, check if a row is locally available

Parameters:
rowIndex - index of row to check
Returns:
true if row is locally available

isRowLocallyAvailable

public boolean isRowLocallyAvailable(Object rowKey)
Given a row key, check if a row is locally available

Parameters:
rowKey - row key for the row to check
Returns:
true if row is locally available

areRowsLocallyAvailable

public boolean areRowsLocallyAvailable(int rowCount)
Check if a range of rows is locally available starting from current position

Parameters:
rowCount - number of rows in the range
Returns:
true if range of rows is locally available

areRowsLocallyAvailable

public boolean areRowsLocallyAvailable(int startIndex,
                                       int rowCount)
Check if a range of rows is locally available starting from a row index

Parameters:
startIndex - staring index for the range
rowCount - number of rows in the range
Returns:
true if range of rows is locally available

areRowsLocallyAvailable

public boolean areRowsLocallyAvailable(Object startRowKey,
                                       int rowCount)
Check if a range of rows is locally available starting from a row key

Parameters:
startRowKey - staring row key for the range
rowCount - number of rows in the range
Returns:
true if range of rows is locally available

getEstimatedRowCount

public int getEstimatedRowCount()
Convenient API to return a row count estimate. This method can be optimized to avoid a data fetch which may be required to return an exact row count

Returns:
estimated row count

getEstimatedRowCountConfidence

public LocalRowKeyIndex.Confidence getEstimatedRowCountConfidence()
Helper API to determine if the row count returned from getEstimatedRowCount() is EXACT, or an ESTIMATE


clearLocalCache

public void clearLocalCache()
clear all rows from the local cache


clearCachedRows

public void clearCachedRows(int startingIndex,
                            int rowsToClear)
Clear the requested range of rows from the local cache

Parameters:
startingIndex - starting row index for the range to clear
rowsToClear - number of rows to clear from the cache

clearCachedRows

public void clearCachedRows(Object startingRowKey,
                            int rowsToClear)
Clear the requested range of rows from the local cache

Parameters:
startingRowKey - starting row key for the range to clear
rowsToClear - number of rows to clear from the cache

clearCachedRow

public void clearCachedRow(int index)
Clear a row from the local cache by row index

Parameters:
index - row index for the row to clear from the cache

clearCachedRow

public void clearCachedRow(Object rowKey)
Clear a row from the local cache by row key

Parameters:
rowKey - row key for the row to clear from the cache

getCachingStrategy

public LocalRowKeyIndex.LocalCachingStrategy getCachingStrategy()
Indicates the caching strategy supported by the model

Returns:
caching strategy supported by the model
See Also:
LocalRowKeyIndex.LocalCachingStrategy


Copyright © 2001-2012 The Apache Software Foundation. All Rights Reserved.