Package fr.paris.lutece.portal.web.util
Class SimplePager<S,T>
java.lang.Object
fr.paris.lutece.portal.web.util.SimplePager<S,T>
- Type Parameters:
S-T-
- All Implemented Interfaces:
IPager<S,,T> Serializable
Simple implementation of the IPager
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionSimplePager(String strName, String strListBookmark, String strBaseUrl, int nDefaultItemsPerPage) -
Method Summary
Modifier and TypeMethodDescriptionList<?>getItemsPerPage(int nPage) getName()Retrieves the optional paginator instance associated with this pager.populateModels(jakarta.servlet.http.HttpServletRequest request, Models models, fr.paris.lutece.util.function.SerializableFunction<List<S>, List<T>> delegate, Locale locale) Populates the given Models object with pagination data using a delegate function.populateModels(jakarta.servlet.http.HttpServletRequest request, Models models, Locale locale) Populates the given Models object with pagination data.withBaseUrl(String baseUrl) Allows to update the base url of the pager in case this url should be dynamic.withIdList(List<S> idList) Sets the list of IDs of type.withItemsPerPage(int defaultItemsPerPage) Sets the default number of items per page.withListItem(List<S> list) Sets the list of items directly.
-
Constructor Details
-
SimplePager
-
-
Method Details
-
getName
-
withBaseUrl
Description copied from interface:IPagerAllows to update the base url of the pager in case this url should be dynamic.- Specified by:
withBaseUrlin interfaceIPager<S,T> - Returns:
- The IPager instance with the updated base URL
-
withItemsPerPage
Description copied from interface:IPagerSets the default number of items per page.- Specified by:
withItemsPerPagein interfaceIPager<S,T> - Parameters:
defaultItemsPerPage- The default number of items per page.- Returns:
- The updated IPager instance.
-
withIdList
Description copied from interface:IPagerSets the list of IDs of type. This list will be used to load the objects of typethrough the `getPaginatedListModel` method with a delegate function. - Specified by:
withIdListin interfaceIPager<S,T> - Parameters:
idList- The list of IDs to set.- Returns:
- The updated IPager instance.
-
withListItem
Description copied from interface:IPagerSets the list of items directly. This method should be used when the pager is of type `IPager<S, Void>` and no delegate function is involved during page retrieval.- Specified by:
withListItemin interfaceIPager<S,T> - Parameters:
list- The list of items to set.- Returns:
- The updated IPager instance.
-
populateModels
public IPaginator<S> populateModels(jakarta.servlet.http.HttpServletRequest request, Models models, Locale locale) Description copied from interface:IPagerPopulates the given Models object with pagination data.- Specified by:
populateModelsin interfaceIPager<S,T> - Parameters:
request- The HTTP request object.models- The Models object to populate.locale- The locale for internationalization.
-
populateModels
public IPaginator<S> populateModels(jakarta.servlet.http.HttpServletRequest request, Models models, fr.paris.lutece.util.function.SerializableFunction<List<S>, List<T>> delegate, Locale locale) Description copied from interface:IPagerPopulates the given Models object with pagination data using a delegate function.- Specified by:
populateModelsin interfaceIPager<S,T> - Parameters:
request- The HTTP request object.models- The Models object to populate.delegate- A function that takes a list of source objects and returns a list of target objects.locale- The locale for internationalization.
-
getItemsPerPage
-
getPaginator
Description copied from interface:IPagerRetrieves the optional paginator instance associated with this pager.- Specified by:
getPaginatorin interfaceIPager<S,T> - Returns:
- An
Optionalcontaining theIPaginatorinstance if available, or an emptyOptionalif not.
-