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
Modifier and TypeFieldDescriptionprotected javax.servlet.ServletContext
protected UrlParamSerializer
-
Constructor Summary
ConstructorDescriptionRouteSupport
(UrlParamSerializer urlParamSerializer, javax.servlet.ServletContext servletContext) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addQueryParameter
(com.vaadin.flow.component.UI ui, String name, Object value) Updates the current url by adding the value of the given query parameter.void
addQueryParameter
(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.QueryParameters
addQueryParameter
(com.vaadin.flow.router.QueryParameters queryParameters, String name, Object value) Creates a newQueryParameters
object by adding to it the value of the given query parameter.com.vaadin.flow.router.QueryParameters
addQueryParameter
(com.vaadin.flow.router.QueryParameters queryParameters, String name, List<Object> values) Creates a newQueryParameters
object by adding to it the value of the given query parameter.convertValues
(List<Object> values) com.vaadin.flow.router.RouteParameters
createRouteParameters
(String param, Object value) CreatesRouteParameters
object which stores a single route parameter with given name and value.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 theLocation
object.com.vaadin.flow.router.QueryParameters
mergeQueryParameters
(com.vaadin.flow.router.QueryParameters... parameters) Creates a newQueryParameters
object by merging passed query parameters into one.resolveLocationString
(URL url) Creates a string containing a relative URL excluding query parameters.com.vaadin.flow.router.QueryParameters
resolveQueryParameters
(String queryString) CreatesQueryParameters
object from a query string.com.vaadin.flow.router.QueryParameters
CreatesQueryParameters
object from the query part of the givenURL
object.void
setQueryParameter
(com.vaadin.flow.component.UI ui, String name, Object value) Updates the current url by setting the value of the given query parameter.void
setQueryParameter
(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.QueryParameters
setQueryParameter
(com.vaadin.flow.router.QueryParameters queryParameters, String name, Object value) Creates a newQueryParameters
object by setting to it the value of the given query parameter.com.vaadin.flow.router.QueryParameters
setQueryParameter
(com.vaadin.flow.router.QueryParameters queryParameters, String name, List<Object> values) Creates a newQueryParameters
object by setting to it the value of the given query parameter.void
setQueryParameters
(com.vaadin.flow.component.UI ui, com.vaadin.flow.router.QueryParameters queryParameters) Overrides the current url query parameters with the values represented byQueryParameters
object.protected void
updateQueryParameters
(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 theLocation
object. The URL is fetched from the browser in another request asynchronously and theLocation
object 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 byQueryParameters
object.- Parameters:
ui
- UI instance for which to update urlqueryParameters
- an object which holds query parameters information
-
createRouteParameters
CreatesRouteParameters
object which stores a single route parameter with given name and value.- Parameters:
param
- the route parameter namevalue
- the route parameter name- Returns:
- an object which stores the route parameters
-
mergeQueryParameters
public com.vaadin.flow.router.QueryParameters mergeQueryParameters(com.vaadin.flow.router.QueryParameters... parameters) Creates a newQueryParameters
object 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
QueryParameters
object 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 newQueryParameters
object 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
- theQueryParameters
object to updatename
- the query parameter namevalue
- the query parameter value- Returns:
- a new
QueryParameters
object 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 newQueryParameters
object 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
- theQueryParameters
object to updatename
- the query parameter namevalues
- the query parameter values- Returns:
- a new
QueryParameters
object 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 newQueryParameters
object 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
- theQueryParameters
object to updatename
- the query parameter namevalue
- the query parameter value- Returns:
- a new
QueryParameters
object 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 newQueryParameters
object 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
- theQueryParameters
object to updatename
- the query parameter namevalues
- the query parameter values- Returns:
- a new
QueryParameters
object which holds query parameters information.
-
resolveLocationString
Creates a string containing a relative URL excluding query parameters.- Parameters:
url
- aURL
object to obtain location- Returns:
- a string representing a relative URL excluding query parameters.
-
resolveQueryParameters
CreatesQueryParameters
object from the query part of the givenURL
object.- Parameters:
url
- aURL
object to obtain query parameters- Returns:
- a
QueryParameters
object which holds query parameters information.
-
resolveQueryParameters
CreatesQueryParameters
object from a query string.- Parameters:
queryString
- a string to parse- Returns:
- a
QueryParameters
object which holds query parameters information.
-
convertValues
-