com.infragistics.faces.shared.component
Class DataList

java.lang.Object
  extended byjavax.faces.component.UIComponent
      extended byjavax.faces.component.UIComponentBase
          extended bycom.infragistics.faces.shared.component.DataRepeater
              extended bycom.infragistics.faces.shared.component.DataList
All Implemented Interfaces:
javax.faces.component.NamingContainer, javax.faces.component.StateHolder

public class DataList
extends DataRepeater

This class provides built-in Paging and Sorting capabilities.

Paging
Paging is the ability to navigate to the first/previous/next/last page or more generally to a specific page index. Paging allows to process large amount of data and still provide very fast response time.
Automatic Paging (Default mode)
In this mode, the component automatically handles Paging. To enable automatic paging, simply set the pageSize property by calling the method setPageSize(int).


Custom Paging
This mode gives the possibility to fully control how pages of data are fetched from the DataModel.


Note that Paging can be used in bound AND unbound mode.

Sorting
Automatic Sorting (Default mode)
In this mode, the component automatically handles Sorting. To enable automatic sorting, simply set the sortExpression by calling the method setSortExpressions(SortExpression[]).

Custom Sorting
Just like custom paging, this mode gives the possibility to fully control how the DataModel is sorted (you can for instance query the sorted data directly from the database).


Field Summary
static java.lang.String COMPONENT_FAMILY
           
static java.lang.String COMPONENT_TYPE
           
static java.lang.String RENDERER_TYPE
           
 
Fields inherited from class com.infragistics.faces.shared.component.DataRepeater
DATA_ROW
 
Fields inherited from interface javax.faces.component.NamingContainer
SEPARATOR_CHAR
 
Constructor Summary
DataList()
           
 
Method Summary
 void addPageChangeListener(PageChangeListener listener)
          Register a new PageChangeListener which will be notified of PageChangeEvent
 void addSortListener(SortListener listener)
          Register a new SortListener which will be notified of SortEvent
 void broadcast(javax.faces.event.FacesEvent event)
           
 void firePageChangeEvent(int pageIndex)
          Fire a PageChangeEvent
 void fireSortEvent(SortExpression[] sortExpressions)
          Fire a SortEvent
 java.lang.String getFamily()
           
 int getItemCount()
          Returns the total number of items to display, as follow: If the value has been explicitly set (via a call to setItemCount) , returns it If the component is bound to the DataSource, returns the number of rows in the underlying DataModel otherwise returns the number of child components
 javax.faces.el.MethodBinding getPageChangeListener()
          Returns the MethodBinding pointing at a pageChange listener method to be invoked whenever the user navigates to a different page
 PageChangeListener[] getPageChangeListeners()
          Returns the set of registered PageChangeListener for this component
 int getPageCount()
          Convenient method returning the total number of pages to display.
 int getPageIndex()
          Returns the zero-based index of the page to display
 int getPageSize()
          Returns how many rows are displayed on each page or 0 if all rows should be processed.
 int getSortExpressionIndex(java.lang.String sortBy)
          Returns the index of the SortExpression that matches the specified sortBy
 SortExpression[] getSortExpressions()
          Returns the array of sortExpression that are used to sort items
 javax.faces.el.MethodBinding getSortListener()
          Returns the MethodBinding pointing at a sort listener method to be invoked whenever the sort order of the DataList has changed
 SortListener[] getSortListeners()
          Returns the set of registered SortListener for this component
 boolean isCustomPagingEnabled()
          Returns a boolean indicating whether custom paging is enabled or not
 boolean isCustomSortingEnabled()
          Returns a boolean indicating whether custom sorting is enabled or not
 void removePageChangeListener(PageChangeListener listener)
          Remove an existing PageChangeListener (if any) from the set of listeners interested in being notified in PageChangeEvent.
 void removeSortListener(SortListener listener)
          Remove an existing SortListener (if any) from the set of listeners interested in being notified in SortEvent.
 void restoreState(javax.faces.context.FacesContext context, java.lang.Object state)
           
 java.lang.Object saveState(javax.faces.context.FacesContext context)
           
 void setCustomPagingEnabled(boolean customPaging)
          Sets a boolean indicating whether custom paging is enabled or not
 void setCustomSortingEnabled(boolean customSortingEnabled)
          Sets a boolean indicating whether custom sorting is enabled or not
 void setItemCount(int itemCount)
          Sets the total number of items to display.
 void setPageChangeListener(javax.faces.el.MethodBinding pageChangeListener)
          Sets the MethodBinding pointing at a pageChange listener method to be invoked whenever the user navigates to a different page
 void setPageIndex(int index)
          Sets the zero-based index of the page to display
 void setPageSize(int size)
          Set the number of rows to display on each page or 0 for all rows
 void setSortExpressions(SortExpression[] sortExpressions)
          Sets the array of sortExpression that are used to sort items
 void setSortListener(javax.faces.el.MethodBinding sortListener)
          Sets the MethodBinding pointing at a sort listener method to be invoked whenever the sort order of the DataList has changed
 
Methods inherited from class com.infragistics.faces.shared.component.DataRepeater
dataBind, encodeBegin, encodeEnd, export, getDataKeyName, getDataKeyValue, getDataSource, getTemplateItems, popDataRow, processUpdates, processValidators, pushDataRow, queueEvent, setDataKeyName, setDataSource, setValueBinding
 
Methods inherited from class javax.faces.component.UIComponentBase
decode, encodeChildren, findComponent, getAttributes, getChildCount, getChildren, getClientId, getFacet, getFacets, getFacetsAndChildren, getId, getParent, getRendererType, getRendersChildren, getValueBinding, isRendered, isTransient, processDecodes, processRestoreState, processSaveState, restoreAttachedState, saveAttachedState, setId, setParent, setRendered, setRendererType, setTransient
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COMPONENT_FAMILY

