public abstract class BeforeEvent extends EventObject
BeforeLeaveEvent
and BeforeEnterEvent
.source
Constructor and Description |
---|
BeforeEvent(NavigationEvent event,
Class<?> navigationTarget)
Construct event from a NavigationEvent.
|
BeforeEvent(Router router,
NavigationTrigger trigger,
Location location,
Class<?> navigationTarget,
UI ui)
Constructs a new BeforeNavigation Event.
|
Modifier and Type | Method and Description |
---|---|
void |
forwardTo(Class<? extends Component> forwardTargetComponent)
Forward the navigation to show the given component instead of the
component that is currently about to be displayed.
|
void |
forwardTo(NavigationHandler forwardTarget,
NavigationState targetState)
Forward the navigation to use the provided navigation handler instead of
the currently used handler.
|
void |
forwardTo(NavigationState targetState)
Forward the navigation to the given navigation state.
|
void |
forwardTo(String location)
Forward to navigation component registered for given location string
instead of the component about to be displayed.
|
<T> void |
forwardTo(String location,
List<T> locationParams)
Forward to navigation component registered for given location string with
given location parameters instead of the component about to be displayed.
|
<T> void |
forwardTo(String location,
T locationParam)
Forward to navigation component registered for given location string with
given location parameter instead of the component about to be displayed.
|
ErrorParameter<?> |
getErrorParameter()
Get the set error parameter.
|
NavigationHandler |
getForwardTarget()
Gets the forward target to use if the user should be forwarded to some
other view.
|
Class<? extends Component> |
getForwardTargetType()
Get the forward target for forwarding.
|
Location |
getLocation()
Gets the new location.
|
Class<?> |
getNavigationTarget()
Get the navigation target.
|
NavigationHandler |
getRerouteTarget()
Gets the reroute target to use if the user should be rerouted to some
other view.
|
Class<? extends Component> |
getRouteTargetType()
Get the route target for rerouting.
|
Router |
getSource() |
NavigationTrigger |
getTrigger()
Gets the type of user action that triggered this location change.
|
UI |
getUI()
Gets the UI this navigation takes place inside.
|
boolean |
hasErrorParameter()
Check if we have an error parameter set for this navigation event.
|
boolean |
hasForwardTarget()
Check if we have a forward target.
|
boolean |
hasRerouteTarget()
Check if we have a reroute target.
|
void |
rerouteTo(Class<? extends Component> routeTargetType)
Reroutes the navigation to show the given component instead of the
component that is currently about to be displayed.
|
void |
rerouteTo(NavigationHandler rerouteTarget,
NavigationState targetState)
Reroutes the navigation to use the provided navigation handler instead of
the currently used handler.
|
void |
rerouteTo(NavigationState targetState)
Reroutes the navigation to the given navigation state.
|
void |
rerouteTo(String route)
Reroute to navigation component registered for given location string
instead of the component about to be displayed.
|
<T> void |
rerouteTo(String route,
List<T> routeParams)
Reroute to navigation component registered for given location string with
given route parameters instead of the component about to be displayed.
|
<T> void |
rerouteTo(String route,
T routeParam)
Reroute to navigation component registered for given location string with
given route parameter instead of the component about to be displayed.
|
void |
rerouteToError(Class<? extends Exception> exception)
Reroute to error target for given exception without custom message.
|
void |
rerouteToError(Class<? extends Exception> exception,
String customMessage)
Reroute to error target for given exception with given custom message.
|
void |
rerouteToError(Exception exception,
String customMessage)
Reroute to error target for given exception with given custom message.
|
toString
public BeforeEvent(NavigationEvent event, Class<?> navigationTarget)
event
- NavigationEvent that is on goingnavigationTarget
- Navigation targetpublic BeforeEvent(Router router, NavigationTrigger trigger, Location location, Class<?> navigationTarget, UI ui)
router
- the router that triggered the change, not null
trigger
- the type of user action that triggered this location change,
not null
location
- the new location, not null
navigationTarget
- navigation target classui
- the UI related to the navigationpublic Location getLocation()
null
public NavigationTrigger getTrigger()
null
public Router getSource()
getSource
in class EventObject
public boolean hasForwardTarget()
public boolean hasRerouteTarget()
public NavigationHandler getForwardTarget()
public NavigationHandler getRerouteTarget()
public void forwardTo(NavigationHandler forwardTarget, NavigationState targetState)
forwardTarget
- the navigation handler to use, or null
to clear a
previously set forward targettargetState
- the target navigation state of the reroutingpublic void forwardTo(NavigationState targetState)
targetState
- the target navigation state, not null
public void forwardTo(Class<? extends Component> forwardTargetComponent)
forwardTargetComponent
- the component type to display, not null
public void forwardTo(String location)
location
- forward target location stringpublic <T> void forwardTo(String location, T locationParam)
T
- location parameter typelocation
- reroute target location stringlocationParam
- location parameterpublic <T> void forwardTo(String location, List<T> locationParams)
T
- location parameters typelocation
- reroute target location stringlocationParams
- location parameterspublic void rerouteTo(NavigationHandler rerouteTarget, NavigationState targetState)
rerouteTarget
- the navigation handler to use, or null
to clear a
previously set reroute targettargetState
- the target navigation state of the reroutingpublic void rerouteTo(NavigationState targetState)
targetState
- the target navigation state of the rerouting, not null
public void rerouteTo(Class<? extends Component> routeTargetType)
routeTargetType
- the component type to display, not null
public void rerouteTo(String route)
route
- reroute target location stringpublic <T> void rerouteTo(String route, T routeParam)
T
- route parameter typeroute
- reroute target location stringrouteParam
- route parameterpublic <T> void rerouteTo(String route, List<T> routeParams)
T
- route parameters typeroute
- reroute target location stringrouteParams
- route parameterspublic Class<? extends Component> getForwardTargetType()
public Class<? extends Component> getRouteTargetType()
public Class<?> getNavigationTarget()
public void rerouteToError(Class<? extends Exception> exception)
Exception class needs to have default no-arg constructor.
exception
- exception to get error target forrerouteToError(Exception, String)
public void rerouteToError(Class<? extends Exception> exception, String customMessage)
Exception class needs to have default no-arg constructor.
exception
- exception to get error target forcustomMessage
- custom message to send to error targetrerouteToError(Exception, String)
public void rerouteToError(Exception exception, String customMessage)
exception
- exception to get error target forcustomMessage
- custom message to send to error targetpublic boolean hasErrorParameter()
public ErrorParameter<?> getErrorParameter()
public UI getUI()
Copyright © 2019. All rights reserved.