|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
javax.faces.component Class UIData
java.lang.Objectjavax.faces.component.UIComponent
javax.faces.component.UIComponentBase
javax.faces.component.UIData
- All Implemented Interfaces:
- NamingContainer, StateHolder
- Direct Known Subclasses:
- HtmlDataTable
public class UIData
- extends UIComponentBase
- implements NamingContainer
UIData 是支持将数据绑定到由 DataModel 实例表示的数据对象 Collection 的 UIComponent,该实例是此组件本身的当前值(通常通过 ValueExpression 建立)。在对数据模型的数据行进行迭代处理的过程中,当前行的对象作为 var 属性指定的键下的请求属性公开。
只有类型为 UIColumn 的子组件应该由与此组件关联的 renderer 处理。
默认情况下,rendererType 属性被设置为 javax.faces.Table。可以调用 setRendererType() 方法更改此值。
UIData is a UIComponent that supports
data binding to a collection of data objects represented by a
DataModel instance, which is the current value of this component
itself (typically established via a ValueExpression).
During iterative processing over the rows of data in the data model,
the object for the current row is exposed as a request attribute
under the key specified by the var property.
Only children of type UIColumn should be processed by
renderers associated with this component.
By default, the rendererType property is set to
javax.faces.Table. This value can be changed by calling the
setRendererType() method.
| Field Summary | |
|---|---|
static String |
COMPONENT_FAMILY
The standard component family for this component. |
static String |
COMPONENT_TYPE
The standard component type for this component. |
| Fields inherited from class javax.faces.component.UIComponent |
|---|
bindings |
| Fields inherited from interface javax.faces.component.NamingContainer |
|---|
SEPARATOR_CHAR |
| Constructor Summary | |
|---|---|
UIData()
Create a new UIData instance with default property
values. |
|
| Method Summary | |
|---|---|
void |
broadcast(FacesEvent event)
Override the default UIComponentBase.broadcast(javax.faces.event.FacesEvent) processing
to unwrap any wrapped FacesEvent and reset the current row index,
before the event is actually broadcast. |
void |
encodeBegin(FacesContext context)
In addition to the default behavior, ensure that any saved per-row state for our child input components is discarded unless it is needed to rerender the current page with errors. |
String |
getClientId(FacesContext context)
Return a client identifier for this component that includes the current value of the rowIndex property, if it is not
set to -1. |
protected DataModel |
getDataModel()
Return the internal DataModel object representing the
data objects that we will iterate over in this component's
rendering. |
String |
getFamily()
Return the identifier of the component family to which this component belongs. |
int |
getFirst()
Return the zero-relative row number of the first row to be displayed. |
UIComponent |
getFooter()
Return the footer facet of this component (if any). |
UIComponent |
getHeader()
Return the header facet of this component (if any). |
int |
getRowCount()
Return the number of rows in the underlying data model. |
Object |
getRowData()
Return the data object representing the data for the currently selected row index, if any. |
int |
getRowIndex()
Return the zero-relative index of the currently selected row. |
int |
getRows()
Return the number of rows to be displayed, or zero for all remaining rows in the table. |
Object |
getValue()
Return the value of the UIData. |
String |
getVar()
Return the request-scope attribute under which the data object for the current row will be exposed when iterating. |
boolean |
invokeOnComponent(FacesContext context,
String clientId,
ContextCallback callback)
Override behavior from UIComponentBase.invokeOnComponent(javax.faces.context.FacesContext, java.lang.String, javax.faces.component.ContextCallback) to provide special care for
positioning the data properly before finding the component and
invoking the callback on it. |
boolean |
isRowAvailable()
Return a flag indicating whether there is rowData
available at the current rowIndex. |
void |
processDecodes(FacesContext context)
Override the default UIComponentBase.processDecodes(javax.faces.context.FacesContext)
processing to perform the following steps. |
void |
processUpdates(FacesContext context)
Override the default UIComponentBase.processUpdates(javax.faces.context.FacesContext)
processing to perform the following steps. |
void |
processValidators(FacesContext context)
Override the default UIComponentBase.processValidators(javax.faces.context.FacesContext)
processing to perform the following steps. |
void |
queueEvent(FacesEvent event)
Override the default UIComponentBase.queueEvent(javax.faces.event.FacesEvent) processing
to wrap any queued events in a wrapper so that we can reset the current
row index in broadcast(). |
void |
restoreState(FacesContext context,
Object state)
Perform any processing required to restore the state from the entries in the state Object. |
Object |
saveState(FacesContext context)
Gets the state of the instance as a Serializable Object. |
protected void |
setDataModel(DataModel dataModel)
Set the internal DataModel. |
void |
setFirst(int first)
Set the zero-relative row number of the first row to be displayed. |
void |
setFooter(UIComponent footer)
Set the footer facet of this component. |
void |
setHeader(UIComponent header)
Set the header facet of this component. |
void |
setRowIndex(int rowIndex)
Set the zero relative index of the current row, or -1 to indicate that no row is currently selected, by implementing the following algorithm. |
void |
setRows(int rows)
Set the number of rows to be displayed, or zero for all remaining rows in the table. |
void |
setValue(Object value)
Set the value of the UIData. |
void |
setValueBinding(String name,
ValueBinding binding)
Deprecated. This has been replaced by setValueExpression(java.lang.String, javax.el.ValueExpression). |
void |
setValueExpression(String name,
ValueExpression binding)
Set the ValueExpression used to calculate the value for the
specified attribute or property name, if any. |
void |
setVar(String var)
Set the request-scope attribute under which the data object for the current row wil be exposed when iterating. |
| Methods inherited from class javax.faces.component.UIComponentBase |
|---|
addFacesListener, decode, encodeChildren, encodeEnd, 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 |
| Methods inherited from class javax.faces.component.UIComponent |
|---|
encodeAll, getContainerClientId, getValueExpression |
| 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 String COMPONENT_TYPE
The standard component type for this component.
- See Also:
- Constant Field Values
英文文档:
COMPONENT_FAMILY
public static final String COMPONENT_FAMILY
The standard component family for this component.
- See Also:
- Constant Field Values
| Constructor Detail |
|---|
public
UIData()
使用默认属性值创建新的 UIData 实例。
UIData
public UIData()
Create a new
UIDatainstance with default property values.
| Method Detail |
|---|
public String
getFamily()
英文文档:
getFamily
public String getFamily()
- Description copied from class:
UIComponent Return the identifier of the component family to which this component belongs. This identifier, in conjunction with the value of the
rendererTypeproperty, may be used to select the appropriateRendererfor this component instance.- Specified by:
getFamilyin classUIComponent
public int
getFirst()
返回要显示的第一行的相对于 0 的行号。
getFirst
public int getFirst()
Return the zero-relative row number of the first row to be displayed.
public void
setFirst(int first)
设置要显示的第一行的相对于 0 的行号。
| first | 新的第一行行号 |
| Throws | IllegalArgumentException:
如果 first 为负 |
setFirst
public void setFirst(int first)
Set the zero-relative row number of the first row to be displayed.
- Parameters:
first- New first row number- Throws:
IllegalArgumentException- iffirstis negative
public UIComponent
getFooter()
返回此组件的脚注 facet(如果有)。getFacet("footer") 的便捷方法。
getFooter
public UIComponent getFooter()
Return the footer facet of this component (if any). A convenience method for
getFacet("footer").
public void
setFooter(UIComponent footer)
设置此组件的脚注 facet。getFacets().put("footer", footer) 的便捷方法。
| footer | 新的脚注 facet |
| Throws | NullPointerException:
如果 footer 为 null |
setFooter
public void setFooter(UIComponent footer)
Set the footer facet of this component. A convenience method for
getFacets().put("footer", footer).- Parameters:
footer- the new footer facet- Throws:
NullPointerException- iffooterisnull
public UIComponent
getHeader()
返回此组件的头 facet(如果有)。getFacet("header") 的便捷方法。
getHeader
public UIComponent getHeader()
Return the header facet of this component (if any). A convenience method for
getFacet("header").
public void
setHeader(UIComponent header)
设置此组件的头 facet。getFacets().put("header", header) 的便捷方法。
| header | 新的头 facet |
| Throws | NullPointerException:
如果 header 为 null |
setHeader
public void setHeader(UIComponent header)
Set the header facet of this component. A convenience method for
getFacets().put("header", header).- Parameters:
header- the new header facet- Throws:
NullPointerException- ifheaderisnull
public boolean
isRowAvailable()
返回一个指示当前 rowIndex 是否有可用的 rowData 的标志。如果没有任何 wrappedData 可用,则返回 false。
| Throws | FacesException: 如果检测行可用性时发生错误 |
isRowAvailable
public boolean isRowAvailable()
Return a flag indicating whether there is
rowDataavailable at the currentrowIndex. If nowrappedDatais available, returnfalse.- Throws:
FacesException- if an error occurs getting the row availability
public int
getRowCount()
返回底层数据模型中的行数。如果可用行数未知,则返回 -1。
| Throws | FacesException: 如果获取行数时发生错误 |
getRowCount
public int getRowCount()
Return the number of rows in the underlying data model. If the number of available rows is unknown, return -1.
- Throws:
FacesException- if an error occurs getting the row count
public Object
getRowData()
返回表示当前选定行索引的数据的数据对象(如果有)。
| Throws | FacesException: 如果获取行数据时发生错误 |
| Throws | IllegalArgumentException: 如果当前指定行索引处的行数据目前可用 |
getRowData
public Object getRowData()
Return the data object representing the data for the currently selected row index, if any.
- Throws:
FacesException- if an error occurs getting the row dataIllegalArgumentException- if now row data is available at the currently specified row index
public int
getRowIndex()
返回当前选定行相对于 0 的索引。如果我们当前没有位于行上,则返回 -1。没有为值绑定表达式启用此属性。
| Throws | FacesException: 如果获取行索引时发生错误 |
getRowIndex
public int getRowIndex()
Return the zero-relative index of the currently selected row. If we are not currently positioned on a row, return -1. This property is not enabled for value binding expressions.
- Throws:
FacesException- if an error occurs getting the row index
public void
setRowIndex(int rowIndex)
通过实现下列算法设置当前行相对于 0 的索引,或者设置为 -1 指示当前没有选定任何行。可以将行索引设置为某个值,在该值处底层数据 Collection 不包含任何行数据。因此,调用者可以使用 isRowAvailable() 方法检测是否可以通过 getRowData() 方法获得行数据。
- 保存所有后代组件的当前状态信息(如下所述)。
- 存储新的行索引,并将其传递给与此
UIData实例关联的DataModel。 - 如果新的
rowIndex值为 -1:- 如果
var属性不为 null,则移除相应的请求范围属性(如果有)。 - 重置所有后代组件的状态信息(如下所述)。
- 如果
- 如果新的
rowIndex值不为 -1:- 如果
var属性不为 null,则调用getRowData(),并将得到的数据对象作为其键为var属性值的请求范围属性公开。 - 重置所有后代组件的状态信息(如下所述)。
- 如果
要保存所有后代组件的当前状态信息,UIData 必须维护每个后代的每行信息,如下所示:
- 如果后代是
EditableValueHolder的实例,则保存其localValue属性的状态。 - 如果后代是
EditableValueHolder的实例,则保存localValueSet属性的状态。 - 如果后代是
EditableValueHolder的实例,则保存valid属性的状态。 - 如果后代是
EditableValueHolder的实例,则保存submittedValue属性的状态。
要恢复所有后代组件的当前状态信息,UIData 必须引用它以前为当前 rowIndex 存储的信息,并为每个后代调用设置方法,如下所示:
- 如果后代是
EditableValueHolder的实例,则恢复value属性。 - 如果后代是
EditableValueHolder的实例,则恢复localValueSet属性的状态。 - 如果后代是
EditableValueHolder的实例,则恢复valid属性的状态。 - 如果后代是
EditableValueHolder的实例,则恢复submittedValue属性的状态。
| rowIndex | 新的行索引值,或在无关联行时为 -1 |
| Throws | FacesException: 如果设置行索引时发生错误 |
| Throws | IllegalArgumentException:
如果 rowIndex 小于 -1 |
setRowIndex
public void setRowIndex(int rowIndex)
Set the zero relative index of the current row, or -1 to indicate that no row is currently selected, by implementing the following algorithm. It is possible to set the row index at a value for which the underlying data collection does not contain any row data. Therefore, callers may use the
isRowAvailable()method to detect whether row data will be available for use by thegetRowData()method.
- Save current state information for all descendant components (as described below).
- Store the new row index, and pass it on to the
DataModelassociated with thisUIDatainstance. - If the new
rowIndexvalue is -1:- If the
varproperty is not null, remove the corresponding request scope attribute (if any). - Reset the state information for all descendant components (as described below).
- If the
- If the new
rowIndexvalue is not -1:- If the
varproperty is not null, callgetRowData()and expose the resulting data object as a request scope attribute whose key is thevarproperty value. - Reset the state information for all descendant components (as described below).
- If the
To save current state information for all descendant components,
UIData must maintain per-row information for each descendant
as follows:
- If the descendant is an instance of
EditableValueHolder, save the state of itslocalValueproperty. - If the descendant is an instance of
EditableValueHolder, save the state of thelocalValueSetproperty. - If the descendant is an instance of
EditableValueHolder, save the state of thevalidproperty. - If the descendant is an instance of
EditableValueHolder, save the state of thesubmittedValueproperty.
To restore current state information for all descendant components,
UIData must reference its previously stored information for the
current rowIndex and call setters for each descendant
as follows:
- If the descendant is an instance of
EditableValueHolder, restore thevalueproperty. - If the descendant is an instance of
EditableValueHolder, restore the state of thelocalValueSetproperty. - If the descendant is an instance of
EditableValueHolder, restore the state of thevalidproperty. - If the descendant is an instance of
EditableValueHolder, restore the state of thesubmittedValueproperty.
- Parameters:
rowIndex- The new row index value, or -1 for no associated row- Throws:
FacesException- if an error occurs setting the row indexIllegalArgumentException- ifrowIndexis less than -1
public int
getRows()
返回要显示的行数,或为表中所有其余行返回 0。此属性的默认值为 0。
getRows
public int getRows()
Return the number of rows to be displayed, or zero for all remaining rows in the table. The default value of this property is zero.
public void
setRows(int rows)
设置要显示的行数,或为表中所有其余行设置为 0。
| rows | 新的行数 |
| Throws | IllegalArgumentException:
如果 rows 为负 |
setRows
public void setRows(int rows)
Set the number of rows to be displayed, or zero for all remaining rows in the table.
- Parameters:
rows- New number of rows- Throws:
IllegalArgumentException- ifrowsis negative
public String
getVar()
返回请求范围属性,在迭代时,将在此属性下公开当前行的数据对象。没有为值绑定表达式启用此属性。
getVar
public String getVar()
Return the request-scope attribute under which the data object for the current row will be exposed when iterating. This property is not enabled for value binding expressions.
public void
setVar(String var)
设置请求范围属性,在迭代时,将在此属性下公开当前行的数据对象。
| var | 新请求范围属性名称 |
setVar
public void setVar(String var)
Set the request-scope attribute under which the data object for the current row wil be exposed when iterating.
- Parameters:
var- The new request-scope attribute name
public Object
saveState(FacesContext context)
英文文档:
saveState
public Object saveState(FacesContext context)
- Description copied from interface:
StateHolder Gets the state of the instance as a
SerializableObject.If the class that implements this interface has references to instances that implement StateHolder (such as a
UIComponentwith event handlers, validators, etc.) this method must call theStateHolder.saveState(javax.faces.context.FacesContext)method on all those instances as well. This method must not save the state of children and facets. That is done via theStateManagerThis method must not alter the state of the implementing object. In other words, after executing this code:
Object state = component.saveState(facesContext);
componentshould be the same as before executing it.The return from this method must be
Serializable- Specified by:
saveStatein interfaceStateHolder- Overrides:
saveStatein classUIComponentBase
public void
restoreState(FacesContext context, Object state)
英文文档:
restoreState
public void restoreState(FacesContext context, Object state)
- Description copied from interface:
StateHolder Perform any processing required to restore the state from the entries in the state Object.
If the class that implements this interface has references to instances that also implement StateHolder (such as a
UIComponentwith event handlers, validators, etc.) this method must call theStateHolder.restoreState(javax.faces.context.FacesContext, java.lang.Object)method on all those instances as well.- Specified by:
restoreStatein interfaceStateHolder- Overrides:
restoreStatein classUIComponentBase
public Object
getValue()
返回 UIData 的值。此值必须为 DataModel 类型,或者可以适配到 DataModel 中的类型。UIData 将自动适配以下类型:
- 数组
java.util.Listjava.sql.ResultSetjavax.servlet.jsp.jstl.sql.Result
所有其他类型将使用 ScalarDataModel 类适配,该类将对象视作单个数据行。
getValue
public Object getValue()
Return the value of the UIData. This value must either be be of type
DataModel, or a type that can be adapted into aDataModel.UIDatawill automatically adapt the following types:- Arrays
java.util.Listjava.sql.ResultSetjavax.servlet.jsp.jstl.sql.Result
All other types will be adapted using the
ScalarDataModelclass, which will treat the object as a single row of data.
public void
setValue(Object value)
设置 UIData 的值。此值必须为 DataModel 类型,或者可以适配到 DataModel 中的类型。
| value | 新值 |
setValue
public void setValue(Object value)
Set the value of the
UIData. This value must either be be of typeDataModel, or a type that can be adapted into aDataModel.- Parameters:
value- the new value
public void
setValueBinding(String name, ValueBinding binding)
如果 "name" 为 "value"、"var" 或 "rowIndex" 之外的项目,则依赖超类将 ValueBinding 转换为 ValueExpression。
| name |
将为其设置 ValueBinding 的属性的名称 |
| binding |
要设置的 ValueBinding,或为 null 以移除任何当前设置的 ValueBinding |
| Throws | IllegalArgumentException:
如果 name 为 id、parent、var 或 rowIndex 之一 |
| Throws | NullPointerException:
如果 name 为 null |
| deprecated |
此方法已由 #setValueExpression(java.lang.String, javax.el.ValueExpression) 替代。 |
setValueBinding
public void setValueBinding(String name, ValueBinding binding)
- Deprecated. This has been replaced by
setValueExpression(java.lang.String, javax.el.ValueExpression). If "name" is something other than "value", "var", or "rowIndex", rely on the superclass conversion from
ValueBindingtoValueExpression.- Overrides:
setValueBindingin classUIComponentBase
- Parameters:
name- Name of the attribute or property for which to set aValueBindingbinding- TheValueBindingto set, ornullto remove any currently setValueBinding- Throws:
IllegalArgumentException- ifnameis one ofid,parent,var, orrowIndexNullPointerException- ifnameisnull
public void
setValueExpression(String name, ValueExpression binding)
设置用于计算指定属性名称值的 ValueExpression(如果有)。此外,如果为 value 属性设置了 ValueExpression,则移除以前绑定到此组件的数据的任何合成 DataModel。
| name |
要为其设置 ValueExpression 的属性的名称 |
| binding |
要设置的 ValueExpression,或为 null 以移除任何当前设置的 ValueExpression |
| Throws | IllegalArgumentException:
如果 name 为 id、parent、var 或 rowIndex 之一 |
| Throws | NullPointerException:
如果 name 为 null |
| since | 1.2 |
setValueExpression
public void setValueExpression(String name, ValueExpression binding)
Set the
ValueExpressionused to calculate the value for the specified attribute or property name, if any. In addition, if aValueExpressionis set for thevalueproperty, remove any synthesizedDataModelfor the data previously bound to this component.- Overrides:
setValueExpressionin classUIComponent
- Parameters:
name- Name of the attribute or property for which to set aValueExpressionbinding- TheValueExpressionto set, ornullto remove any currently setValueExpression- Throws:
IllegalArgumentException- ifnameis one ofid,parent,var, orrowIndexNullPointerException- ifnameisnull- Since:
- 1.2
public String
getClientId(FacesContext context)
如果 rowIndex 属性的当前值未设置为 -1,则返回包含其当前值的此组件的客户端标识符。这意味着对 getClientId() 的多次调用可能会返回不同的结果,但这会确保该子组件本身能够生成特定于行的客户端标识符(因为 UIData 是 NamingContainer)。
| Throws | NullPointerException:
如果 context 为 null |
getClientId
public String getClientId(FacesContext context)
Return a client identifier for this component that includes the current value of the
rowIndexproperty, if it is not set to -1. This implies that multiple calls togetClientId()may return different results, but ensures that child components can themselves generate row-specific client identifiers (sinceUIDatais aNamingContainer).- Overrides:
getClientIdin classUIComponentBase
- Parameters:
context- TheFacesContextfor the current request- Throws:
NullPointerException- ifcontextisnull
public boolean
invokeOnComponent(FacesContext context, String clientId, ContextCallback callback) throws FacesException
重写 UIComponentBase#invokeOnComponent 中的行为,以便在找到组件并调用其上的回调之前,对正确定位数据予以特别关注。如果参数 clientId 等于 this.getClientId(),则只需调用 contextCallback 同时将 context 参数和 this 作为参数传递即可,然后返回 true。否则,尝试从 clientId 中提取 rowIndex。例如,如果参数 clientId 为 form:data:3:customerHeader,则 rowIndex 将为 3。使此值称为 newIndex。在所有情况下,都必须保存此实例的当前 rowIndex 并在返回之前将其恢复,无论搜索结果如何或是否在此过程中抛出任何异常。
如果将此实例的 rowIndex 设置为等于 newIndex 导致此实例从 #isRowAvailable 返回 false,则此方法的实现绝不会返回 true。
| since | 1.2 |
| Throws | NullPointerException: NullPointerException NullPointerException 如果任何参数为 null |
| Throws | FacesException:
NullPointerException
如果参数 Callback 抛出 Exception,则将在 FacesException 中包装它并将其重新抛出。 如果在从参数 clientId 派生 rowIndex 时有任何异常抛出,则还抛出 FacesException。 |
invokeOnComponent
public boolean invokeOnComponent(FacesContext context, String clientId, ContextCallback callback) throws FacesException
Override behavior from
UIComponentBase.invokeOnComponent(javax.faces.context.FacesContext, java.lang.String, javax.faces.component.ContextCallback)to provide special care for positioning the data properly before finding the component and invoking the callback on it. If the argumentclientIdis equal tothis.getClientId()simply invoke thecontextCallback, passing thecontextargument and this as arguments, and returntrue.Otherwise, attempt to extract a rowIndex from theclientId. For example, if the argumentclientIdwasform:data:3:customerHeaderthe rowIndex would be3. Let this value be callednewIndex. The current rowIndex of this instance must be saved aside and restored before returning in all cases, regardless of the outcome of the search or if any exceptions are thrown in the process.The implementation of this method must never return
trueif setting the rowIndex of this instance to be equal tonewIndexcauses this instance to returnfalsefromisRowAvailable().- Overrides:
invokeOnComponentin classUIComponentBase
- Parameters:
context- theFacesContextfor the current requestclientId- the client identifier of the component to be passed to the argument callback.callback- an implementation of the Callback interface.- Returns:
trueif the a component with the givenclientIdis found, the callback method was successfully invoked passing that component as an argument, and no Exception was thrown. Returnsfalseif no component with the givenclientIdis found.- Throws:
NullPointerException- if any of the arguments are nullFacesException- if the argument Callback throws an Exception, it is wrapped in aFacesExceptionand re-thrown. Also throwsFacesExceptionif any exception is thrown when deriving the rowIndex from the argumentclientId.- Since:
- 1.2
public void
queueEvent(FacesEvent event)
重写默认的 UIComponentBase#queueEvent 处理以在包装器中包装任何排队事件,以便可以在 broadcast() 中重置当前的行索引。
| event |
要排队的 FacesEvent |
| Throws | IllegalStateException:
如果此组件不是 UIViewRoot 的后代 |
| Throws | NullPointerException:
如果 event 为 null |
queueEvent
public void queueEvent(FacesEvent event)
Override the default
UIComponentBase.queueEvent(javax.faces.event.FacesEvent)processing to wrap any queued events in a wrapper so that we can reset the current row index inbroadcast().- Overrides:
queueEventin classUIComponentBase
- Parameters:
event-FacesEventto be queued- Throws:
IllegalStateException- if this component is not a descendant of aUIViewRootNullPointerException- ifeventisnull
public void
broadcast(FacesEvent event) throws AbortProcessingException
重写默认的 UIComponentBase#broadcast 处理以便在实际广播事件之前,对任何已包装的 FacesEvent 解包,并重置当前行索引。对于未包装的事件(在 queueEvent() 中),将执行默认处理。
| event |
要广播的 FacesEvent |
| Throws | AbortProcessingException: 通知 JavaServer Face 实现不应该继续处理当前事件 |
| Throws | IllegalArgumentException:
如果此组件不支持此 FacesEvent 的实现类 |
| Throws | NullPointerException:
如果 event 为 null |
broadcast
public void broadcast(FacesEvent event) throws AbortProcessingException
Override the default
UIComponentBase.broadcast(javax.faces.event.FacesEvent)processing to unwrap any wrappedFacesEventand reset the current row index, before the event is actually broadcast. For events that we did not wrap (inqueueEvent()), default processing will occur.- Overrides:
broadcastin classUIComponentBase
- Parameters:
event- TheFacesEventto be broadcast- Throws:
AbortProcessingException- Signal the JavaServer Faces implementation that no further processing on the current event should be performedIllegalArgumentException- if the implementation class of thisFacesEventis not supported by this componentNullPointerException- ifeventisnull
public void
encodeBegin(FacesContext context) throws java.io.IOException
除默认行为外,确保子输入组件的任何已保存的每行状态都被丢弃,除非需要它来呈现当前带有错误的页面。
| context | 当前请求的 FacesContext |
| Throws | java.io.IOException: 如果呈现期间发生输入/输出错误 |
| Throws | NullPointerException:
如果 context 为 null |
encodeBegin
public void encodeBegin(FacesContext context) throws IOException
In addition to the default behavior, ensure that any saved per-row state for our child input components is discarded unless it is needed to rerender the current page with errors.
- Overrides:
encodeBeginin classUIComponentBase
- Parameters:
context- FacesContext for the current request- Throws:
IOException- if an input/output error occurs while renderingNullPointerException- ifcontextisnull
public void
processDecodes(FacesContext context)
重写默认的 UIComponentBase#processDecodes 处理以执行下列步骤。
- 如果此
UIComponent的rendered属性为false,则跳过进一步的处理。 - 将当前
rowIndex设置为 -1。 - 按照调用
getFacets().keySet().iterator()所确定的顺序,调用此UIData所有 facet 的processDecodes()方法。 - 调用此
UIData的UIColumn子组件的所有 facet 的processDecodes()方法。 - 迭代呈现此组件时包含的行集合(即通过
first和rows属性定义的那些行),对每个行执行以下处理: - 将当前
rowIndex设置为 -1。 - 调用此组件的
decode()方法。 - 如果在解码处理期间抛出
RuntimeException,则调用FacesContext#renderResponse并重新抛出该异常。
| context |
当前请求的 FacesContext |
| Throws | NullPointerException:
如果 context 为 null |
processDecodes
public void processDecodes(FacesContext context)
Override the default
UIComponentBase.processDecodes(javax.faces.context.FacesContext)processing to perform the following steps.- If the
renderedproperty of thisUIComponentisfalse, skip further processing. - Set the current
rowIndexto -1. - Call the
processDecodes()method of all facets of thisUIData, in the order determined by a call togetFacets().keySet().iterator(). - Call the
processDecodes()method of all facets of theUIColumnchildren of thisUIData. - Iterate over the set of rows that were included when this
component was rendered (i.e. those defined by the
firstandrowsproperties), performing the following processing for each row: - Set the current
rowIndexto -1. - Call the
decode()method of this component. - If a
RuntimeExceptionis thrown during decode processing, callFacesContext.renderResponse()and re-throw the exception.
- If the
- Overrides:
processDecodesin classUIComponentBase
- Parameters:
context-FacesContextfor the current request- Throws:
NullPointerException- ifcontextisnull
public void
processValidators(FacesContext context)
重写默认的 UIComponentBase#processValidators 处理以执行下列步骤。
- 如果此
UIComponent的rendered属性为false,则跳过进一步的处理。 - 将当前
rowIndex设置为 -1。 - 按照调用
getFacets().keySet().iterator()所确定的顺序,调用此UIData所有 facet 的processValidators()方法。 - 调用此
UIData的UIColumn子组件的所有 facet 的processValidators()方法。 - 迭代呈现此组件时包含的行集合(即通过
first和rows属性定义的那些行),对每个行执行以下处理: - 将当前
rowIndex设置为 -1。
| context |
当前请求的 FacesContext |
| Throws | NullPointerException:
如果 context 为 null |
processValidators
public void processValidators(FacesContext context)
Override the default
UIComponentBase.processValidators(javax.faces.context.FacesContext)processing to perform the following steps.- If the
renderedproperty of thisUIComponentisfalse, skip further processing. - Set the current
rowIndexto -1. - Call the
processValidators()method of all facets of thisUIData, in the order determined by a call togetFacets().keySet().iterator(). - Call the
processValidators()method of all facets of theUIColumnchildren of thisUIData. - Iterate over the set of rows that were included when this
component was rendered (i.e. those defined by the
firstandrowsproperties), performing the following processing for each row: - Set the current
rowIndexto -1.
- If the
- Overrides:
processValidatorsin classUIComponentBase
- Parameters:
context-FacesContextfor the current request- Throws:
NullPointerException- ifcontextisnull
public void
processUpdates(FacesContext context)
重写默认的 UIComponentBase#processUpdates 处理以执行下列步骤。
- 如果此
UIComponent的rendered属性为false,则跳过进一步的处理。 - 将当前
rowIndex设置为 -1。 - 按照调用
getFacets().keySet().iterator()所确定的顺序,调用此UIData所有 facet 的processUpdates()方法。 - 调用此
UIData的UIColumn子组件的所有 facet 的processUpdates()方法。 - 迭代呈现此组件时包含的行集合(即通过
first和rows属性定义的那些行),对每个行执行以下处理: - 将当前
rowIndex设置为 -1。
| context |
当前请求的 FacesContext |
| Throws | NullPointerException:
如果 context 为 null |
processUpdates
public void processUpdates(FacesContext context)
Override the default
UIComponentBase.processUpdates(javax.faces.context.FacesContext)processing to perform the following steps.- If the
renderedproperty of thisUIComponentisfalse, skip further processing. - Set the current
rowIndexto -1. - Call the
processUpdates()method of all facets of thisUIData, in the order determined by a call togetFacets().keySet().iterator(). - Call the
processUpdates()method of all facets of theUIColumnchildren of thisUIData. - Iterate over the set of rows that were included when this
component was rendered (i.e. those defined by the
firstandrowsproperties), performing the following processing for each row: - Set the current
rowIndexto -1.
- If the
- Overrides:
processUpdatesin classUIComponentBase
- Parameters:
context-FacesContextfor the current request- Throws:
NullPointerException- ifcontextisnull
protected DataModel
getDataModel()
返回表示将在此组件的呈现中迭代的数据对象的内部 DataModel 对象。
如果通过以前调用 #setDataModel 缓存过该模型,则将其返回。否则调用 #getValue。如果结果为 null,则创建空的 ListDataModel 并将其返回。如果结果是 DataModel 的实例,则将其返回。否则,适配 #getValue 中所述的结果,并将其返回。
getDataModel
protected DataModel getDataModel()
Return the internal
DataModelobject representing the data objects that we will iterate over in this component's rendering.If the model has been cached by a previous call to
setDataModel(javax.faces.model.DataModel), return it. Otherwise callgetValue(). If the result is null, create an emptyListDataModeland return it. If the result is an instance ofDataModel, return it. Otherwise, adapt the result as described ingetValue()and return it.
protected void
setDataModel(DataModel dataModel)
设置内部 DataModel。从现在开始,此 UIData 实例必须使用给定的 DataModel 作为其内部值表示形式,直到下次调用 setDataModel。如果给定的 DataModel 为 null,则必须以某种方式重置内部 DataModel,这样下次调用 #getDataModel 会导致新刷新的 DataModel 的延迟实例化。
如果子类要在恢复视图 阶段恢复内部 DataModel,或如果这些子类要在呈现响应 阶段显式刷新当前的 DataModel,则子类可能会调用此方法。
| dataModel |
新的 DataModel 或 null 以使模型被刷新。 |
setDataModel
protected void setDataModel(DataModel dataModel)
Set the internal DataModel. This
UIDatainstance must use the givenDataModelas its internal value representation from now until the next call tosetDataModel. If the givenDataModelisnull, the internalDataModelmust be reset in a manner so that the next call togetDataModel()causes lazy instantion of a newly refreshedDataModel.Subclasses might call this method if they either want to restore the internal
DataModelduring the Restore View phase or if they want to explicitly refresh the currentDataModelfor the Render Response phase.- Parameters:
dataModel- the newDataModelornullto cause the model to be refreshed.
|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Submit a bug or feature
Copyright 2007 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.
PS : 未经我党受权你也可自由散发此文档。 如有任何错误请自行修正;若因此而造成任何损失请直接找人民主席,请勿与本人联系。谢谢!
