com.holonplatform.vaadin.navigator.internal

## Class AbstractNavigatorBuilder<B extends ViewNavigator.NavigatorBuilder<B>,C extends com.vaadin.navigator.Navigator & ViewNavigatorAdapter>

- java.lang.Object
- - com.holonplatform.vaadin.navigator.internal.AbstractNavigatorBuilder<B,C>

- All Implemented Interfaces:
    ViewNavigator.NavigatorBuilder<B>
  Direct Known Subclasses:
    DefaultSpringViewNavigator.SpringViewNavigatorBuilder, DefaultViewNavigator.ViewNavigatorBuilder

      public abstract class AbstractNavigatorBuilder<B extends ViewNavigator.NavigatorBuilder<B>,C extends com.vaadin.navigator.Navigator & ViewNavigatorAdapter>
      extends Object
      implements ViewNavigator.NavigatorBuilder<B>

  Base `ViewNavigator.NavigatorBuilder` class.
  Since:
    5.0.0

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractNavigatorBuilder(C navigator)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `B` | `addProvider(com.vaadin.navigator.ViewProvider provider)` Add a `ViewProvider` to navigator.
    `B` | `authenticationEnabled(boolean authenticationEnabled)` Set whether the support for `Authenticate` annotation on `View`s or `UI` is enabled.
    `B` | `defaultViewName(String defaultViewName)` Set the default view name.
    `B` | `defaultViewNavigationStrategy(DefaultViewNavigationStrategy defaultViewNavigationStrategy)` Set the strategy to use to navigate to the default view.
    `B` | `defaultViewWindowConfigurator(Consumer<ViewWindowConfigurator> configurator)` Set the default `ViewWindowConfigurator` consumer to used for all the view Windows created by this navigator.
    `B` | `errorView(com.vaadin.navigator.View errorView)` Set the view to be displayed when no other view matches the navigation state.
    `B` | `errorViewProvider(com.vaadin.navigator.ViewProvider errorViewProvider)` Registers a view provider that is queried for a view when no other view matches the navigation state.
    `B` | `maxNavigationHistorySize(int maxSize)` Set navigation history max size
    `B` | `navigateToDefaultViewWhenViewNotAvailable(boolean navigateToDefaultViewWhenViewNotAvailable)` Set whether to navigate to default view (if setted) when a view is not available from current navigation state
    `B` | `viewClassProvider(com.vaadin.navigator.ViewProvider provider, ViewClassProvider viewClassProvider)` Associate given `ViewClassProvider` to given `ViewProvider`.
    `B` | `withViewChangeListener(com.vaadin.navigator.ViewChangeListener viewChangeListener)` Add a `ViewChangeListener` to Navigator

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

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

