public class LocationChangeEvent extends EventObject
NavigationTrigger.source| Constructor and Description |
|---|
LocationChangeEvent(Router router,
UI ui,
NavigationTrigger trigger,
Location location,
List<HasElement> routeTargetChain)
Creates a new location change event.
|
| Modifier and Type | Method and Description |
|---|---|
Location |
getLocation()
Gets the new location.
|
Optional<String> |
getQueryParameter(String parameterName)
Gets first parameter that corresponds to specified
parameterName. |
Map<String,List<String>> |
getQueryParameters()
Gets the query parameters used for navigation.
|
Optional<NavigationHandler> |
getRerouteTarget()
Gets the reroute target to use if the user should be rerouted to some
other view.
|
List<HasElement> |
getRouteTargetChain()
Gets the chain of route targets that will be nested inside the UI,
starting from the most deeply nested component.
|
Router |
getSource() |
int |
getStatusCode()
Gets the HTTP status code that will be returned for the client if this
location change is an initial rendering request.
|
NavigationTrigger |
getTrigger()
Gets the type of user action that triggered this location change.
|
UI |
getUI()
Gets the UI in which the view is shown.
|
void |
rerouteTo(NavigationHandler rerouteTarget)
Reroutes the navigation to use the provided navigation handler instead of
the currently used handler.
|
void |
rerouteTo(NavigationState rerouteTargetState)
Reroutes the navigation to show the given component instead of the
component that is currently about to be displayed.
|
void |
setStatusCode(int statusCode)
Sets the HTTP status code that will be returned for the client if this
location change is an initial rendering request.
|
toStringpublic LocationChangeEvent(Router router, UI ui, NavigationTrigger trigger, Location location, List<HasElement> routeTargetChain)
router - the router that triggered the change, not nullui - the UI in which the view is used, not nulltrigger - the type of user action that triggered this location change,
not nullrouteTargetChain - the route terget chain that will be used, not nulllocation - the new location, not nullpublic Location getLocation()
nullpublic List<HasElement> getRouteTargetChain()
nullpublic UI getUI()
nullpublic NavigationTrigger getTrigger()
nullpublic Map<String,List<String>> getQueryParameters()
getQueryParameter(String)nullpublic Optional<String> getQueryParameter(String parameterName)
parameterName.
If there are multiple parameters corresponding to the same
parameterName, the first one will be returned. To access all
parameters, use getQueryParameters() method.parameterName - the name of a parameter to getOptional.empty(),
if no parameters found for parameterName specifiedpublic Router getSource()
getSource in class EventObjectpublic int getStatusCode()
public void setStatusCode(int statusCode)
statusCode - the http status codepublic Optional<NavigationHandler> getRerouteTarget()
public void rerouteTo(NavigationHandler rerouteTarget)
rerouteTarget - the navigation handler to use, or null to clear a
previously set reroute targetpublic void rerouteTo(NavigationState rerouteTargetState)
rerouteTargetState - the target navigation state of the rerouting, not nullCopyright © 2025. All rights reserved.