T
- Type of data to displaypublic class DataTableManager<T> extends Object implements Serializable
Constructor and Description |
---|
DataTableManager(String strSortUrl,
String strFilterUrl,
int nDefautlItemsPerPage,
boolean bEnablePaginator)
Constructor of the DataTableManager class
|
Modifier and Type | Method and Description |
---|---|
void |
addActionColumn(String strColumnTitle)
Add an column to this DataTableManager that will display actions on items.
|
void |
addBooleanColumn(String strColumnTitle,
String strObjectName,
String strLabelTrue,
String strLabelFalse)
Add a column to this DataTableManager
|
void |
addColumn(String strColumnTitle,
String strObjectName,
boolean bSortable)
Add a column to this DataTableManager
|
void |
addDropDownListFilter(String strParameterName,
String strFilterLabel,
ReferenceList refList)
Add a drop down list filter to the filter panel of this DataTableManager
|
void |
addEmailColumn(String strColumnTitle,
String strObjectName,
boolean bSortable)
Add an email column to this DataTableManager.
|
void |
addFilter(DataTableFilterType filterType,
String strParameterName,
String strFilterLabel)
Add a filter to the filter panel of this DataTableManager
|
void |
addFreeColumn(String strColumnTitle,
String strFreemarkerMacroName)
Add a free column to this DataTableManager.
|
void |
addLabelColumn(String strColumnTitle,
String strObjectName,
boolean bSortable)
Add a label column to this DataTableManager.
|
void |
clearItems()
Clear the items stored by this DataTableManager so that the garbage collector
can free the memory they use.
|
void |
filterSortAndPaginate(javax.servlet.http.HttpServletRequest request,
List<T> items)
Apply filters on an objects list, sort it and update pagination values.
|
<K> K |
getAndUpdateFilter(javax.servlet.http.HttpServletRequest request,
K filterObject)
Get filter properties updated with values in the request
|
DataTablePaginationProperties |
getAndUpdatePaginator(javax.servlet.http.HttpServletRequest request)
Get the paginator updated with values in the request
|
DataTableSort |
getAndUpdateSort(javax.servlet.http.HttpServletRequest request)
Get sort properties updated with values in the request
|
boolean |
getEnablePaginator()
Get the enable paginator boolean
|
FilterPanel |
getFilterPanel()
Get the filter panel of the DataTableManager
|
String |
getFilterPanelPrefix()
Internal method.
|
String |
getId()
Get the unique id of this data table manager
|
List<T> |
getItems()
Get the filtered, sorted and paginated items collection of this
DataTableManager
|
List<DataTableColumn> |
getListColumn()
Get the list of columns of this DataTableManager
|
Locale |
getLocale()
Get the locale
|
IPaginator<T> |
getPaginator()
Internal method.
|
String |
getSortUrl()
Get the sort url of this DataTableManager
|
void |
setFilterPanel(FilterPanel filterPanel)
Set the filter panel of the DataTableManager
|
void |
setItems(List<T> items,
int nTotalItemsNumber)
Set the items to display.
|
void |
setListColumn(List<DataTableColumn> listColumn)
Set the list of columns of this DataTableManager
|
void |
setLocale(Locale locale)
Set the locale
|
void |
setSortUrl(String strSortUrl)
Set the sort url of this DataTableManager
|
public DataTableManager(String strSortUrl, String strFilterUrl, int nDefautlItemsPerPage, boolean bEnablePaginator)
strSortUrl
- URL used by the paginator to sort datastrFilterUrl
- URL used to filter datanDefautlItemsPerPage
- Default number of items to display per pagebEnablePaginator
- True to enable pagination, false to disable itpublic void addColumn(String strColumnTitle, String strObjectName, boolean bSortable)
strColumnTitle
- I18n key of the title of the columnstrObjectName
- Name of the property of objects that should be
displayed in this column.bSortable
- True if the column is sortable, false otherwisepublic void addLabelColumn(String strColumnTitle, String strObjectName, boolean bSortable)
strColumnTitle
- I18n key of the title of the columnstrObjectName
- Name of the property of objects that should be
displayed in this column. This properties must be i18n
keys.bSortable
- True if the column is sortable, false otherwisepublic void addActionColumn(String strColumnTitle)
strColumnTitle
- I18n key of the title of the columnpublic void addBooleanColumn(String strColumnTitle, String strObjectName, String strLabelTrue, String strLabelFalse)
strColumnTitle
- I18n key of the title of the columnstrObjectName
- Name of the property of objects that should be
displayed in this column.strLabelTrue
- I18n key of the label to display when the value is truestrLabelFalse
- I18n key of the label to display when the value is
falsepublic void addFreeColumn(String strColumnTitle, String strFreemarkerMacroName)
strColumnTitle
- I18n key of the title of the columnstrFreemarkerMacroName
- Name of the freemarker macro that will display
the content of the column.public void addEmailColumn(String strColumnTitle, String strObjectName, boolean bSortable)
strColumnTitle
- I18n key of the title of the columnstrObjectName
- Name of the property of objects that should be
displayed in this column.bSortable
- True if the column is sortable, false otherwisepublic void addFilter(DataTableFilterType filterType, String strParameterName, String strFilterLabel)
filterType
- data type of the filter. For drop down list, use
addDropDownListFilter
insteadstrParameterName
- Name of the parameter of the object to filter.strFilterLabel
- Label describing the filterpublic void addDropDownListFilter(String strParameterName, String strFilterLabel, ReferenceList refList)
strParameterName
- Name of the parameter of the object to filter.strFilterLabel
- Label describing the filterrefList
- Reference list containing data of the drop down listpublic void filterSortAndPaginate(javax.servlet.http.HttpServletRequest request, List<T> items)
request
- The requestitems
- Collection of objects to filter, sort and paginatepublic FilterPanel getFilterPanel()
public void setFilterPanel(FilterPanel filterPanel)
filterPanel
- Filter panelpublic List<DataTableColumn> getListColumn()
public void setListColumn(List<DataTableColumn> listColumn)
listColumn
- The list of columns of this DataTableManagerpublic String getSortUrl()
public void setSortUrl(String strSortUrl)
strSortUrl
- The sort url of this DataTableManagerpublic List<T> getItems()
public void setItems(List<T> items, int nTotalItemsNumber)
getAndUpdatePaginator
,
getAndUpdateSort
and
getAndUpdateFilter
must have been called before the generation of the list
of items.items
- The filtered sorted and paginated list of items to
displaynTotalItemsNumber
- The total number of itemspublic void clearItems()
public IPaginator<T> getPaginator()
getAndUpdatePaginator
instead to get up to date values !public boolean getEnablePaginator()
public Locale getLocale()
public void setLocale(Locale locale)
locale
- The localepublic String getId()
public DataTablePaginationProperties getAndUpdatePaginator(javax.servlet.http.HttpServletRequest request)
request
- The requestpublic DataTableSort getAndUpdateSort(javax.servlet.http.HttpServletRequest request)
request
- The requestpublic <K> K getAndUpdateFilter(javax.servlet.http.HttpServletRequest request, K filterObject)
K
- Type of the filter to use. This type must have
accessors for every declared filter.request
- The requestfilterObject
- Filter to apply.public String getFilterPanelPrefix()
Copyright © 2020 City of Paris. All rights reserved.