public interface IRefreshable
Provider that allows wrapped data to be refreshed, i.e. reloaded from the data source. Typically the implementations support some notion of input parameters and output results, where input parameters are used to execute a query or a service and the output results are populated from this query or service call.
.The provider implementation can support auto-refresh of the results when input parameters have changed. The
client must glag the fact that the input parameters have changed by setting setNeedRefresh(boolean)
= true
.
This is done automatically if clients use BaseFacesBean.resolveDataBinding(String[][], Object, String)
method on the page bean for dynamic data binding of the provider input parameters.
Modifier and Type | Method and Description |
---|---|
boolean |
getNeedRefresh()
Returns
true when isAutoRefresh() is on and the result properties need to be refreshed from
the data source by executing refresh() method. |
boolean |
isAutoRefresh()
Returns
true if the provider is currenlty in auto-refresh mode |
void |
refresh()
(Re)loads data from the data source.
|
void |
setAutoRefresh(boolean autorefresh)
Sets auto refresh mode on.
|
void |
setNeedRefresh(boolean needRefresh)
Tells the provider that the input parameters have changed and the output results need to be refreshed the next time any
output property is requested via
IContentProvider.getValue(Object) . |
boolean |
supportsAutoRefresh()
Returns true if this content provider supports auto refresh feature.
|
void refresh() throws ContentProviderException
ContentProviderException
- if error loading data from the data sourceboolean supportsAutoRefresh()
setAutoRefresh(boolean)
void setAutoRefresh(boolean autorefresh) throws ContentProviderException
Sets auto refresh mode on. When auto refresh mode is on, the provider calls getNeedRefresh()
to determine whether the refresh needs to be done before returning any result properties. If it returns
true
, the provider calls refresh()
method to updated the result properties.
autorefresh
- true to turn it onContentProviderException
- if auto refresh mode is not supportedsupportsAutoRefresh()
,
getNeedRefresh()
,
setNeedRefresh(boolean)
boolean isAutoRefresh()
true
if the provider is currenlty in auto-refresh modeboolean getNeedRefresh()
Returns true
when isAutoRefresh()
is on and the result properties need to be refreshed from
the data source by executing refresh()
method.
Implementations may return an accurate value from this method if they can track the changes to the input parameter
properties or they may require the clients to call setNeedRefresh(boolean)
explicitely.
true
when the output properties are not up-to-date with the current input parameters, i.e. refresh()
needs to be executed manually or automatically.void setNeedRefresh(boolean needRefresh)
IContentProvider.getValue(Object)
.needRefresh
- true
if the input parameters have changed