Class AbstractNavigationStateRenderer

    • Constructor Detail

      • AbstractNavigationStateRenderer

        public AbstractNavigationStateRenderer​(NavigationState navigationState)
        Creates a new renderer for the given navigation state.
        Parameters:
        navigationState - the target navigation state
    • Method Detail

      • getNavigationState

        public NavigationState getNavigationState()
        Gets the targeted navigation state.
        Returns:
        the targeted navigation state
      • handle

        public int handle​(NavigationEvent event)
        Description copied from interface: NavigationHandler
        Handles the navigation event.
        Specified by:
        handle in interface NavigationHandler
        Parameters:
        event - the navigation event to handle
        Returns:
        the HTTP status code to return to the client if handling an initial rendering request
      • pushHistoryState

        protected void pushHistoryState​(NavigationEvent event)
      • shouldPushHistoryState

        protected boolean shouldPushHistoryState​(NavigationEvent event)
      • notifyNavigationTarget

        protected abstract void notifyNavigationTarget​(Component componentInstance,
                                                       NavigationEvent navigationEvent,
                                                       BeforeEnterEvent beforeEnterEvent,
                                                       LocationChangeEvent locationChangeEvent)
        Notify the navigation target about the status of the navigation.
        Parameters:
        componentInstance - the navigation target instance
        navigationEvent - the low level navigation event that is being processed
        beforeEnterEvent - the before enter event that will be fired unless navigation is rerouted
        locationChangeEvent - the location change event that will be fired unless navigation is rerouted
      • getRouterLayoutTypes

        protected abstract List<Class<? extends RouterLayout>> getRouterLayoutTypes​(Class<? extends Component> routeTargetType,
                                                                                    Router router)
        Gets the router layout types to show for the given route target type, starting from the parent layout immediately wrapping the route target type.
        Parameters:
        routeTargetType - component type that will be shown
        router - used router instance
        Returns:
        a list of parent RouterLayout types, not null
      • handleTriggeredBeforeEvent

        protected Optional<Integer> handleTriggeredBeforeEvent​(NavigationEvent event,
                                                               BeforeEvent beforeEvent)
        Handle a BeforeEvent after if has been triggered to an observer.
        Parameters:
        event - the navigation event being handled.
        beforeEvent - the BeforeLeaveEvent or BeforeEnterEvent being triggered to an observer.
        Returns:
        an HTTP status code wrapped as an Optional. If the Optional is empty, the process will proceed with next observer or just move forward, otherwise the process will return immediately with the provided http code.
        See Also:
        HttpStatusCode