com.holonplatform.vaadin.navigator.internal

## Class NavigatorActuator<N extends com.vaadin.navigator.Navigator & ViewNavigatorAdapter>

- java.lang.Object
- - com.holonplatform.vaadin.navigator.internal.NavigatorActuator<N>

- All Implemented Interfaces:
    com.vaadin.navigator.ViewDisplay, Serializable

      public class NavigatorActuator<N extends com.vaadin.navigator.Navigator & ViewNavigatorAdapter>
      extends Object
      implements com.vaadin.navigator.ViewDisplay

  Adds `ViewNavigator` specific logic to a `Navigator`
  Since:
    5.0.0
  See Also:
    `ViewNavigator`, `DefaultViewNavigator`, Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `DEFAULT_NAVIGATION_HISTORY_LIMIT` Default navigation history limit

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `NavigatorActuator(N navigator)` Constructor

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `com.vaadin.navigator.ViewProvider` | `addViewProvider(com.vaadin.navigator.ViewProvider provider)` Register and adapt a `ViewProvider`
    `String` | `buildNavigationState(String viewName, Map<String,Object> parameters)` Build a full navigation state String using given `viewName` and appending any parameter in serialized form
    `String` | `getCurrentViewName()` Get current (active) view name in navigator
    `com.vaadin.navigator.ViewDisplay` | `getDefaultViewDisplay()` Default view display, i.e.
    `String` | `getDefaultViewName()` Get the optional default view name.
    `DefaultViewNavigationStrategy` | `getDefaultViewNavigationStrategy()` Get the navigation strategy to use to navigate to the default view.
    `Consumer<ViewWindowConfigurator>` | `getDefaultViewWindowConfigurator()` Get the default view window configurator.
    `Optional<ViewClassProvider>` | `getViewClassProvider(com.vaadin.navigator.ViewProvider provider)` Get the `ViewClassProvider` bound to given `ViewProvider`, if available.
    `ViewConfiguration` | `getViewConfiguration(Class<? extends com.vaadin.navigator.View> viewClass)` Get the `ViewConfiguration` which corresponds to given `View` class.
    `Optional<ViewConfiguration>` | `getViewConfiguration(String navigationState)` Get the `ViewConfiguration` which corresponds to the `View` represented by the given `navigationState`, if available.
    `com.vaadin.navigator.ViewDisplay` | `initNavigator(com.vaadin.ui.UI ui, com.vaadin.navigator.ViewDisplay display)` Init actuator
    `boolean` | `isAuthenticationEnabled()` Get whether the support for `Authenticate` annotation on `View`s or `UI` is enabled.
    `boolean` | `isNavigateToDefaultViewWhenViewNotAvailable()` Gets whether to navigate to default view (if setted) when a view is not available from current navigation state
    `boolean` | `navigateBack()` Navigate to previous View, if available
    `com.vaadin.ui.Window` | `navigateInWindow(String viewName, Consumer<ViewWindowConfigurator> windowConfiguration, Map<String,Object> parameters)` Navigate to the `View` identified by given `viewName` using the same behaviour of `navigateTo(String)` but rendering the View contents in an application Window, using optional `windowConfiguration` to setup Window features.
    `void` | `navigateTo(String navigationState)` Navigate to given navigation state
    `void` | `navigateTo(com.vaadin.navigator.View view, String viewName, String parameters)` Navigate to given View
    `void` | `navigateToDefault()` Navigate to default View, if available
    `void` | `postUpdateNavigationState(com.vaadin.navigator.ViewChangeListener.ViewChangeEvent event)` Method to call after navigation state update
    `void` | `preAfterViewChange(com.vaadin.navigator.ViewChangeListener.ViewChangeEvent event)`
    `com.vaadin.navigator.ViewProvider` | `removeViewProvider(com.vaadin.navigator.ViewProvider provider)` Unregister a `ViewProvider`
    `void` | `setAuthenticationEnabled(boolean authenticationEnabled)` Set whether the support for `Authenticate` annotation on `View`s or `UI` is enabled.
    `void` | `setDefaultViewName(String defaultViewName)` Set the default view name.
    `void` | `setDefaultViewNavigationStrategy(DefaultViewNavigationStrategy defaultViewNavigationStrategy)` Set the navigation strategy to use to navigate to the default view.
    `void` | `setDefaultViewWindowConfigurator(Consumer<ViewWindowConfigurator> defaultViewWindowConfigurator)` Set the default view window configurator
    `void` | `setMaxNavigationHistorySize(int maxSize)` Set navigation history max size
    `void` | `setNavigateToDefaultViewWhenViewNotAvailable(boolean navigateToDefaultViewWhenViewNotAvailable)` Set whether to navigate to default view (if setted) when a view is not available from current navigation state
    `void` | `setViewClassProvider(com.vaadin.navigator.ViewProvider provider, ViewClassProvider viewClassProvider)` Set the `ViewClassProvider` bound to given `ViewProvider`.
    `void` | `showView(com.vaadin.navigator.View view)`

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### DEFAULT_NAVIGATION_HISTORY_LIMIT

          public static final int DEFAULT_NAVIGATION_HISTORY_LIMIT

      Default navigation history limit
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### NavigatorActuator

          public NavigatorActuator(N navigator)

      Constructor
      Parameters:
        `navigator` - Concrete Navigator

  - ### Method Detail

    - #### initNavigator

          public com.vaadin.navigator.ViewDisplay initNavigator(com.vaadin.ui.UI ui,
                                                                com.vaadin.navigator.ViewDisplay display)

      Init actuator
      Parameters:
        `ui` - Navigator UI
        `display` - Navigator ViewDisplay
      Returns:
        ViewDisplay to use with concrete Navigator

    - #### getDefaultViewDisplay

          public com.vaadin.navigator.ViewDisplay getDefaultViewDisplay()

      Default view display, i.e. the ViewDisplay to use to display Views when is not requested to display View in a Window
      Returns:
        the defaultViewDisplay Default ViewDisplay

    - #### showView

          public void showView(com.vaadin.navigator.View view)

      Specified by:
        `showView` in interface `com.vaadin.navigator.ViewDisplay`

    - #### setMaxNavigationHistorySize

          public void setMaxNavigationHistorySize(int maxSize)

      Set navigation history max size
      Parameters:
        `maxSize` - Max size of retained navigation fragments

    - #### addViewProvider

          public com.vaadin.navigator.ViewProvider addViewProvider(com.vaadin.navigator.ViewProvider provider)

      Register and adapt a `ViewProvider`
      Parameters:
        `provider` - ViewProvider to add
      Returns:
        Adapted view provider

    - #### removeViewProvider

          public com.vaadin.navigator.ViewProvider removeViewProvider(com.vaadin.navigator.ViewProvider provider)

      Unregister a `ViewProvider`
      Parameters:
        `provider` - ViewProvider to remove
      Returns:
        Adapted view provider

    - #### setViewClassProvider

          public void setViewClassProvider(com.vaadin.navigator.ViewProvider provider,
                                           ViewClassProvider viewClassProvider)

      Set the `ViewClassProvider` bound to given `ViewProvider`.
      Parameters:
        `provider` - View provider (not null)
        `viewClassProvider` - View class provider

    - #### getViewClassProvider

          public Optional<ViewClassProvider> getViewClassProvider(com.vaadin.navigator.ViewProvider provider)

      Get the `ViewClassProvider` bound to given `ViewProvider`, if available.
      Parameters:
        `provider` - View provider
      Returns:
        Optional view class provider

    - #### isNavigateToDefaultViewWhenViewNotAvailable

          public boolean isNavigateToDefaultViewWhenViewNotAvailable()

      Gets whether to navigate to default view (if setted) when a view is not available from current navigation state
      Returns:
        `true` to navigate to default view (if setted) when a view is not available from current navigation state

    - #### setNavigateToDefaultViewWhenViewNotAvailable

          public void setNavigateToDefaultViewWhenViewNotAvailable(boolean navigateToDefaultViewWhenViewNotAvailable)

      Set whether to navigate to default view (if setted) when a view is not available from current navigation state
      Parameters:
        `navigateToDefaultViewWhenViewNotAvailable` - `true` to navigate to default view (if setted) when a view is not available from current navigation state

    - #### getDefaultViewWindowConfigurator

          public Consumer<ViewWindowConfigurator> getDefaultViewWindowConfigurator()

      Get the default view window configurator.
      Returns:
        the default view window configurator, `null` if not available

    - #### setDefaultViewWindowConfigurator

          public void setDefaultViewWindowConfigurator(Consumer<ViewWindowConfigurator> defaultViewWindowConfigurator)

      Set the default view window configurator
      Parameters:
        `defaultViewWindowConfigurator` - the default view window configurator to set

    - #### navigateTo

          public void navigateTo(String navigationState)

      Navigate to given navigation state
      Parameters:
        `navigationState` - Navigation state

    - #### navigateTo

          public void navigateTo(com.vaadin.navigator.View view,
                                 String viewName,
                                 String parameters)

      Navigate to given View
      Parameters:
        `view` - View instance
        `viewName` - View name
        `parameters` - View parameters

    - #### navigateBack

          public boolean navigateBack()
                               throws ViewNavigator.ViewNavigationException

      Navigate to previous View, if available
      Returns:
        true if back navigation succeded
      Throws:
        `ViewNavigator.ViewNavigationException` - Navigation error

    - #### navigateToDefault

          public void navigateToDefault()
                                 throws ViewNavigator.ViewNavigationException

      Navigate to default View, if available
      Throws:
        `ViewNavigator.ViewNavigationException` - Navigation error

    - #### navigateInWindow

          public com.vaadin.ui.Window navigateInWindow(String viewName,
                                                       Consumer<ViewWindowConfigurator> windowConfiguration,
                                                       Map<String,Object> parameters)
                                                throws ViewNavigator.ViewNavigationException

      Navigate to the `View` identified by given `viewName` using the same behaviour of `navigateTo(String)` but rendering the View contents in an application Window, using optional `windowConfiguration` to setup Window features.
      Parameters:
        `viewName` - View name
        `windowConfiguration` - Optional Window configurator
        `parameters` - Optional view parameters
      Returns:
        The UI Window in which the View is displayed
      Throws:
        `ViewNavigator.ViewNavigationException` - View with given name cannot be found or other view handling error

    - #### postUpdateNavigationState

          public void postUpdateNavigationState(com.vaadin.navigator.ViewChangeListener.ViewChangeEvent event)

      Method to call after navigation state update
      Parameters:
        `event` - View change event

    - #### preAfterViewChange

          public void preAfterViewChange(com.vaadin.navigator.ViewChangeListener.ViewChangeEvent event)

    - #### getDefaultViewName

          public String getDefaultViewName()

      Get the optional default view name. If a `View` with given `defaultViewName` is valid and provided by registered ViewProviders, it is used as target of `ViewNavigator.navigateToDefault()` method and as a fallback by `ViewNavigator.navigateBack()` method if no other View is available in history.
      Returns:
        Default view name

    - #### setDefaultViewName

          public void setDefaultViewName(String defaultViewName)

      Set the default view name. If a `View` with given `defaultViewName` is valid and provided by registered ViewProviders, it is used as target of `ViewNavigator.navigateToDefault()` method and as a fallback by `ViewNavigator.navigateBack()` method if no other View is available in history.
      Parameters:
        `defaultViewName` - the default view name to set

    - #### getDefaultViewNavigationStrategy

          public DefaultViewNavigationStrategy getDefaultViewNavigationStrategy()

      Get the navigation strategy to use to navigate to the default view.
      Returns:
        the defaultViewNavigationStrategy The default view navigation strategy, `null` if not configured

    - #### setDefaultViewNavigationStrategy

          public void setDefaultViewNavigationStrategy(DefaultViewNavigationStrategy defaultViewNavigationStrategy)

      Set the navigation strategy to use to navigate to the default view.
      Parameters:
        `defaultViewNavigationStrategy` - the default view navigation strategy to set

    - #### getCurrentViewName

          public String getCurrentViewName()

      Get current (active) view name in navigator
      Returns:
        Current view name, or `null` if no view is currently active in navigator

    - #### isAuthenticationEnabled

          public boolean isAuthenticationEnabled()

      Get whether the support for `Authenticate` annotation on `View`s or `UI` is enabled.
      Returns:
        `true` if the support for `Authenticate` annotation on `View`s or `UI` is enabled
      See Also:
        `setAuthenticationEnabled(boolean)`

    - #### setAuthenticationEnabled

          public void setAuthenticationEnabled(boolean authenticationEnabled)

      Set whether the support for `Authenticate` annotation on `View`s or `UI` is enabled.

      If enabled, the navigator will check the `Authenticate` annotation on `View`s or `UI` during navigation, and if present, requires the presence of an authenticated `AuthContext` obtained through `AuthContext.getCurrent()`. If an `AuthContext` is present but not authenticated, try to perform authentication using current `VaadinRequest` and the optional authentication schemes specified using `Authenticate.schemes()`. If the authentication is not successfull and a valid redirect URI is provided through `Authenticate.redirectURI()`, the navigation is redirected to that URI. If the URI does not specify a scheme, or the scheme is equal to `view://`, the navigation is redirected to the navigation state following the `view://` scheme or to the navigation state equal to the

      The authentication support is enabled by default.

      `Authenticate.redirectURI()` attribute if a URI scheme is not specified.
      Parameters:
        `authenticationEnabled` - `true` to enable the `Authenticate` support, `false` to disable.

    - #### buildNavigationState

          public String buildNavigationState(String viewName,
                                             Map<String,Object> parameters)

      Build a full navigation state String using given `viewName` and appending any parameter in serialized form
      Parameters:
        `viewName` - View name
        `parameters` - View parameters
      Returns:
        Navigation state String

    - #### getViewConfiguration

          public ViewConfiguration getViewConfiguration(Class<? extends com.vaadin.navigator.View> viewClass)

      Get the `ViewConfiguration` which corresponds to given `View` class.
      Parameters:
        `viewClass` - View class
      Returns:
        The View configuration

    - #### getViewConfiguration

          public Optional<ViewConfiguration> getViewConfiguration(String navigationState)

      Get the `ViewConfiguration` which corresponds to the `View` represented by the given `navigationState`, if available.
      Parameters:
        `navigationState` - Navigation state
      Returns:
        Optional `ViewConfiguration`

Copyright © 2019 The Holon Platform. All rights reserved.