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

public class SimplePager<S,T> extends Object implements IPager<S,T>, Serializable
Simple implementation of the IPager
See Also:
  • Constructor Details

    • SimplePager

      public SimplePager(String strName, String strListBookmark, String strBaseUrl, int nDefaultItemsPerPage)
  • Method Details

    • getName

      public String getName()
    • withBaseUrl

      public IPager<S,T> withBaseUrl(String baseUrl)
      Description copied from interface: IPager
      Allows to update the base url of the pager in case this url should be dynamic.
      Specified by:
      withBaseUrl in interface IPager<S,T>
      Returns:
      The IPager instance with the updated base URL
    • withItemsPerPage

      public IPager<S,T> withItemsPerPage(int defaultItemsPerPage)
      Description copied from interface: IPager
      Sets the default number of items per page.
      Specified by:
      withItemsPerPage in interface IPager<S,T>
      Parameters:
      defaultItemsPerPage - The default number of items per page.
      Returns:
      The updated IPager instance.
    • withIdList

      public IPager<S,T> withIdList(List<S> idList)
      Description copied from interface: IPager
      Sets the list of IDs of type . This list will be used to load the objects of type through the `getPaginatedListModel` method with a delegate function.
      Specified by:
      withIdList in interface IPager<S,T>
      Parameters:
      idList - The list of IDs to set.
      Returns:
      The updated IPager instance.
    • withListItem

      public IPager<S,T> withListItem(List<S> list)
      Description copied from interface: IPager
      Sets 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:
      withListItem in interface IPager<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: IPager
      Populates the given Models object with pagination data.
      Specified by:
      populateModels in interface IPager<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: IPager
      Populates the given Models object with pagination data using a delegate function.
      Specified by:
      populateModels in interface IPager<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

      public List<?> getItemsPerPage(int nPage)
    • getPaginator

      public Optional<IPaginator<S>> getPaginator()
      Description copied from interface: IPager
      Retrieves the optional paginator instance associated with this pager.
      Specified by:
      getPaginator in interface IPager<S,T>
      Returns:
      An Optional containing the IPaginator instance if available, or an empty Optional if not.