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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static final recordA POJO class for storing properties of thePaginationComponent's initial state. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringprotected Stringstatic final Stringprotected Stringstatic final Stringprotected PaginationComponent<?>protected UrlParamSerializerFields inherited from class io.jmix.flowui.facet.urlqueryparameters.AbstractUrlQueryParametersBinder
id -
Constructor Summary
ConstructorsConstructorDescriptionPaginationUrlQueryParametersBinder(PaginationComponent<?> pagination, UrlParamSerializer urlParamSerializer) -
Method Summary
Modifier and TypeMethodDescriptionvoidRestores the component to its initial state.com.vaadin.flow.component.ComponentReturns the component associated with this binder.Returns the parameter name used for the "first result" value in pagination.Returns the parameter name used for the "max results" value in pagination.protected Optional<PaginationDataLoader>protected voidinitComponent(PaginationComponent<?> pagination) protected voidvoidSaves component's initial state.serializeQueryParameters(PaginationDataLoader paginationLoader) Serializes query parameters related to pagination into an immutable map.voidsetFirstResultParam(String firstResultParam) Sets the parameter name for the "first result" value used in pagination.voidsetMaxResultsParam(String maxResultsParam) Sets the parameter name for the "max results" value used in pagination.voidupdateState(com.vaadin.flow.router.QueryParameters queryParameters) Informs query parameters binder that view query parameters has been changed.Methods inherited from class io.jmix.flowui.facet.urlqueryparameters.AbstractUrlQueryParametersBinder
addUrlQueryParametersChangeListener, fireQueryParametersChanged, getEventBus, getId, setId
-
Field Details
-
NAME
- See Also:
-
FIRST_RESULT_PARAM
- See Also:
-
MAX_RESULTS_PARAM
- See Also:
-
pagination
-
firstResultParam
-
maxResultsParam
-
initialState
-
urlParamSerializer
-
-
Constructor Details
-
Method Details
-
initComponent
-
saveInitialState
public void saveInitialState()Description copied from interface:HasInitialStateSaves component's initial state.- Specified by:
saveInitialStatein interfaceHasInitialState
-
onAfterRefresh
-
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:HasInitialStateRestores the component to its initial state.- Specified by:
applyInitialStatein interfaceHasInitialState
-
updateState
public void updateState(com.vaadin.flow.router.QueryParameters queryParameters) Description copied from interface:UrlQueryParametersFacet.BinderInforms query parameters binder that view query parameters has been changed.- Specified by:
updateStatein interfaceUrlQueryParametersFacet.Binder- Parameters:
queryParameters- a view query parameters
-
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
Sets the parameter name for the "first result" value used in pagination.- Parameters:
firstResultParam- the custom parameter name to set, ornullto use the default parameter name
-
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
Sets the parameter name for the "max results" value used in pagination.- Parameters:
maxResultsParam- the custom parameter name to set, ornullto use the default parameter name
-
getPaginationLoader
-
getComponent
@Nullable public com.vaadin.flow.component.Component getComponent()Description copied from class:AbstractUrlQueryParametersBinderReturns the component associated with this binder.- Specified by:
getComponentin classAbstractUrlQueryParametersBinder- Returns:
- the component instance if available, or
nullif no component is associated
-