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.
|
toString
public LocationChangeEvent(Router router, UI ui, NavigationTrigger trigger, Location location, List<HasElement> routeTargetChain)
router
- the router that triggered the change, not null
ui
- the UI in which the view is used, not null
trigger
- the type of user action that triggered this location change,
not null
routeTargetChain
- the route terget chain that will be used, not null
location
- the new location, not null
public Location getLocation()
null
public List<HasElement> getRouteTargetChain()
null
public UI getUI()
null
public NavigationTrigger getTrigger()
null
public Map<String,List<String>> getQueryParameters()
getQueryParameter(String)
null
public 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 EventObject
public 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 null
Copyright © 2019. All rights reserved.