public class UIData extends UIComponentBase implements NamingContainer
Modifier and Type | Field and Description |
---|---|
static String |
COMPONENT_FAMILY |
static String |
COMPONENT_TYPE |
bindings
SEPARATOR_CHAR
Constructor and Description |
---|
UIData()
Construct an instance of the UIData.
|
Modifier and Type | Method and Description |
---|---|
void |
broadcast(FacesEvent event)
Ensure that before the event's listeners are invoked this UIData
component's "current row" is set to the row associated with the event.
|
void |
encodeBegin(FacesContext context)
Perform necessary actions when rendering of this component starts,
before delegating to the inherited implementation which calls the
associated renderer's encodeBegin method.
|
void |
encodeEnd(FacesContext context) |
String |
getClientId(FacesContext context)
Get a string which can be output to the response which uniquely
identifies this UIComponent within the current view.
|
protected DataModel |
getDataModel()
Return the datamodel for this table, potentially fetching the data from
a backing bean via a value-binding if this is the first time this method
has been called.
|
String |
getFamily() |
int |
getFirst()
Gets The index of the first row to be displayed, where 0 is the first row.
|
UIComponent |
getFooter() |
UIComponent |
getHeader() |
int |
getRowCount() |
Object |
getRowData() |
int |
getRowIndex() |
int |
getRows()
Gets The number of rows to be displayed.
|
Object |
getValue()
Gets An EL expression that specifies the data model that backs this table.
|
String |
getVar()
Gets Defines the name of the request-scope variable that will hold the current row during iteration.
|
boolean |
invokeOnComponent(FacesContext context,
String clientId,
ContextCallback callback)
invokeOnComponent must be implemented in UIComponentBase too... |
boolean |
isRowAvailable() |
void |
processDecodes(FacesContext context) |
void |
processUpdates(FacesContext context)
This isn't an input component, so just pass on the processUpdates
call to child components and facets that might be input components.
|
void |
processValidators(FacesContext context) |
void |
queueEvent(FacesEvent event)
Modify events queued for any child components so that the
UIData state will be correctly configured before the event's
listeners are executed.
|
void |
restoreState(FacesContext facesContext,
Object state)
Invoked in the "restore view" phase, this initialises this
object's members from the values saved previously into the
provided state object.
|
Object |
saveState(FacesContext facesContext)
Invoked after the render phase has completed, this method
returns an object which can be passed to the restoreState
of some other instance of UIComponentBase to reset that
object's state to the same values as this object currently
has.
|
protected void |
setDataModel(DataModel dataModel) |
void |
setFirst(int first)
Set the index of the first row to be displayed, where 0 is the first row.
|
void |
setFooter(UIComponent footer) |
void |
setHeader(UIComponent header) |
void |
setRowIndex(int rowIndex)
Set the current row index that methods like getRowData use.
|
void |
setRows(int rows)
Set the maximum number of rows displayed in the table.
|
void |
setValue(Object value) |
void |
setValueExpression(String name,
javax.el.ValueExpression binding) |
void |
setVar(String var)
Sets Defines the name of the request-scope variable that will hold the current row during iteration.
|
addFacesListener, decode, encodeChildren, findComponent, getAttributes, getChildCount, getChildren, getFacesContext, getFacesListeners, getFacet, getFacetCount, getFacets, getFacetsAndChildren, getId, getParent, getRenderer, getRendererType, getRendersChildren, getValueBinding, isRendered, isTransient, processRestoreState, processSaveState, removeFacesListener, restoreAttachedState, saveAttachedState, setId, setParent, setRendered, setRendererType, setTransient, setValueBinding
encodeAll, getContainerClientId, getValueExpression
public static final String COMPONENT_FAMILY
public static final String COMPONENT_TYPE
public boolean invokeOnComponent(FacesContext context, String clientId, ContextCallback callback) throws FacesException
UIComponentBase
invokeOnComponent
must be implemented in UIComponentBase
too...invokeOnComponent
in class UIComponentBase
context
- FacesContext
for the current requestclientId
- the id of the desired UIComponent
clazzcallback
- Implementation of the ContextCallback
to be calledFacesException
public void setFooter(UIComponent footer)
public UIComponent getFooter()
public void setHeader(UIComponent header)
public UIComponent getHeader()
public boolean isRowAvailable()
public int getRowCount()
public Object getRowData()
public int getRowIndex()
public void setRowIndex(int rowIndex)
Param rowIndex can be -1, meaning "no row".
rowIndex
- public void setValueExpression(String name, javax.el.ValueExpression binding)
setValueExpression
in class UIComponent
public String getClientId(FacesContext context)
UIComponentBase
The component should have an id attribute already assigned to it; however if the id property is currently null then a unique id is generated and set for this component. This only happens when components are programmatically created without ids, as components created by a ViewHandler should be assigned ids when they are created.
If this component is a descendant of a NamingContainer then the client id is of form "{namingContainerId}:{componentId}". Note that the naming container's id may itself be of compound form if it has an ancestor naming container. Note also that this only applies to naming containers; other UIComponent types in the component's ancestry do not affect the clientId.
Finally the renderer associated with this component is asked to convert the id into a suitable form. This allows escaping of any characters in the clientId which are significant for the markup language generated by that renderer.
getClientId
in class UIComponentBase
public void queueEvent(FacesEvent event)
Child components or their renderers may register events against those child components. When the listener for that event is eventually invoked, it may expect the uidata's rowData and rowIndex to be referring to the same object that caused the event to fire.
The original queueEvent call against the child component has been forwarded up the chain of ancestors in the standard way, making it possible here to wrap the event in a new event whose source is this component, not the original one. When the event finally is executed, this component's broadcast method is invoked, which ensures that the UIData is set to be at the correct row before executing the original event.
queueEvent
in class UIComponentBase
public void broadcast(FacesEvent event) throws AbortProcessingException
See queueEvent for more details.
broadcast
in class UIComponentBase
event
- must not be null.AbortProcessingException
public void encodeBegin(FacesContext context) throws IOException
encodeBegin
in class UIComponentBase
IOException
public void encodeEnd(FacesContext context) throws IOException
encodeEnd
in class UIComponentBase
IOException
UIComponentBase.encodeEnd(javax.faces.context.FacesContext)
public void processDecodes(FacesContext context)
processDecodes
in class UIComponentBase
public void processValidators(FacesContext context)
processValidators
in class UIComponentBase
public void processUpdates(FacesContext context)
UIComponentBase
Components that were never rendered can't possibly be receiving update data (no corresponding fields were ever put into the response) so if this component is not rendered then this method does not invoke processUpdates on its children.
processUpdates
in class UIComponentBase
protected DataModel getDataModel()
This is complicated by the fact that this table may be nested within another table. In this case a different datamodel should be fetched for each row. When nested within a parent table, the parent reference won't change but parent.getClientId() will, as the suffix changes depending upon the current row index. A map object on this component is therefore used to cache the datamodel for each row of the table. In the normal case where this table is not nested inside a component that changes its id (like a table does) then this map only ever has one entry.
protected void setDataModel(DataModel dataModel)
public void setValue(Object value)
public void setRows(int rows)
public void setFirst(int first)
public Object getValue()
public String getVar()
public void setVar(String var)
var
- the new var valuepublic int getRows()
public int getFirst()
public Object saveState(FacesContext facesContext)
UIComponentBase
saveState
in interface StateHolder
saveState
in class UIComponentBase
public void restoreState(FacesContext facesContext, Object state)
UIComponentBase
restoreState
in interface StateHolder
restoreState
in class UIComponentBase
state
- is an object previously returned by
the saveState method of this class.public String getFamily()
getFamily
in class UIComponent
Copyright © 2013 Apache Software Foundation. All Rights Reserved.