public static java.lang.String COMPONENT_FAMILY

COMPONENT_TYPE

public static java.lang.String COMPONENT_TYPE

RENDERER_TYPE

public static java.lang.String RENDERER_TYPE
Constructor Detail

DataList

public DataList()
Method Detail

getFamily

public java.lang.String getFamily()
Overrides:
getFamily in class DataRepeater

addPageChangeListener

public void addPageChangeListener(PageChangeListener listener)
Register a new PageChangeListener which will be notified of PageChangeEvent


addSortListener

public void addSortListener(SortListener listener)
Register a new SortListener which will be notified of SortEvent


broadcast

public void broadcast(javax.faces.event.FacesEvent event)
               throws javax.faces.event.AbortProcessingException
Overrides:
broadcast in class DataRepeater
Throws:
javax.faces.event.AbortProcessingException

firePageChangeEvent

public void firePageChangeEvent(int pageIndex)
Fire a PageChangeEvent

Parameters:
pageIndex - - the new page index to display

fireSortEvent

public void fireSortEvent(SortExpression[] sortExpressions)
Fire a SortEvent

Parameters:
sortExpressions - - an array of SortExpression

getItemCount

public int getItemCount()
Returns the total number of items to display, as follow: If the value has been explicitly set (via a call to setItemCount) , returns it If the component is bound to the DataSource, returns the number of rows in the underlying DataModel otherwise returns the number of child components

Returns:
item count

getPageChangeListener

public javax.faces.el.MethodBinding getPageChangeListener()
Returns the MethodBinding pointing at a pageChange listener method to be invoked whenever the user navigates to a different page

Returns:
a MethodBinding

getPageChangeListeners

public PageChangeListener[] getPageChangeListeners()
Returns the set of registered PageChangeListener for this component

Returns:
PageChangeListener[]

getPageCount

public int getPageCount()
Convenient method returning the total number of pages to display. (itemCount / pageSize)

Returns:
the total number of pages

getPageIndex

public int getPageIndex()
Returns the zero-based index of the page to display

Returns:
the current page index

getPageSize

public int getPageSize()
Returns how many rows are displayed on each page or 0 if all rows should be processed.

Returns:
the page size

getSortExpressionIndex

public int getSortExpressionIndex(java.lang.String sortBy)
Returns the index of the SortExpression that matches the specified sortBy

Parameters:
sortBy -
Returns:
the index of the SortExpression or -1 if not found

getSortExpressions

public SortExpression[] getSortExpressions()
Returns the array of sortExpression that are used to sort items

Returns:
an array of SortExpression

getSortListener

public javax.faces.el.MethodBinding getSortListener()
Returns the MethodBinding pointing at a sort listener method to be invoked whenever the sort order of the DataList has changed

Returns:
a MethodBinding

getSortListeners

public SortListener[] getSortListeners()
Returns the set of registered SortListener for this component

Returns:
SortListener[]

isCustomPagingEnabled

public boolean isCustomPagingEnabled()
Returns a boolean indicating whether custom paging is enabled or not

Returns:
true if custom paging is enabled otherwise false (default)

isCustomSortingEnabled

public boolean isCustomSortingEnabled()
Returns a boolean indicating whether custom sorting is enabled or not

Returns:
true if custom sorting is enabled otherwise false (default)

removePageChangeListener

public void removePageChangeListener(PageChangeListener listener)
Remove an existing PageChangeListener (if any) from the set of listeners interested in being notified in PageChangeEvent.


removeSortListener

public void removeSortListener(SortListener listener)
Remove an existing SortListener (if any) from the set of listeners interested in being notified in SortEvent.


restoreState

public void restoreState(javax.faces.context.FacesContext context,
                         java.lang.Object state)
Specified by:
restoreState in interface javax.faces.component.StateHolder
Overrides:
restoreState in class DataRepeater

saveState

public java.lang.Object saveState(javax.faces.context.FacesContext context)
Specified by:
saveState in interface javax.faces.component.StateHolder
Overrides:
saveState in class DataRepeater

setCustomPagingEnabled

public void setCustomPagingEnabled(boolean customPaging)
Sets a boolean indicating whether custom paging is enabled or not

Returns:
true or false

setCustomSortingEnabled

public void setCustomSortingEnabled(boolean customSortingEnabled)
Sets a boolean indicating whether custom sorting is enabled or not

Returns:
true or false

setItemCount

public void setItemCount(int itemCount)
Sets the total number of items to display. This method is usually called when the user wishes to overrides the default mechanism used to page through large amount of data.

Parameters:
itemCount -

setPageChangeListener

public void setPageChangeListener(javax.faces.el.MethodBinding pageChangeListener)
Sets the MethodBinding pointing at a pageChange listener method to be invoked whenever the user navigates to a different page

Parameters:
pageChangeListener -

setPageIndex

public void setPageIndex(int index)
Sets the zero-based index of the page to display

Parameters:
index -

setPageSize

public void setPageSize(int size)
Set the number of rows to display on each page or 0 for all rows

Parameters:
size -

setSortExpressions

public void setSortExpressions(SortExpression[] sortExpressions)
Sets the array of sortExpression that are used to sort items

Parameters:
sortExpressions -

setSortListener

public void setSortListener(javax.faces.el.MethodBinding sortListener)
Sets the MethodBinding pointing at a sort listener method to be invoked whenever the sort order of the DataList has changed

Parameters:
sortListener -