- - ### Constructor Detail

    - #### AbstractNavigatorBuilder

          public AbstractNavigatorBuilder(C navigator)

  - ### Method Detail

    - #### maxNavigationHistorySize

          public B maxNavigationHistorySize(int maxSize)

      Description copied from interface: `ViewNavigator.NavigatorBuilder`
      Set navigation history max size
      Specified by:
        `maxNavigationHistorySize` in interface `ViewNavigator.NavigatorBuilder<B extends ViewNavigator.NavigatorBuilder<B>>`
      Parameters:
        `maxSize` - Max size of retained navigation states
      Returns:
        this

    - #### addProvider

          public B addProvider(com.vaadin.navigator.ViewProvider provider)

      Description copied from interface: `ViewNavigator.NavigatorBuilder`
      Add a `ViewProvider` to navigator. Providers are called in order of registration until one that can handle the requested view name is found.
      Specified by:
        `addProvider` in interface `ViewNavigator.NavigatorBuilder<B extends ViewNavigator.NavigatorBuilder<B>>`
      Parameters:
        `provider` - View provider to add (not null)
      Returns:
        this

    - #### viewClassProvider

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

      Description copied from interface: `ViewNavigator.NavigatorBuilder`
      Associate given `ViewClassProvider` to given `ViewProvider`.
      Specified by:
        `viewClassProvider` in interface `ViewNavigator.NavigatorBuilder<B extends ViewNavigator.NavigatorBuilder<B>>`
      Parameters:
        `provider` - View provider (not null)
        `viewClassProvider` - View class provider bound to the given View provider
      Returns:
        this

    - #### defaultViewName

          public B defaultViewName(String defaultViewName)

      Description copied from interface: `ViewNavigator.NavigatorBuilder`
      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.
      Specified by:
        `defaultViewName` in interface `ViewNavigator.NavigatorBuilder<B extends ViewNavigator.NavigatorBuilder<B>>`
      Parameters:
        `defaultViewName` - the default view name to set
      Returns:
        this

    - #### defaultViewNavigationStrategy

          public B defaultViewNavigationStrategy(DefaultViewNavigationStrategy defaultViewNavigationStrategy)

      Description copied from interface: `ViewNavigator.NavigatorBuilder`
      Set the strategy to use to navigate to the default view. If a strategy is configured, the `ViewNavigator.NavigatorBuilder.defaultViewName(String)` is ignored.
      Specified by:
        `defaultViewNavigationStrategy` in interface `ViewNavigator.NavigatorBuilder<B extends ViewNavigator.NavigatorBuilder<B>>`
      Parameters:
        `defaultViewNavigationStrategy` - The strategy to set
      Returns:
        this

    - #### navigateToDefaultViewWhenViewNotAvailable

          public B navigateToDefaultViewWhenViewNotAvailable(boolean navigateToDefaultViewWhenViewNotAvailable)

      Description copied from interface: `ViewNavigator.NavigatorBuilder`
      Set whether to navigate to default view (if setted) when a view is not available from current navigation state
      Specified by:
        `navigateToDefaultViewWhenViewNotAvailable` in interface `ViewNavigator.NavigatorBuilder<B extends ViewNavigator.NavigatorBuilder<B>>`
      Parameters:
        `navigateToDefaultViewWhenViewNotAvailable` - `true` to navigate to default view (if setted) when a view is not available from current navigation state
      Returns:
        this

    - #### defaultViewWindowConfigurator

          public B defaultViewWindowConfigurator(Consumer<ViewWindowConfigurator> configurator)

      Description copied from interface: `ViewNavigator.NavigatorBuilder`
      Set the default `ViewWindowConfigurator` consumer to used for all the view Windows created by this navigator.
      Specified by:
        `defaultViewWindowConfigurator` in interface `ViewNavigator.NavigatorBuilder<B extends ViewNavigator.NavigatorBuilder<B>>`
      Parameters:
        `configurator` - View window configurator
      Returns:
        this

    - #### errorView

          public B errorView(com.vaadin.navigator.View errorView)

      Description copied from interface: `ViewNavigator.NavigatorBuilder`
      Set the view to be displayed when no other view matches the navigation state.
      Specified by:
        `errorView` in interface `ViewNavigator.NavigatorBuilder<B extends ViewNavigator.NavigatorBuilder<B>>`
      Parameters:
        `errorView` - Error view
      Returns:
        this

    - #### errorViewProvider

          public B errorViewProvider(com.vaadin.navigator.ViewProvider errorViewProvider)

      Description copied from interface: `ViewNavigator.NavigatorBuilder`
      Registers a view provider that is queried for a view when no other view matches the navigation state. An error view provider should match any navigation state, but could return different views for different states. Its `getViewName(String navigationState)` should return `navigationState`.
      Specified by:
        `errorViewProvider` in interface `ViewNavigator.NavigatorBuilder<B extends ViewNavigator.NavigatorBuilder<B>>`
      Parameters:
        `errorViewProvider` - Error view provider
      Returns:
        this

    - #### withViewChangeListener

          public B withViewChangeListener(com.vaadin.navigator.ViewChangeListener viewChangeListener)

      Description copied from interface: `ViewNavigator.NavigatorBuilder`
      Add a `ViewChangeListener` to Navigator
      Specified by:
        `withViewChangeListener` in interface `ViewNavigator.NavigatorBuilder<B extends ViewNavigator.NavigatorBuilder<B>>`
      Parameters:
        `viewChangeListener` - ViewChangeListener to add
      Returns:
        this

    - #### authenticationEnabled

          public B authenticationEnabled(boolean authenticationEnabled)

      Description copied from interface: `ViewNavigator.NavigatorBuilder`
      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 `Authenticate.redirectURI()` attribute if a URI scheme is not specified.

      The authentication support is enabled by default.

      Specified by:
        `authenticationEnabled` in interface `ViewNavigator.NavigatorBuilder<B extends ViewNavigator.NavigatorBuilder<B>>`
      Parameters:
        `authenticationEnabled` - `true` to enable the `Authenticate` support, `false` to disable.
      Returns:
        this

Copyright © 2019 The Holon Platform. All rights reserved.