public class ApplicationRouteRegistry extends AbstractRouteRegistry
Modifier and Type | Class and Description |
---|---|
protected static class |
ApplicationRouteRegistry.ApplicationRouteRegistryWrapper
RouteRegistry wrapper class for storing the ApplicationRouteRegistry.
|
AbstractRouteRegistry.Configuration
Modifier | Constructor and Description |
---|---|
protected |
ApplicationRouteRegistry()
Creates a new uninitialized route registry.
|
Modifier and Type | Method and Description |
---|---|
Optional<ErrorTargetEntry> |
getErrorNavigationTarget(Exception exception)
Get a registered navigation target for given exception.
|
static ApplicationRouteRegistry |
getInstance(VaadinContext context)
Gets the route registry for the given Vaadin context.
|
NavigationRouteTarget |
getNavigationRouteTarget(String url)
Search for a route target using given navigation
url
argument. |
Optional<Class<? extends Component>> |
getNavigationTarget(String url)
Gets the optional navigation target class for a given path.
|
Optional<Class<? extends Component>> |
getNavigationTarget(String url,
List<String> segments)
Gets the optional navigation target class for a given Location matching
with path segments.
|
Class<?> |
getPwaConfigurationClass()
Gets pwa configuration class.
|
RouteTarget |
getRouteTarget(Class<? extends Component> target,
RouteParameters parameters)
Gets the
RouteTarget instance matching the given target component
and route parameters. |
protected void |
handleInitializedRegistry()
Handles an attempt to initialize already initialized route registry.
|
boolean |
hasNavigationTargets()
Check if there are registered navigation targets in the registry.
|
void |
setErrorNavigationTargets(Set<Class<? extends Component>> errorNavigationTargets)
Set error handler navigation targets.
|
void |
setPwaConfigurationClass(Class<?> pwaClass)
Sets pwa configuration class.
|
void |
setRoute(String path,
Class<? extends Component> navigationTarget,
List<Class<? extends RouterLayout>> parentChain)
Register a navigation target with specified path and given parent
layout chain.
|
addErrorTarget, addRoutesChangeListener, clean, configure, fireEvent, getConfiguration, getRegisteredRoutes, getRouteLayouts, getTargetUrl, getTargetUrl, getTemplate, hasLock, removeRoute, removeRoute, removeRoute, searchByCause, searchBySuperType, update
protected ApplicationRouteRegistry()
public static ApplicationRouteRegistry getInstance(VaadinContext context)
context
- the vaadin context for which to get a route registry, not
null
null
public void setRoute(String path, Class<? extends Component> navigationTarget, List<Class<? extends RouterLayout>> parentChain)
RouteRegistry
ParentLayout
, Route
or
RouteAlias
will be ignored in route handling.setRoute
in interface RouteRegistry
setRoute
in class AbstractRouteRegistry
path
- path to register navigation target tonavigationTarget
- navigation target to register into session scopeparentChain
- chain of parent layouts that should be used with this targetpublic void setErrorNavigationTargets(Set<Class<? extends Component>> errorNavigationTargets)
This can also be used to add error navigation targets that override existing targets. Note! The overriding targets need to be extending the existing target or they will throw.
errorNavigationTargets
- error handler navigation targetspublic Optional<ErrorTargetEntry> getErrorNavigationTarget(Exception exception)
exception
- exception to search error view forpublic NavigationRouteTarget getNavigationRouteTarget(String url)
RouteRegistry
url
argument.url
- the navigation url used to search a route target.NavigationRouteTarget
instance containing the
RouteTarget
and RouteParameters
extracted from the
url
argument according with the route configuration.public RouteTarget getRouteTarget(Class<? extends Component> target, RouteParameters parameters)
RouteRegistry
RouteTarget
instance matching the given target component
and route parameters.target
- a component class which is a navigation target.parameters
- parameter values that may be used with given target.RouteTarget
instance matching the given target
component and route parameters.public Optional<Class<? extends Component>> getNavigationTarget(String url)
RouteRegistry
url
- the path to get the navigation target for, not null
public Optional<Class<? extends Component>> getNavigationTarget(String url, List<String> segments)
RouteRegistry
url
- path to get navigation target for, not null
segments
- segments given for pathLocation
public boolean hasNavigationTargets()
public Class<?> getPwaConfigurationClass()
public void setPwaConfigurationClass(Class<?> pwaClass)
AbstractRouteRegistryInitializer
.pwaClass
- a class that has PWA -annotation, that's to be used in service
initialization.protected void handleInitializedRegistry()
Copyright © 2020. All rights reserved.