Class PaginationUrlQueryParametersBinder

java.lang.Object
io.jmix.flowui.facet.urlqueryparameters.AbstractUrlQueryParametersBinder
io.jmix.flowui.facet.urlqueryparameters.PaginationUrlQueryParametersBinder
All Implemented Interfaces:
HasInitialState, UrlQueryParametersFacet.Binder

public class PaginationUrlQueryParametersBinder extends AbstractUrlQueryParametersBinder implements HasInitialState
Handles the binding of pagination-related URL query parameters with a PaginationComponent. This allows synchronization between the component's state and the URL query parameters, facilitating state persistence and navigation.

The binder observes the pagination component's state changes and updates the URL query parameters accordingly. It also enables restoring the pagination state from preserved URL parameters.

  • Field Details

  • Constructor Details

  • Method Details

    • initComponent

      protected void initComponent(PaginationComponent<?> pagination)
    • saveInitialState

      public void saveInitialState()
      Description copied from interface: HasInitialState
      Saves component's initial state.
      Specified by:
      saveInitialState in interface HasInitialState
    • onAfterRefresh

      protected void onAfterRefresh(PaginationComponent.AfterRefreshEvent<?> event)
    • serializeQueryParameters

      public com.google.common.collect.ImmutableMap<String,String> serializeQueryParameters(PaginationDataLoader paginationLoader)
      Serializes query parameters related to pagination into an immutable map.
      Parameters:
      paginationLoader - the pagination data loader containing the pagination parameters
      Returns:
      an immutable map where the keys are the parameter names (e.g., "firstResult" and "maxResults") and the values are the serialized representations of the respective pagination values
    • applyInitialState

      public void applyInitialState()
      Description copied from interface: HasInitialState
      Restores the component to its initial state.
      Specified by:
      applyInitialState in interface HasInitialState
    • updateState

      public void updateState(com.vaadin.flow.router.QueryParameters queryParameters)
      Description copied from interface: UrlQueryParametersFacet.Binder
      Informs query parameters binder that view query parameters has been changed.
      Specified by:
      updateState in interface UrlQueryParametersFacet.Binder
      Parameters:
      queryParameters - a view query parameters
    • getFirstResultParam

      public String getFirstResultParam()
      Returns the parameter name used for the "first result" value in pagination. If the custom parameter name is not specified, a default parameter name is returned.
      Returns:
      the parameter name for the "first result" value, either a custom or default value
    • setFirstResultParam

      public void setFirstResultParam(@Nullable String firstResultParam)
      Sets the parameter name for the "first result" value used in pagination.
      Parameters:
      firstResultParam - the custom parameter name to set, or null to use the default parameter name
    • getMaxResultsParam

      public String getMaxResultsParam()
      Returns the parameter name used for the "max results" value in pagination. If the custom parameter name is not specified, a default parameter name is returned.
      Returns:
      the parameter name for the "max results" value, either a custom or default value
    • setMaxResultsParam

      public void setMaxResultsParam(@Nullable String maxResultsParam)
      Sets the parameter name for the "max results" value used in pagination.
      Parameters:
      maxResultsParam - the custom parameter name to set, or null to use the default parameter name
    • getPaginationLoader

      protected Optional<PaginationDataLoader> getPaginationLoader()
    • getComponent

      @Nullable public com.vaadin.flow.component.Component getComponent()
      Description copied from class: AbstractUrlQueryParametersBinder
      Returns the component associated with this binder.
      Specified by:
      getComponent in class AbstractUrlQueryParametersBinder
      Returns:
      the component instance if available, or null if no component is associated