com.vaadin.flow.router.
Class BeforeLeaveEvent
- java.lang.Object
-
- java.util.EventObject
-
- com.vaadin.flow.router.BeforeEvent
-
- com.vaadin.flow.router.BeforeLeaveEvent
-
All Implemented Interfaces:
public class BeforeLeaveEvent extends BeforeEvent
Event created before navigation happens.
Since:
1.0
Author:
Vaadin Ltd
See Also:
-
-
Nested Class Summary
Nested Classes Modifier and Type Class and Description class
BeforeLeaveEvent.ContinueNavigationAction
The action to resume a postponed
BeforeEnterEvent
.
-
Field Summary
-
Fields inherited from class java.util.EventObject
source
-
-
Constructor Summary
Constructors Constructor and Description BeforeLeaveEvent(NavigationEvent event, Class<?> navigationTarget)
Deprecated.
UseBeforeLeaveEvent(NavigationEvent, Class, List)
instead.BeforeLeaveEvent(NavigationEvent event, Class<?> navigationTarget, List<Class<? extends RouterLayout>> layouts)
Constructs event from a NavigationEvent.
BeforeLeaveEvent(NavigationEvent event, Class<?> navigationTarget, RouteParameters parameters, List<Class<? extends RouterLayout>> layouts)
Constructs event from a NavigationEvent.
BeforeLeaveEvent(Router router, NavigationTrigger trigger, Location location, Class<?> navigationTarget, RouteParameters parameters, UI ui, List<Class<? extends RouterLayout>> layouts)
Constructs a new BeforeLeaveEvent.
BeforeLeaveEvent(Router router, NavigationTrigger trigger, Location location, Class<?> navigationTarget, UI ui)
Deprecated.
BeforeLeaveEvent(Router router, NavigationTrigger trigger, Location location, Class<?> navigationTarget, UI ui, List<Class<? extends RouterLayout>> layouts)
Constructs a new BeforeLeaveEvent.
-
Method Summary
All Methods Modifier and Type Method and Description BeforeLeaveEvent.ContinueNavigationAction
getContinueNavigationAction()
Gets the action used to resume this event, if it was postponed.
boolean
isPostponed()
Checks whether this event was postponed.
BeforeLeaveEvent.ContinueNavigationAction
postpone()
Initiates the postponement of the current navigation transition, allowing a listener to e.g.
-
Methods inherited from class com.vaadin.flow.router.BeforeEvent
forwardTo, forwardTo, forwardTo, forwardTo, forwardTo, forwardTo, forwardTo, getErrorParameter, getForwardTarget, getForwardTargetParameters, getForwardTargetRouteParameters, getForwardTargetType, getForwardUrl, getLayouts, getLocation, getNavigationTarget, getRerouteTarget, getRerouteTargetParameters, getRerouteTargetRouteParameters, getRerouteTargetType, getRerouteUrl, getRouteParameters, getRouteTargetType, getSource, getTrigger, getUI, hasErrorParameter, hasForwardTarget, hasRerouteTarget, rerouteTo, rerouteTo, rerouteTo, rerouteTo, rerouteTo, rerouteTo, rerouteTo, rerouteToError, rerouteToError, rerouteToError
-
Methods inherited from class java.util.EventObject
toString
-
-
-
-
Constructor Detail
-
BeforeLeaveEvent
@Deprecated public BeforeLeaveEvent(NavigationEvent event, Class<?> navigationTarget)
Deprecated. Use
BeforeLeaveEvent(NavigationEvent, Class, List)
instead.Construct event from a NavigationEvent.
Parameters:
event
- NavigationEvent that is on-goingnavigationTarget
- Navigation target
-
BeforeLeaveEvent
public BeforeLeaveEvent(NavigationEvent event, Class<?> navigationTarget, List<Class<? extends RouterLayout>> layouts)
Constructs event from a NavigationEvent.
Parameters:
event
- NavigationEvent that is on-going, notnull
navigationTarget
- navigation target, notnull
layouts
- navigation layout chain, notnull
-
BeforeLeaveEvent
public BeforeLeaveEvent(NavigationEvent event, Class<?> navigationTarget, RouteParameters parameters, List<Class<? extends RouterLayout>> layouts)
Constructs event from a NavigationEvent.
Parameters:
event
- NavigationEvent that is on-going, notnull
navigationTarget
- navigation target, notnull
parameters
- route parameters, notnull
layouts
- navigation layout chain, notnull
-
BeforeLeaveEvent
@Deprecated public BeforeLeaveEvent(Router router, NavigationTrigger trigger, Location location, Class<?> navigationTarget, UI ui)
Deprecated. Use
BeforeLeaveEvent(Router, NavigationTrigger, Location, Class, UI, List)
instead.Constructs a new BeforeNavigation Event.
Parameters:
router
- the router that triggered the change, notnull
trigger
- the type of user action that triggered this location change, notnull
location
- the new location, notnull
navigationTarget
- navigation target classui
- the UI related to the navigation
-
BeforeLeaveEvent
public BeforeLeaveEvent(Router router, NavigationTrigger trigger, Location location, Class<?> navigationTarget, UI ui, List<Class<? extends RouterLayout>> layouts)
Constructs a new BeforeLeaveEvent.
Parameters:
router
- the router that triggered the change, notnull
trigger
- the type of user action that triggered this location change, notnull
location
- the new location, notnull
navigationTarget
- navigation target class, notnull
ui
- the UI related to the navigation, notnull
layouts
- the layout chain for the navigation target, notnull
-
BeforeLeaveEvent
public BeforeLeaveEvent(Router router, NavigationTrigger trigger, Location location, Class<?> navigationTarget, RouteParameters parameters, UI ui, List<Class<? extends RouterLayout>> layouts)
Constructs a new BeforeLeaveEvent.
Parameters:
router
- the router that triggered the change, notnull
trigger
- the type of user action that triggered this location change, notnull
location
- the new location, notnull
navigationTarget
- navigation target class, notnull
parameters
- route parameters, notnull
ui
- the UI related to the navigation, notnull
layouts
- the layout chain for the navigation target, notnull
-
-
Method Detail
-
postpone
public BeforeLeaveEvent.ContinueNavigationAction postpone()
Initiates the postponement of the current navigation transition, allowing a listener to e.g. display a confirmation dialog before finishing the transition.
This is only valid while leaving (deactivating) a page; if the method is called while entering / activating the new page, it will throw an
IllegalStateException
.Returns:
the action to run when the transition is to be resumed, or null
-
isPostponed
public boolean isPostponed()
Checks whether this event was postponed.
Returns:
true if the event was postponed, false otherwise
-
getContinueNavigationAction
public BeforeLeaveEvent.ContinueNavigationAction getContinueNavigationAction()
Gets the action used to resume this event, if it was postponed.
Returns:
the action used to resume this event if it was postponed, or null if it is not being postponed
-
-