public class DefaultNavigator extends Object implements Navigator
Navigator implementation.| Modifier and Type | Class and Description |
|---|---|
static class |
DefaultNavigator.DefaultNavigationBuilder
Default
NavigationBuilder implementation. |
Navigator.NavigationBuilderCONTEXT_KEY, DEFAULT_NAVIGATION_FAILED_MESSAGE, DEFAULT_NAVIGATION_FAILED_MESSAGE_CODE| Constructor and Description |
|---|
DefaultNavigator()
Constructor using the current UI.
|
DefaultNavigator(com.vaadin.flow.component.UI ui)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
com.holonplatform.core.Registration |
addNavigationChangeListener(NavigationChangeListener navigationChangeListener)
Add a
NavigationChangeListener to listen to navigation target/location changes. |
<T,C extends com.vaadin.flow.component.Component & com.vaadin.flow.router.HasUrlParameter<T>> |
getUrl(Class<? extends C> navigationTarget,
List<T> parameters)
Get the registered URL for given navigation target class, including the given
parameters in the url. |
String |
getUrl(Class<? extends com.vaadin.flow.component.Component> navigationTarget)
Get the registered URL for given navigation target class.
|
void |
navigateBack()
Navigates back.
|
void |
navigateTo(String path,
Map<String,Object> queryParameters)
Navigate to the given path, using the provided query parameters.
|
void |
navigateToDefault()
Navigates to the default navigation target, i.e.
|
void |
navigateToLocation(String location)
Navigate to the given location.
|
void |
navigateToPrevious()
Navigates to the previous route, if available.
|
void |
setPreviousLocation(com.vaadin.flow.router.Location previousLocation) |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcreate, get, getUrl, getUrl, navigateTo, navigateTo, navigateTo, navigateTo, navigateTo, navigateTo, navigateTo, navigation, navigationpublic DefaultNavigator()
public DefaultNavigator(com.vaadin.flow.component.UI ui)
ui - The UI to which the navigator is bound (not null)public void setPreviousLocation(com.vaadin.flow.router.Location previousLocation)
previousLocation - the previousLocation to setpublic void navigateToLocation(String location)
Navigator
The location may include a set of query path parameters, using the default ? separator.
navigateToLocation in interface Navigatorlocation - The location to navigate to. If null, the default ("") location will be
usedpublic void navigateTo(String path, Map<String,Object> queryParameters)
Navigator
The query parameter values will be serialized to be included in the navigation location URL, using a
NavigationParameterMapper. See the QueryParameter annotation to learn about the supported query
parameter value types.
navigateTo in interface Navigatorpath - The path to navigate to. If null, the default ("") path will be usedqueryParameters - A map of query parameters, which associates the parameter names to their valuespublic void navigateToDefault()
Navigator"" route path.navigateToDefault in interface Navigatorpublic void navigateBack()
NavigatorThis has the same effect as if the user would press the back button in the browser.
navigateBack in interface Navigatorpublic void navigateToPrevious()
Navigator
This method can be used to navigate back in the route targets sequence handled by the UI Router or Navigator, it
has not the same effect and purpose of the Navigator.navigateBack() method, which can be used to navigate back in
the browser history.
navigateToPrevious in interface NavigatorNavigator.navigateToDefault()public String getUrl(Class<? extends com.vaadin.flow.component.Component> navigationTarget)
Navigator
This method ignores any declared URL parameter, and always returns the navigation target base URL. To obtain the
URL for a navigation target with required URL parameters, use Navigator.getUrl(Class, List) or
Navigator.getUrl(Class, Object).
public <T,C extends com.vaadin.flow.component.Component & com.vaadin.flow.router.HasUrlParameter<T>> String getUrl(Class<? extends C> navigationTarget, List<T> parameters)
Navigatorparameters in the url.getUrl in interface NavigatorT - URL parameters typeC - Navigation target typenavigationTarget - The navigation target to get url for (not null)parameters - The parameters to include in the generated URL (not null)public com.holonplatform.core.Registration addNavigationChangeListener(NavigationChangeListener navigationChangeListener)
NavigatorNavigationChangeListener to listen to navigation target/location changes.addNavigationChangeListener in interface NavigatornavigationChangeListener - The listener to add (not null)Copyright © 2020 The Holon Platform. All rights reserved.