public final class RouterUtil extends Object
Modifier and Type | Method and Description |
---|---|
static void |
checkForDuplicates(Class<? extends Component> routeTargetType,
Collection<Class<? extends RouterLayout>> routeLayoutTypes)
Checks that the same component type is not used in multiple parts of a
route chain.
|
static LocationChangeEvent |
createEvent(NavigationEvent event,
List<HasElement> routeTargetChain)
Create a new location change event for given navigation event and chain.
|
static List<Class<? extends RouterLayout>> |
getParentLayouts(Class<?> component)
Get parent layouts for navigation target
Route annotation. |
static List<Class<? extends RouterLayout>> |
getParentLayouts(Class<?> component,
String path)
Get parent layouts for navigation target according to the
Route
or RouteAlias annotation. |
static List<Class<? extends RouterLayout>> |
getParentLayoutsForNonRouteTarget(Class<?> navigationTarget)
Collect possible route parent layouts for a navigation target that is not
annotated with
Route nor RouteAlias , but may still
contain ParentLayout . |
static String |
getRouteAliasPath(Class<?> component,
RouteAlias alias)
Get the actual route path including all parent layout
RoutePrefix . |
static String |
getRoutePath(Class<?> component,
Route route)
Get the actual route path including all parent layout
RoutePrefix . |
static Class<? extends RouterLayout> |
getTopParentLayout(Class<?> component,
String path)
Get the top most parent layout for navigation target according to the
Route or RouteAlias annotation. |
static void |
updatePageTitle(NavigationEvent navigationEvent,
Component routeTarget)
Updates the page title according to the currently visible component.
|
public static List<Class<? extends RouterLayout>> getParentLayouts(Class<?> component)
Route
annotation.component
- navigation target to get parents forpublic static List<Class<? extends RouterLayout>> getParentLayouts(Class<?> component, String path)
Route
or RouteAlias
annotation.component
- navigation target to get parents forpath
- path used to get navigation target so we know which annotation
to handlepublic static String getRoutePath(Class<?> component, Route route)
RoutePrefix
.component
- navigation target component to get route path forroute
- route annotation to checkpublic static String getRouteAliasPath(Class<?> component, RouteAlias alias)
RoutePrefix
.component
- navigation target component to get route path foralias
- route alias annotation to checkpublic static List<Class<? extends RouterLayout>> getParentLayoutsForNonRouteTarget(Class<?> navigationTarget)
Route
nor RouteAlias
, but may still
contain ParentLayout
. Mainly error navigation targets.navigationTarget
- route to check parent layouts forpublic static Class<? extends RouterLayout> getTopParentLayout(Class<?> component, String path)
Route
or RouteAlias
annotation. Also handles non route
targets with ParentLayout
.component
- navigation target to get top most parent forpath
- path used to get navigation target so we know which annotation
to handle or null for error views.public static void updatePageTitle(NavigationEvent navigationEvent, Component routeTarget)
Uses HasDynamicTitle.getPageTitle()
if implemented, or else the
PageTitle
annotation, to resolve the title.
navigationEvent
- the event object about the navigationrouteTarget
- the currently visible componentpublic static void checkForDuplicates(Class<? extends Component> routeTargetType, Collection<Class<? extends RouterLayout>> routeLayoutTypes)
routeTargetType
- the actual component in the route chainrouteLayoutTypes
- the parent types in the route chainpublic static LocationChangeEvent createEvent(NavigationEvent event, List<HasElement> routeTargetChain)
event
- current navigation eventrouteTargetChain
- chain of route targetsCopyright © 2018. All rights reserved.