Class RouteSupport

java.lang.Object
io.jmix.flowui.view.navigation.RouteSupport

@Component("flowui_RouteSupport") public class RouteSupport extends Object
Utility bean that facilitates url modifications and generations.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected javax.servlet.ServletContext
     
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    RouteSupport(UrlParamSerializer urlParamSerializer, javax.servlet.ServletContext servletContext)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    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 new QueryParameters 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 new QueryParameters object by adding to it the value of the given query parameter.
    protected List<String>
     
    com.vaadin.flow.router.RouteParameters
    Creates RouteParameters 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 the Location object.
    com.vaadin.flow.router.QueryParameters
    mergeQueryParameters(com.vaadin.flow.router.QueryParameters... parameters)
    Creates a new QueryParameters object by merging passed query parameters into one.
    Creates a string containing a relative URL excluding query parameters.
    com.vaadin.flow.router.QueryParameters
    Creates QueryParameters object from a query string.
    com.vaadin.flow.router.QueryParameters
    Creates QueryParameters object from the query part of the given URL 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 new QueryParameters 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 new QueryParameters 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 by QueryParameters 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)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • urlParamSerializer

      protected UrlParamSerializer urlParamSerializer
    • servletContext

      protected javax.servlet.ServletContext servletContext
  • Constructor Details

    • RouteSupport

      public RouteSupport(UrlParamSerializer urlParamSerializer, javax.servlet.ServletContext servletContext)
  • 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 the Location object. The URL is fetched from the browser in another request asynchronously and the Location object passed to the callback.
      Parameters:
      ui - UI instance for which to fetch current location
      callback - to be notified when the location is resolved
    • addQueryParameter

      public void addQueryParameter(com.vaadin.flow.component.UI ui, String name, Object value)
      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 url
      name - the query parameter name
      value - the query parameter value
    • addQueryParameter

      public 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. 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 url
      name - the query parameter name
      values - the query parameter values
    • setQueryParameter

      public 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. 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 url
      name - the query parameter name
      value - the query parameter value
    • setQueryParameter

      public 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. 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 url
      name - the query parameter name
      values - the query parameter values
    • updateQueryParameters

      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)
    • 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 by QueryParameters object.
      Parameters:
      ui - UI instance for which to update url
      queryParameters - an object which holds query parameters information
    • createRouteParameters

      public com.vaadin.flow.router.RouteParameters createRouteParameters(String param, Object value)
      Creates RouteParameters object which stores a single route parameter with given name and value.
      Parameters:
      param - the route parameter name
      value - 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 new QueryParameters 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 new QueryParameters 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 - the QueryParameters object to update
      name - the query parameter name
      value - 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 new QueryParameters 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 - the QueryParameters object to update
      name - the query parameter name
      values - 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 new QueryParameters 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 - the QueryParameters object to update
      name - the query parameter name
      value - 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 new QueryParameters 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 - the QueryParameters object to update
      name - the query parameter name
      values - the query parameter values
      Returns:
      a new QueryParameters object which holds query parameters information.
    • resolveLocationString

      public String resolveLocationString(URL url)
      Creates a string containing a relative URL excluding query parameters.
      Parameters:
      url - a URL object to obtain location
      Returns:
      a string representing a relative URL excluding query parameters.
    • resolveQueryParameters

      public com.vaadin.flow.router.QueryParameters resolveQueryParameters(URL url)
      Creates QueryParameters object from the query part of the given URL object.
      Parameters:
      url - a URL object to obtain query parameters
      Returns:
      a QueryParameters object which holds query parameters information.
    • resolveQueryParameters

      public com.vaadin.flow.router.QueryParameters resolveQueryParameters(String queryString)
      Creates QueryParameters object from a query string.
      Parameters:
      queryString - a string to parse
      Returns:
      a QueryParameters object which holds query parameters information.
    • convertValues

      protected List<String> convertValues(List<Object> values)