com.vaadin.flow.router.internal.
Class AbstractNavigationStateRenderer
- java.lang.Object
-
- com.vaadin.flow.router.internal.AbstractNavigationStateRenderer
-
All Implemented Interfaces:
Direct Known Subclasses:
public abstract class AbstractNavigationStateRenderer extends Object implements NavigationHandler
Base class for navigation handlers that target a navigation state.
For internal use only. May be renamed or removed in a future release.
Since:
1.0
Author:
Vaadin Ltd
See Also:
-
-
Constructor Summary
Constructors Constructor Description AbstractNavigationStateRenderer(NavigationState navigationState)
Creates a new renderer for the given navigation state.
-
Method Summary
All Methods Modifier and Type Method Description NavigationState
getNavigationState()
Gets the targeted navigation state.
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.
int
handle(NavigationEvent event)
Handles the navigation event.
protected Optional<Integer>
handleTriggeredBeforeEvent(NavigationEvent event, BeforeEvent beforeEvent)
Handle a
BeforeEvent
after if has been triggered to an observer.protected abstract void
notifyNavigationTarget(Component componentInstance, NavigationEvent navigationEvent, BeforeEnterEvent beforeEnterEvent, LocationChangeEvent locationChangeEvent)
Notify the navigation target about the status of the navigation.
protected void
pushHistoryState(NavigationEvent event)
protected boolean
shouldPushHistoryState(NavigationEvent event)
-
-
-
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 interfaceNavigationHandler
Parameters:
event
- the navigation event to handleReturns:
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 instancenavigationEvent
- the low level navigation event that is being processedbeforeEnterEvent
- the before enter event that will be fired unless navigation is reroutedlocationChangeEvent
- 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 shownrouter
- used router instanceReturns:
a list of parent
RouterLayout
types, notnull
-
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
- theBeforeLeaveEvent
orBeforeEnterEvent
being triggered to an observer.Returns:
an HTTP status code wrapped as an
Optional
. If theOptional
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:
-
-