public abstract class BaseIteratorTableContentProvider extends PageFlowScopeAdapter implements Serializable, ITableContentProvider, IRefreshableContentProvider, ISelectableTableContentProvider, ISortableTableContentProvider
Modifier and Type | Field and Description |
---|---|
protected int |
m_index
Current row index.
|
protected SelectableTableContentProviderHelper |
m_selectableHelper
Holds selection state.
|
protected String |
m_var
Row variable name.
|
fExpireWithPageFlow
Constructor and Description |
---|
BaseIteratorTableContentProvider()
Default Constructor.
|
BaseIteratorTableContentProvider(javax.jcr.Session jcrSession)
Constructor
|
Modifier and Type | Method and Description |
---|---|
Object |
getCurrentRow()
Returns wrapped current row object.
|
javax.jcr.Session |
getJcrSession()
Gets the current JCR session
|
boolean |
getNeedRefresh()
Returns
true when IRefreshable.isAutoRefresh() is on and the result properties need to be refreshed from
the data source by executing IRefreshable.refresh() method. |
Object[] |
getPropertyKeys()
Returns list of properties supported by this content provider.
|
int |
getRowCount()
Return the number of rows of data objects represented by this DataModel.
|
String |
getRowId()
Returns unique identifier for the current row.
|
int |
getRowIndex()
Return the zero-relative index of the currently selected row.
|
int |
getRowSelectedCount()
Returns number of selected rows.
|
Collection<String> |
getRowSelectedIds()
Returns collection of
String ids of the selected rows. |
protected Class |
getRowType()
Returns the row type for the table control
|
Collection<String> |
getRowUnselectedIds()
Returns collection of
String ids of the un-selected rows
(all other rows are selected implicitly)
May be empty or contain non-existent ids; never null, never contains null. |
String |
getRowVariable()
Returns row variable name.
|
List<Object> |
getSelectedRows()
Returns collection of selected row objects (not IDs) from the ISelectableTableContentProvider.
|
ISortInfo |
getSort()
Returns current sort info.
|
Class<?> |
getType(Object propertyKey)
Returns java type of the given property
|
protected String |
getUniqueId(Object temp)
Gets the unique id of the object.
|
boolean |
getUseUnselectedModel()
Returns true if it's more effecient to use unselected model
(ie
ISelectableTableContentProvider.getRowUnselectedIds() rather than ISelectableTableContentProvider.getRowSelectedIds() ). |
Object |
getValue(Object propertyKey)
Returns value of the given property
|
boolean |
hasProperty(Object propertyKey)
Checks if the given property is supported by this content provider
|
protected abstract boolean |
hasValidInputParameters()
Checks if the provider is configured properly for looking up results
|
protected abstract javax.jcr.RangeIterator |
invokeSearch()
Do the work to return the node iterator
|
boolean |
isAddressable()
Checks if this content provider truly is addressable.
|
boolean |
isAutoRefresh()
Returns
true if the provider is currenlty in auto-refresh mode |
boolean |
isRowAvailable()
Return a flag indicating whether there is rowData available at the
current rowIndex.
|
boolean |
isRowSelected()
Returns
true if current row is selected. |
void |
refresh()
(Re)loads data from the data source.
|
void |
setAutoRefresh(boolean autorefresh)
Sets auto refresh mode on.
|
void |
setJcrSession(javax.jcr.Session jcrSession)
Sets the current JCR session
|
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) . |
void |
setRowById(String id)
Selects current row by its id.
|
void |
setRowIndex(int rowIndex)
Set the zero-relative index of the currently selected row, or -1 to
indicate that we are not positioned on a row.
|
void |
setRowSelected(boolean selected)
Sets the selection status for the current row.
|
void |
setRowSelectedIds(Collection ids)
Sets new selection using a collection of
String ids of the rows to select. |
void |
setRowUnselectedIds(Collection ids)
Unselects rows using a collection of
String ids of the un-selected rows
(all other rows are selected implicitly). |
void |
setRowVariable(String varName)
Sets row variable name to use for accessing row specific data.
|
void |
setSort(ISortInfo sortInfo)
Sets new sort info, re-sorting the table (if necessary).
|
boolean |
supportsAutoRefresh()
Returns true if this content provider supports auto refresh feature.
|
getExpireWithPageFlow, setExpireWithPageFlow
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
toString
protected int m_index
protected String m_var
protected SelectableTableContentProviderHelper m_selectableHelper
public BaseIteratorTableContentProvider()
setJcrSession(Session)
with
a valid JCR session before using.public BaseIteratorTableContentProvider(javax.jcr.Session jcrSession)
jcrSession
- the JCR session to query inpublic javax.jcr.Session getJcrSession()
public void setJcrSession(javax.jcr.Session jcrSession)
jcrSession
- the JCR session to setprotected Class getRowType()
Node
classpublic Object[] getPropertyKeys()
IContentProvider
Object[0]
,
never null.getPropertyKeys
in interface IContentProvider
String
or Integer
public Class<?> getType(Object propertyKey) throws PropertyNotFoundException
IContentProvider
getType
in interface IContentProvider
propertyKey
- the property key of type String
or Integer
Class
PropertyNotFoundException
- if property is not supportedpublic Object getValue(Object propertyKey) throws ELException, PropertyNotFoundException
IContentProvider
getValue
in interface IContentProvider
propertyKey
- the property key of type String
or Integer
null
PropertyNotFoundException
- if property is not supportedELException
public boolean hasProperty(Object propertyKey)
IContentProvider
hasProperty
in interface IContentProvider
propertyKey
- property key of type String
or Integer
true
if property is supportedprotected abstract boolean hasValidInputParameters()
public Object getCurrentRow()
ITableContentProvider
Returns wrapped current row object. Can be null
if not data
is available
getCurrentRow
in interface ITableContentProvider
ITableContentProvider.isRowAvailable()
public int getRowCount()
ITableContentProvider
Return -1, if the number of rows is unknown, or no wrappedData is available.
getRowCount
in interface ITableContentProvider
DataModel.getRowCount()
protected abstract javax.jcr.RangeIterator invokeSearch()
public int getRowIndex()
ITableContentProvider
If we are not currently positioned on a row, or no wrappedData is available, return -1.
getRowIndex
in interface ITableContentProvider
DataModel.getRowIndex()
public String getRowVariable()
ITableContentProvider
Returns row variable name.
If specified row variable can be used to access current row data for the provider internal needs, like sorting or addressing.
getRowVariable
in interface ITableContentProvider
ITableContentProvider.setRowVariable(String)
public boolean isRowAvailable()
ITableContentProvider
isRowAvailable
in interface ITableContentProvider
DataModel.isRowAvailable()
public void setRowIndex(int rowIndex)
ITableContentProvider
setRowIndex
in interface ITableContentProvider
DataModel.getRowIndex()
public void setRowVariable(String varName)
ITableContentProvider
Sets row variable name to use for accessing row specific data. For
example, if the provider wrapps an array of a data objects with
id
property and the variable name is item
, then
the provider implementation can access id
property of each
record as item.id
.
This property should set only once at the provider initialization time
setRowVariable
in interface ITableContentProvider
public boolean getNeedRefresh()
IRefreshable
Returns true
when IRefreshable.isAutoRefresh()
is on and the result properties need to be refreshed from
the data source by executing IRefreshable.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 IRefreshable.setNeedRefresh(boolean)
explicitely.
getNeedRefresh
in interface IRefreshable
true
when the output properties are not up-to-date with the current input parameters, i.e. IRefreshable.refresh()
needs to be executed manually or automatically.public boolean isAutoRefresh()
IRefreshable
true
if the provider is currenlty in auto-refresh modeisAutoRefresh
in interface IRefreshable
public void refresh() throws ContentProviderException
IRefreshable
refresh
in interface IRefreshable
ContentProviderException
- if error loading data from the data sourcepublic void setAutoRefresh(boolean autorefresh) throws ContentProviderException
IRefreshable
Sets auto refresh mode on. When auto refresh mode is on, the provider calls IRefreshable.getNeedRefresh()
to determine whether the refresh needs to be done before returning any result properties. If it returns
true
, the provider calls IRefreshable.refresh()
method to updated the result properties.
setAutoRefresh
in interface IRefreshable
autorefresh
- true to turn it onContentProviderException
- if auto refresh mode is not supportedIRefreshable.supportsAutoRefresh()
,
IRefreshable.getNeedRefresh()
,
IRefreshable.setNeedRefresh(boolean)
public void setNeedRefresh(boolean needRefresh)
IRefreshable
IContentProvider.getValue(Object)
.setNeedRefresh
in interface IRefreshable
needRefresh
- true
if the input parameters have changedpublic boolean supportsAutoRefresh()
IRefreshable
supportsAutoRefresh
in interface IRefreshable
IRefreshable.setAutoRefresh(boolean)
public String getRowId()
IAddressableTableContentProvider
getRowId
in interface IAddressableTableContentProvider
public boolean isAddressable()
IAddressableTableContentProvider
isAddressable
in interface IAddressableTableContentProvider
true
if addressable.public void setRowById(String id)
IAddressableTableContentProvider
setRowIndex(-1)
).setRowById
in interface IAddressableTableContentProvider
id
- row id to find and make currentprotected String getUniqueId(Object temp) throws javax.jcr.RepositoryException
temp
- the object to get the id ofjavax.jcr.RepositoryException
public int getRowSelectedCount()
ISelectableTableContentProvider
getRowSelectedCount
in interface ISelectableTableContentProvider
public Collection<String> getRowSelectedIds()
ISelectableTableContentProvider
String
ids of the selected rows.
May be empty or contain non-existent ids; never null, never contains null.getRowSelectedIds
in interface ISelectableTableContentProvider
public Collection<String> getRowUnselectedIds()
ISelectableTableContentProvider
String
ids of the un-selected rows
(all other rows are selected implicitly)
May be empty or contain non-existent ids; never null, never contains null.getRowUnselectedIds
in interface ISelectableTableContentProvider
public boolean getUseUnselectedModel()
ISelectableTableContentProvider
ISelectableTableContentProvider.getRowUnselectedIds()
rather than ISelectableTableContentProvider.getRowSelectedIds()
).getUseUnselectedModel
in interface ISelectableTableContentProvider
public boolean isRowSelected()
ISelectableTableContentProvider
true
if current row is selected.isRowSelected
in interface ISelectableTableContentProvider
public void setRowSelected(boolean selected)
ISelectableTableContentProvider
setRowSelected
in interface ISelectableTableContentProvider
selected
- true
to select current row; false
to unselect.public void setRowSelectedIds(Collection ids)
ISelectableTableContentProvider
String
ids of the rows to select.
May be empty or contain non-existent ids; never null, never contains null.setRowSelectedIds
in interface ISelectableTableContentProvider
ids
- the collection of String
row idspublic void setRowUnselectedIds(Collection ids)
ISelectableTableContentProvider
String
ids of the un-selected rows
(all other rows are selected implicitly).
May be empty or contain non-existent ids; never null, never contains null.setRowUnselectedIds
in interface ISelectableTableContentProvider
ids
- collection of String
row idspublic List<Object> getSelectedRows()
provider
- selectable table providerITableContentProvider.getRowCount()
sizepublic ISortInfo getSort()
ISortableTableContentProvider
getSort
in interface ISortableTableContentProvider
public void setSort(ISortInfo sortInfo)
ISortableTableContentProvider
setSort
in interface ISortableTableContentProvider
sortInfo
- Sort info, must not be null.