public abstract class BeforeEvent extends EventObject
BeforeLeaveEvent
and BeforeEnterEvent
.source
Constructor and Description |
---|
BeforeEvent(NavigationEvent event,
Class<?> navigationTarget,
List<Class<? extends RouterLayout>> layouts)
Constructs event from a NavigationEvent.
|
BeforeEvent(NavigationEvent event,
Class<?> navigationTarget,
RouteParameters parameters,
List<Class<? extends RouterLayout>> layouts)
Constructs event from a NavigationEvent.
|
BeforeEvent(Router router,
NavigationTrigger trigger,
Location location,
Class<?> navigationTarget,
RouteParameters parameters,
UI ui,
List<Class<? extends RouterLayout>> layouts)
Constructs a new BeforeEvent.
|
BeforeEvent(Router router,
NavigationTrigger trigger,
Location location,
Class<?> navigationTarget,
UI ui,
List<Class<? extends RouterLayout>> layouts)
Constructs a new BeforeEvent.
|
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(Class<? extends Component> forwardTargetComponent,
RouteParameters parameters)
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 handler to use if the user should be forwarded to
some other view.
|
List<String> |
getForwardTargetParameters()
Deprecated.
use
getForwardTargetRouteParameters() instead. |
RouteParameters |
getForwardTargetRouteParameters()
Gets the URL parameters of the forward target.
|
Class<? extends Component> |
getForwardTargetType()
Get the forward target type for forwarding.
|
String |
getForwardUrl()
Gets the reroute url.
|
List<Class<? extends RouterLayout>> |
getLayouts()
Get the layout chain for the
navigation target . |
Location |
getLocation()
Gets the new location.
|
Class<?> |
getNavigationTarget()
Get the navigation target.
|
NavigationHandler |
getRerouteTarget()
Gets the reroute target handler to use if the user should be rerouted to
some other view.
|
List<String> |
getRerouteTargetParameters()
Deprecated.
use
getRerouteTargetRouteParameters() instead. |
RouteParameters |
getRerouteTargetRouteParameters()
Get the URL parameters of the reroute target.
|
Class<? extends Component> |
getRerouteTargetType()
Get the route target type for rerouting.
|
String |
getRerouteUrl()
Gets the reroute url.
|
RouteParameters |
getRouteParameters()
Gets the route parameters associated with this event.
|
Class<? extends Component> |
getRouteTargetType()
Deprecated.
use
getRerouteTargetType() instead. |
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.
|
String |
getUnknownForward()
Gets the unknown forward.
|
String |
getUnknownReroute()
Gets the unknown reroute.
|
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.
|
boolean |
hasUnknownForward()
Gets if forward route is unknown.
|
boolean |
hasUnknownReroute()
Gets if reroute route is unknown.
|
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(Class<? extends Component> routeTargetType,
RouteParameters parameters)
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, List<Class<? extends RouterLayout>> layouts)
event
- NavigationEvent that is on-going, not null
navigationTarget
- navigation target, not null
layouts
- Navigation layout chain, not null
public BeforeEvent(NavigationEvent event, Class<?> navigationTarget, RouteParameters parameters, List<Class<? extends RouterLayout>> layouts)
event
- NavigationEvent that is on-going, not null
navigationTarget
- navigation target, not null
parameters
- route parameters, not null
layouts
- Navigation layout chain, not null
public BeforeEvent(Router router, NavigationTrigger trigger, Location location, Class<?> navigationTarget, UI ui, List<Class<? extends RouterLayout>> layouts)
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 class, not null
ui
- the UI related to the navigation, not null
layouts
- the layout chain for the navigation target, not
null
public BeforeEvent(Router router, NavigationTrigger trigger, Location location, Class<?> navigationTarget, RouteParameters parameters, UI ui, List<Class<? extends RouterLayout>> layouts)
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 class, not null
parameters
- route parameters, not null
ui
- the UI related to the navigation, not null
layouts
- the layout chain for the navigation target, not
null
public boolean hasUnknownForward()
forwardTo(String)
method.public boolean hasUnknownReroute()
rerouteTo(String)
method.public String getUnknownForward()
public String getUnknownReroute()
public 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)
This function changes the browser URL as opposed to
rerouteTo()
.
Note that query parameters of the event are preserved in the forwarded URL.
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)
This function changes the browser URL as opposed to
rerouteTo()
.
Note that query parameters of the event are preserved in the forwarded URL.
targetState
- the target navigation state, not null
public void forwardTo(Class<? extends Component> forwardTargetComponent)
This function changes the browser URL as opposed to
rerouteTo()
.
Note that query parameters of the event are preserved in the forwarded URL.
forwardTargetComponent
- the component type to display, not null
public void forwardTo(Class<? extends Component> forwardTargetComponent, RouteParameters parameters)
This function changes the browser URL as opposed to
rerouteTo()
.
Note that query parameters of the event are preserved in the forwarded URL.
forwardTargetComponent
- the component type to display, not null
parameters
- parameters for the target url.public void forwardTo(String location)
This function changes the browser URL as opposed to
rerouteTo()
.
Note that query parameters of the event are preserved in the forwarded URL.
location
- forward target location stringpublic <T> void forwardTo(String location, T locationParam)
This function changes the browser URL as opposed to
rerouteTo()
.
Note that query parameters of the event are preserved in the forwarded URL.
T
- location parameter typelocation
- forward target location stringlocationParam
- location parameterpublic <T> void forwardTo(String location, List<T> locationParams)
This function changes the browser URL as opposed to
rerouteTo()
.
Note that query parameters of the event are preserved in the forwarded URL.
T
- location parameters typelocation
- forward target location stringlocationParams
- location parameterspublic void rerouteTo(NavigationHandler rerouteTarget, NavigationState targetState)
This function doesn't change the browser URL as opposed to
forwardTo()
.
Note that rerouting preserves the query parameters of the event.
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)
This function doesn't change the browser URL as opposed to
forwardTo()
.
Note that rerouting preserves the query parameters of the event.
targetState
- the target navigation state of the rerouting, not null
public void rerouteTo(Class<? extends Component> routeTargetType)
This function doesn't change the browser URL as opposed to
forwardTo()
.
Note that rerouting preserves the query parameters of the event.
routeTargetType
- the component type to display, not null
public void rerouteTo(Class<? extends Component> routeTargetType, RouteParameters parameters)
This function doesn't change the browser URL as opposed to
forwardTo()
.
Note that rerouting preserves the query parameters of the event.
routeTargetType
- the component type to display, not null
parameters
- parameters for the target url.public void rerouteTo(String route)
This function doesn't change the browser URL as opposed to
forwardTo()
.
Note that rerouting preserves the query parameters of the event.
route
- reroute target location stringpublic <T> void rerouteTo(String route, T routeParam)
This function doesn't change the browser URL as opposed to
forwardTo()
.
Note that rerouting preserves the query parameters of the event.
T
- route parameter typeroute
- reroute target location stringrouteParam
- route parameterpublic <T> void rerouteTo(String route, List<T> routeParams)
This function doesn't change the browser URL as opposed to
forwardTo()
.
Note that rerouting preserves the query parameters of the event.
T
- route parameters typeroute
- reroute target location stringrouteParams
- route parameterspublic Class<? extends Component> getForwardTargetType()
NullPointerException
- if no forward target is set. Check
hasForwardTarget()
before accessing this method.@Deprecated public List<String> getForwardTargetParameters()
getForwardTargetRouteParameters()
instead.NullPointerException
- if no forward target is set. Check
hasForwardTarget()
before accessing this method.public RouteParameters getForwardTargetRouteParameters()
NullPointerException
- if no forward target is set. Check
hasForwardTarget()
before accessing this method.public String getForwardUrl()
NullPointerException
- if no forward target is set. Check
hasForwardTarget()
before accessing this method.@Deprecated public Class<? extends Component> getRouteTargetType()
getRerouteTargetType()
instead.public Class<? extends Component> getRerouteTargetType()
NullPointerException
- if no reroute target is set. Check
hasRerouteTarget()
before accessing this method.@Deprecated public List<String> getRerouteTargetParameters()
getRerouteTargetRouteParameters()
instead.NullPointerException
- if no reroute target is set. Check
hasRerouteTarget()
before accessing this method.public RouteParameters getRerouteTargetRouteParameters()
NullPointerException
- if no reroute target is set. Check
hasRerouteTarget()
before accessing this method.public String getRerouteUrl()
NullPointerException
- if no reroute target is set. Check
hasRerouteTarget()
before accessing this method.public Class<?> getNavigationTarget()
public RouteParameters getRouteParameters()
public List<Class<? extends RouterLayout>> getLayouts()
navigation target
.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 © 2022. All rights reserved.