|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.faces.component.UIComponent javax.faces.component.UIComponentBase javax.faces.component.UIData org.apache.myfaces.custom.crosstable.UIColumns
public class UIColumns
An object which can be a child of a t:dataTable, and inserts a dynamic set of columns into the parent table. The set of columns inserted are defined by a collection returned from a value-binding.
Class org.apache.myfaces.component.html.ext.HtmlDataTable (aka t:dataTable) has special-case code to detect a child of this type, and invoke the necessary methods on this class. This class does not work with other UIData implementations. There is no renderer for this component; the HtmlTableRenderer associated with ext.HtmlDataTable is UIColumns-aware, and implements the necessary logic itself.
This class is actually a UIData itself, which is effectively "merged" with the parent HtmlDataTable. It can't be used as a stand-alone table, however, because it uses the DataModel returned by the "value" value-binding to define the columns, and depends on the parent table's "value" value-binding to define the row DataModel.
The "value" attribute of this class must be a value-binding which returns a DataModel of objects (or a List, Array or ResultSet which automatically gets wrapped in the appropriate DataModel).
In a normal table, each UIColumn child has facets and child components which define that column. In this component, the same child components apply to each column (ie are repeated dataModel.size times). However as the columns are rendered, the current DataModel object (ie the object defining the current column) is stored into a variable whose name is defined by attribute "var". This allows the child components of this component to refer to attributes on those objects to set things like the current column's name. When the objects must be rendered as different components (eg h:outputText or h:outputDate), multiple child components can be used with rendered attributes selecting the appropriate one depending upon the current column object's data.
Field Summary | |
---|---|
static java.lang.String |
COMPONENT_TYPE
|
Fields inherited from class javax.faces.component.UIData |
---|
COMPONENT_FAMILY |
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 | |
---|---|
UIColumns()
|
Method Summary | |
---|---|
protected javax.faces.model.DataModel |
createDataModel()
Creates a new DataModel around the current value. |
void |
encodeTableBegin(javax.faces.context.FacesContext context)
Called from HtmlDataTable.encodeBegin, ie called once when rendering for the entire table starts. |
void |
encodeTableEnd(javax.faces.context.FacesContext context)
Called from HtmlDataTable.encodeEnd, ie called once after rendering for the entire table has completed. |
java.lang.String |
getClientId(javax.faces.context.FacesContext context)
|
protected javax.faces.model.DataModel |
getDataModel()
Get a DataModel whose wrapped data contains a collection of objects representing columns. |
int |
getRowCount()
Get the number of dynamic columns represented by this instance. |
java.lang.Object |
getRowData()
Get the object representing the current column. |
int |
getRowIndex()
Get the currently selected column index. |
protected boolean |
hasErrorMessages(javax.faces.context.FacesContext context)
|
boolean |
isRowAvailable()
Return true if there are any more columns to process. |
void |
processDecodes(javax.faces.context.FacesContext context)
Update the input component (if any) in each dynamic column. |
void |
processUpdates(javax.faces.context.FacesContext context)
|
void |
processValidators(javax.faces.context.FacesContext context)
|
protected void |
restoreDescendantComponentStates(java.util.Iterator childIterator,
java.lang.Object state)
|
protected java.lang.Object |
saveDescendantComponentStates(java.util.Iterator childIterator)
|
protected void |
setDataModel(javax.faces.model.DataModel dataModel)
|
void |
setRowIndex(int colIndex)
Set the currently selected column. |
void |
setValue(java.lang.Object value)
|
void |
setValueBinding(java.lang.String name,
javax.faces.el.ValueBinding binding)
|
Methods inherited from class javax.faces.component.UIData |
---|
broadcast, createUniqueId, encodeBegin, encodeEnd, getContainerClientId, getFamily, getFirst, getFooter, getHeader, getRows, getValue, getVar, invokeOnComponent, queueEvent, setFirst, setFooter, setHeader, setRows, setValueExpression, setVar, visitTree |
Methods inherited from class javax.faces.component.UIComponentBase |
---|
addClientBehavior, addFacesListener, clearInitialState, decode, encodeChildren, findComponent, getAttributes, getChildCount, getChildren, getClientBehaviors, getDefaultEventName, getEventNames, getFacesContext, getFacesListeners, getFacet, getFacetCount, getFacets, getFacetsAndChildren, getId, getParent, getRenderer, getRendererType, getRendersChildren, getValueBinding, initialStateMarked, isRendered, isTransient, markInitialState, processRestoreState, processSaveState, removeFacesListener, restoreAttachedState, restoreState, saveAttachedState, saveState, setId, setParent, setRendered, setRendererType, setTransient |
Methods inherited from class javax.faces.component.UIComponent |
---|
encodeAll, getClientId, getCompositeComponentParent, getCurrentComponent, getCurrentCompositeComponent, getListenersForEventClass, getNamingContainer, getResourceBundleMap, getStateHelper, getStateHelper, getValueExpression, isCompositeComponent, isInView, isVisitable, popComponentFromEL, processEvent, pushComponentToEL, setInView, subscribeToEvent, unsubscribeFromEvent |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String COMPONENT_TYPE
Constructor Detail |
---|
public UIColumns()
Method Detail |
---|
public boolean isRowAvailable()
isRowAvailable
in class javax.faces.component.UIData
public int getRowCount()
getRowCount
in class javax.faces.component.UIData
public java.lang.Object getRowData()
getRowData
in class javax.faces.component.UIData
public int getRowIndex()
getRowIndex
in class javax.faces.component.UIData
public void setRowIndex(int colIndex)
setRowIndex
in class javax.faces.component.UIData
protected void restoreDescendantComponentStates(java.util.Iterator childIterator, java.lang.Object state)
protected java.lang.Object saveDescendantComponentStates(java.util.Iterator childIterator)
public void setValue(java.lang.Object value)
setValue
in class javax.faces.component.UIData
public void setValueBinding(java.lang.String name, javax.faces.el.ValueBinding binding)
setValueBinding
in class javax.faces.component.UIComponentBase
protected javax.faces.model.DataModel getDataModel()
getDataModel
in class javax.faces.component.UIData
protected void setDataModel(javax.faces.model.DataModel dataModel)
setDataModel
in class javax.faces.component.UIData
protected javax.faces.model.DataModel createDataModel()
public void processDecodes(javax.faces.context.FacesContext context)
processDecodes
in class javax.faces.component.UIData
UIData.processDecodes(javax.faces.context.FacesContext)
public void processValidators(javax.faces.context.FacesContext context)
processValidators
in class javax.faces.component.UIData
UIData.processValidators(javax.faces.context.FacesContext)
public void processUpdates(javax.faces.context.FacesContext context)
processUpdates
in class javax.faces.component.UIData
UIData.processUpdates(javax.faces.context.FacesContext)
public void encodeTableBegin(javax.faces.context.FacesContext context)
protected boolean hasErrorMessages(javax.faces.context.FacesContext context)
public void encodeTableEnd(javax.faces.context.FacesContext context)
public java.lang.String getClientId(javax.faces.context.FacesContext context)
getClientId
in class javax.faces.component.UIComponentBase
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |