public class SessionRouteRegistry extends AbstractRouteRegistry
AbstractRouteRegistry.Configuration
Modifier and Type | Method and Description |
---|---|
Registration |
addRoutesChangeListener(RoutesChangedListener listener)
Adds the given route change listener to the registry.
|
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.
|
List<RouteData> |
getRegisteredRoutes()
Get the
RouteData for all registered navigation targets. |
List<Class<? extends RouterLayout>> |
getRouteLayouts(String path,
Class<? extends Component> navigationTarget)
Deprecated.
instead use
getNavigationRouteTarget(String) and
retrieve the list of route layouts from the
RouteTarget contained in the
NavigationRouteTarget . |
RouteTarget |
getRouteTarget(Class<? extends Component> target,
RouteParameters parameters)
Gets the
RouteTarget instance matching the given target component
and route parameters. |
static RouteRegistry |
getSessionRegistry(VaadinSession session)
Get the session registry for VaadinSession.
|
Optional<String> |
getTargetUrl(Class<? extends Component> navigationTarget)
Get the url string for given navigation target.
|
Optional<String> |
getTargetUrl(Class<? extends Component> navigationTarget,
RouteParameters parameters)
Get the url string for given navigation target.
|
Optional<String> |
getTemplate(Class<? extends Component> navigationTarget)
Get the main template for given navigation target.
|
addErrorTarget, clean, configure, fireEvent, getConfiguration, hasLock, removeRoute, removeRoute, removeRoute, searchByCause, searchBySuperType, setRoute, update
public static RouteRegistry getSessionRegistry(VaadinSession session)
session
- vaadin session to get registry forpublic List<RouteData> getRegisteredRoutes()
RouteRegistry
RouteData
for all registered navigation targets.getRegisteredRoutes
in interface RouteRegistry
getRegisteredRoutes
in class AbstractRouteRegistry
public Registration addRoutesChangeListener(RoutesChangedListener listener)
For the session scoped registry also changes to the application scoped registry will be delegated to the listener if the added or removed route was not masked by a registration in the session scope.
addRoutesChangeListener
in interface RouteRegistry
addRoutesChangeListener
in class AbstractRouteRegistry
listener
- listener to addpublic NavigationRouteTarget getNavigationRouteTarget(String url)
RouteRegistry
url
argument.getNavigationRouteTarget
in interface RouteRegistry
getNavigationRouteTarget
in class AbstractRouteRegistry
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.getRouteTarget
in interface RouteRegistry
getRouteTarget
in class AbstractRouteRegistry
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
getNavigationTarget
in interface RouteRegistry
getNavigationTarget
in class AbstractRouteRegistry
url
- the path to get the navigation target for, not null
public Optional<Class<? extends Component>> getNavigationTarget(String url, List<String> segments)
RouteRegistry
getNavigationTarget
in interface RouteRegistry
getNavigationTarget
in class AbstractRouteRegistry
url
- path to get navigation target for, not null
segments
- segments given for pathLocation
public Optional<String> getTargetUrl(Class<? extends Component> navigationTarget)
RouteRegistry
getTargetUrl
in interface RouteRegistry
getTargetUrl
in class AbstractRouteRegistry
navigationTarget
- navigation target to get registered route for, not
null
Optional
navigation target url string or
Optional.empty()
if navigation target was not foundpublic Optional<String> getTargetUrl(Class<? extends Component> navigationTarget, RouteParameters parameters)
RouteRegistry
getTargetUrl
in interface RouteRegistry
getTargetUrl
in class AbstractRouteRegistry
navigationTarget
- navigation target to get registered route for, not
null
parameters
- parameters for the target url.Optional
navigation target url string or
Optional.empty()
if navigation target was not foundpublic Optional<String> getTemplate(Class<? extends Component> navigationTarget)
RouteRegistry
In case of annotated target the main template is composed of the
Route
annotation value prefixed by all RoutePrefix
values
of the parent RouterLayout
s chain.
getTemplate
in interface RouteRegistry
getTemplate
in class AbstractRouteRegistry
navigationTarget
- navigation target to get route definition for, not
null
Optional
navigation target template string or
Optional.empty()
if navigation target was not found@Deprecated public List<Class<? extends RouterLayout>> getRouteLayouts(String path, Class<? extends Component> navigationTarget)
getNavigationRouteTarget(String)
and
retrieve the list of route layouts from the
RouteTarget
contained in the
NavigationRouteTarget
.RouteRegistry
This chain may be pre-defined or generated from annotation data.
getRouteLayouts
in interface RouteRegistry
getRouteLayouts
in class AbstractRouteRegistry
path
- path to use for resolving chainnavigationTarget
- navigation target to get layout chain forRouteTarget.getParentLayouts()
Copyright © 2025. All rights reserved.