Package io.jmix.flowui.view.navigation
Class RouteSupport
java.lang.Object
io.jmix.flowui.view.navigation.RouteSupport
Utility bean that facilitates url modifications and generations.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected javax.servlet.ServletContextprotected UrlParamSerializer -
Constructor Summary
ConstructorsConstructorDescriptionRouteSupport(UrlParamSerializer urlParamSerializer, javax.servlet.ServletContext servletContext) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddQueryParameter(com.vaadin.flow.component.UI ui, String name, Object value) Updates the current url by adding the value of the given query parameter.voidaddQueryParameter(com.vaadin.flow.component.UI ui, String name, List<Object> values) Updates the current url by adding the value of the given query parameter.com.vaadin.flow.router.QueryParametersaddQueryParameter(com.vaadin.flow.router.QueryParameters queryParameters, String name, Object value) Creates a newQueryParametersobject by adding to it the value of the given query parameter.com.vaadin.flow.router.QueryParametersaddQueryParameter(com.vaadin.flow.router.QueryParameters queryParameters, String name, List<Object> values) Creates a newQueryParametersobject by adding to it the value of the given query parameter.convertValues(List<Object> values) com.vaadin.flow.router.RouteParameterscreateRouteParameters(String param, Object value) CreatesRouteParametersobject which stores a single route parameter with given name and value.voidfetchCurrentLocation(com.vaadin.flow.component.UI ui, Consumer<com.vaadin.flow.router.Location> callback) Retrieves the current url from the browser and converts it to theLocationobject.com.vaadin.flow.router.QueryParametersmergeQueryParameters(com.vaadin.flow.router.QueryParameters... parameters) Creates a newQueryParametersobject by merging passed query parameters into one.resolveLocationString(URL url) Creates a string containing a relative URL excluding query parameters.com.vaadin.flow.router.QueryParametersresolveQueryParameters(String queryString) CreatesQueryParametersobject from a query string.com.vaadin.flow.router.QueryParametersCreatesQueryParametersobject from the query part of the givenURLobject.voidsetQueryParameter(com.vaadin.flow.component.UI ui, String name, Object value) Updates the current url by setting the value of the given query parameter.voidsetQueryParameter(com.vaadin.flow.component.UI ui, String name, List<Object> values) Updates the current url by setting the value of the given query parameter.com.vaadin.flow.router.QueryParameterssetQueryParameter(com.vaadin.flow.router.QueryParameters queryParameters, String name, Object value) Creates a newQueryParametersobject by setting to it the value of the given query parameter.com.vaadin.flow.router.QueryParameterssetQueryParameter(com.vaadin.flow.router.QueryParameters queryParameters, String name, List<Object> values) Creates a newQueryParametersobject by setting to it the value of the given query parameter.voidsetQueryParameters(com.vaadin.flow.component.UI ui, com.vaadin.flow.router.QueryParameters queryParameters) Overrides the current url query parameters with the values represented byQueryParametersobject.protected voidupdateQueryParameters(com.vaadin.flow.component.UI ui, String name, List<Object> values, org.apache.commons.lang3.function.TriFunction<com.vaadin.flow.router.QueryParameters, String, List<Object>, com.vaadin.flow.router.QueryParameters> updater)
-
Field Details
-
urlParamSerializer
-
servletContext
protected javax.servlet.ServletContext servletContext
-
-
Constructor Details
-
Method Details
-
fetchCurrentLocation
public void fetchCurrentLocation(com.vaadin.flow.component.UI ui, Consumer<com.vaadin.flow.router.Location> callback) Retrieves the current url from the browser and converts it to theLocationobject. The URL is fetched from the browser in another request asynchronously and theLocationobject passed to the callback.- Parameters:
ui- UI instance for which to fetch current locationcallback- to be notified when the location is resolved
-
addQueryParameter
Updates the current url by adding the value of the given query parameter. If a query parameter with the same name already exists, the new value is added excluding duplicates, otherwise the query parameter is added.- Parameters:
ui- UI instance for which to update urlname- the query parameter namevalue- the query parameter value
-
addQueryParameter
Updates the current url by adding the value of the given query parameter. If a query parameter with the same name already exists, the new value is added excluding duplicates, otherwise the query parameter is added.- Parameters:
ui- UI instance for which to update urlname- the query parameter namevalues- the query parameter values
-
setQueryParameter
Updates the current url by setting the value of the given query parameter. If a query parameter with the same name already exists, its value is overridden, otherwise the query parameter is added.- Parameters:
ui- UI instance for which to update urlname- the query parameter namevalue- the query parameter value
-
setQueryParameter
Updates the current url by setting the value of the given query parameter. If a query parameter with the same name already exists, its value is overridden, otherwise the query parameter is added.- Parameters:
ui- UI instance for which to update urlname- the query parameter namevalues- the query parameter values
-
updateQueryParameters
-
setQueryParameters
public void setQueryParameters(com.vaadin.flow.component.UI ui, com.vaadin.flow.router.QueryParameters queryParameters) Overrides the current url query parameters with the values represented byQueryParametersobject.- Parameters:
ui- UI instance for which to update urlqueryParameters- an object which holds query parameters information
-
createRouteParameters
CreatesRouteParametersobject which stores a single route parameter with given name and value.- Parameters:
param- the route parameter namevalue- the route parameter value- Returns:
- an object which stores the route parameters
-
mergeQueryParameters
public com.vaadin.flow.router.QueryParameters mergeQueryParameters(com.vaadin.flow.router.QueryParameters... parameters) Creates a newQueryParametersobject by merging passed query parameters into one. If several objects have the same query parameter information, the latest have precedence.- Parameters:
parameters- query parameters to merge- Returns:
- a new
QueryParametersobject which holds query parameters information.
-
addQueryParameter
public com.vaadin.flow.router.QueryParameters addQueryParameter(com.vaadin.flow.router.QueryParameters queryParameters, String name, Object value) Creates a newQueryParametersobject by adding to it the value of the given query parameter. If a query parameter with the same name already exists, the new value is added excluding duplicates, otherwise the query parameter is added.- Parameters:
queryParameters- theQueryParametersobject to updatename- the query parameter namevalue- the query parameter value- Returns:
- a new
QueryParametersobject which holds query parameters information.
-
addQueryParameter
public com.vaadin.flow.router.QueryParameters addQueryParameter(com.vaadin.flow.router.QueryParameters queryParameters, String name, List<Object> values) Creates a newQueryParametersobject by adding to it the value of the given query parameter. If a query parameter with the same name already exists, the new value is added excluding duplicates, otherwise the query parameter is added.- Parameters:
queryParameters- theQueryParametersobject to updatename- the query parameter namevalues- the query parameter values- Returns:
- a new
QueryParametersobject which holds query parameters information.
-
setQueryParameter
public com.vaadin.flow.router.QueryParameters setQueryParameter(com.vaadin.flow.router.QueryParameters queryParameters, String name, Object value) Creates a newQueryParametersobject by setting to it the value of the given query parameter. If a query parameter with the same name already exists, its value is overridden, otherwise the query parameter is added.- Parameters:
queryParameters- theQueryParametersobject to updatename- the query parameter namevalue- the query parameter value- Returns:
- a new
QueryParametersobject which holds query parameters information.
-
setQueryParameter
public com.vaadin.flow.router.QueryParameters setQueryParameter(com.vaadin.flow.router.QueryParameters queryParameters, String name, List<Object> values) Creates a newQueryParametersobject by setting to it the value of the given query parameter. If a query parameter with the same name already exists, its value is overridden, otherwise the query parameter is added.- Parameters:
queryParameters- theQueryParametersobject to updatename- the query parameter namevalues- the query parameter values- Returns:
- a new
QueryParametersobject which holds query parameters information.
-
resolveLocationString
Creates a string containing a relative URL excluding query parameters.- Parameters:
url- aURLobject to obtain location- Returns:
- a string representing a relative URL excluding query parameters.
-
resolveQueryParameters
CreatesQueryParametersobject from the query part of the givenURLobject.- Parameters:
url- aURLobject to obtain query parameters- Returns:
- a
QueryParametersobject which holds query parameters information.
-
resolveQueryParameters
CreatesQueryParametersobject from a query string.- Parameters:
queryString- a string to parse- Returns:
- a
QueryParametersobject which holds query parameters information.
-
convertValues
-