Class ViewNavigator

java.lang.Object
io.jmix.flowui.view.navigation.ViewNavigator
Direct Known Subclasses:
DetailViewNavigator, ListViewNavigator

public class ViewNavigator extends Object
Provides a fluent interface to configure navigation parameters and navigate to a View.

An instance of this class should be obtained through ViewNavigators.view(String) or ViewNavigators.view(Class).

  • Field Details

    • handler

      protected final Consumer<ViewNavigator> handler
    • viewId

      protected String viewId
    • viewClass

      protected Class<? extends View> viewClass
    • routeParameters

      protected com.vaadin.flow.router.RouteParameters routeParameters
    • queryParameters

      protected com.vaadin.flow.router.QueryParameters queryParameters
    • backwardNavigation

      protected boolean backwardNavigation
  • Constructor Details

  • Method Details

    • withViewId

      public ViewNavigator withViewId(@Nullable String viewId)
      Sets the opened view by id.
      Parameters:
      viewId - identifier of the view as specified in the ViewController annotation
      Returns:
      this instance for chaining
    • withViewClass

      public ViewNavigator withViewClass(@Nullable Class<? extends View> viewClass)
      Sets the opened view by its class.
      Parameters:
      viewClass - view class
      Returns:
      this instance for chaining
    • withRouteParameters

      public ViewNavigator withRouteParameters(@Nullable com.vaadin.flow.router.RouteParameters routeParameters)
      Sets URL route parameters.
      Parameters:
      routeParameters - route parameters
      Returns:
      this instance for chaining
    • withQueryParameters

      public ViewNavigator withQueryParameters(@Nullable com.vaadin.flow.router.QueryParameters queryParameters)
      Sets URL query parameters.
      Parameters:
      queryParameters - query parameters
      Returns:
      this instance for chaining
    • withBackwardNavigation

      public ViewNavigator withBackwardNavigation(boolean backwardNavigation)
      Sets whether the current url should be navigated to when the opened view is closed.
      Parameters:
      backwardNavigation - whether the current url should be registered for backward navigation
      Returns:
      this instance for chaining
    • getViewId

      public Optional<String> getViewId()
      Returns:
      identifier of the opened view as specified in the ViewController annotation
    • getViewClass

      public Optional<Class<? extends View>> getViewClass()
      Returns:
      opened view class
    • getRouteParameters

      public Optional<com.vaadin.flow.router.RouteParameters> getRouteParameters()
      Returns:
      URL route parameters
    • getQueryParameters

      public Optional<com.vaadin.flow.router.QueryParameters> getQueryParameters()
      Returns:
      URL query parameters
    • isBackwardNavigation

      public boolean isBackwardNavigation()
      Returns:
      whether the current url should be navigated to when the opened view is closed