public class Router extends Object implements Serializable
Route
,
Serialized FormConstructor and Description |
---|
Router(RouteRegistry registry)
Constructs a new router with the given route registry and a
DefaultRouteResolver . |
Modifier and Type | Method and Description |
---|---|
protected Optional<ErrorTargetEntry> |
getErrorNavigationTarget(Exception exception) |
RouteRegistry |
getRegistry() |
List<RouteData> |
getRoutes()
Deprecated.
Url handling is moved to
RouteConfiguration.getAvailableRoutes() |
Map<Class<? extends RouterLayout>,List<RouteData>> |
getRoutesByParent()
Deprecated.
No replacement.
|
<T,C extends Component & HasUrlParameter<T>> |
getUrl(Class<? extends C> navigationTarget,
List<T> parameters)
Deprecated.
Url handling is moved to
RouteConfiguration.getUrl(Class, List) |
<T,C extends Component & HasUrlParameter<T>> |
getUrl(Class<? extends C> navigationTarget,
T parameter)
Deprecated.
Url handling is moved to
RouteConfiguration.getUrl(Class, Object) |
String |
getUrl(Class<? extends Component> navigationTarget)
Deprecated.
Url handling is moved to
RouteConfiguration.getUrl(Class) |
String |
getUrlBase(Class<? extends Component> navigationTarget)
Deprecated.
Url base handling is moved to
RouteConfiguration.getUrlBase(Class) |
void |
initializeUI(UI ui,
VaadinRequest initRequest)
Enables navigation for a new UI instance.
|
int |
navigate(UI ui,
Location location,
NavigationTrigger trigger)
Navigates the given UI to the given location.
|
static String |
resolve(Class<?> component,
Route route)
Deprecated.
Use
RouteUtil.resolve(Class, Route) instead |
Optional<NavigationState> |
resolveNavigationTarget(String pathInfo,
Map<String,String[]> parameterMap)
Resolve the navigation target for given path and parameter map using the
router routeResolver.
|
public Router(RouteRegistry registry)
DefaultRouteResolver
.registry
- the route registry to use, not null
public void initializeUI(UI ui, VaadinRequest initRequest)
ui
- the UI that navigation should be set up forinitRequest
- the Vaadin request that bootstraps the provided UIpublic Optional<NavigationState> resolveNavigationTarget(String pathInfo, Map<String,String[]> parameterMap)
pathInfo
- the path relative to the applicationparameterMap
- A mapping of parameter names to arrays of parameter valuespublic int navigate(UI ui, Location location, NavigationTrigger trigger)
This method just shows the given location
on the page and doesn't
update the browser location (and page history). Use the
UI.navigate(String, QueryParameters)
method if you want to update
the browser location as well.
ui
- the UI to update, not null
location
- the location to navigate to, not null
trigger
- the type of user action that triggered this navigation, not
null
UI.navigate(String)
,
UI.navigate(String, QueryParameters)
@Deprecated public String getUrl(Class<? extends Component> navigationTarget)
RouteConfiguration.getUrl(Class)
Note! If the navigation target has a url parameter that is required then this method will throw and IllegalArgumentException.
navigationTarget
- navigation target to get url forIllegalArgumentException
- if the navigation target requires a parameter@Deprecated public String getUrlBase(Class<? extends Component> navigationTarget)
RouteConfiguration.getUrlBase(Class)
navigationTarget
- navigation target to get url for@Deprecated public <T,C extends Component & HasUrlParameter<T>> String getUrl(Class<? extends C> navigationTarget, T parameter)
RouteConfiguration.getUrl(Class, Object)
Note! Given parameter is checked for correct class type. This means that
if the navigation target defined parameter is of type Boolean
then calling getUrl with a String
will fail.
T
- url parameter typeC
- navigation target typenavigationTarget
- navigation target to get url forparameter
- parameter to embed into the generated url@Deprecated public <T,C extends Component & HasUrlParameter<T>> String getUrl(Class<? extends C> navigationTarget, List<T> parameters)
RouteConfiguration.getUrl(Class, List)
Note! Given parameter is checked for correct class type. This means that
if the navigation target defined parameter is of type Boolean
then calling getUrl with a String
will fail.
T
- url parameter typeC
- navigation target typenavigationTarget
- navigation target to get url forparameters
- parameters to embed into the generated url, not nullpublic RouteRegistry getRegistry()
@Deprecated public List<RouteData> getRoutes()
RouteConfiguration.getAvailableRoutes()
@Deprecated public Map<Class<? extends RouterLayout>,List<RouteData>> getRoutesByParent()
@Deprecated public static String resolve(Class<?> component, Route route)
RouteUtil.resolve(Class, Route)
insteadcomponent
- the component where the route points toroute
- the annotationprotected Optional<ErrorTargetEntry> getErrorNavigationTarget(Exception exception)
Copyright © 2019. All rights reserved.