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)
Construct event from a NavigationEvent.
BeforeLeaveEvent(Router router, NavigationTrigger trigger, Location location, Class<?> navigationTarget, UI ui)
Constructs a new BeforeNavigation Event.
-
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
getErrorParameter, getLocation, getNavigationTarget, getRerouteTarget, getRouteTargetType, getSource, getTrigger, getUI, hasErrorParameter, hasRerouteTarget, rerouteTo, rerouteTo, rerouteTo, rerouteTo, rerouteTo, rerouteTo, rerouteToError, rerouteToError, rerouteToError
-
Methods inherited from class java.util.EventObject
toString
-
-
-
-
Constructor Detail
-
BeforeLeaveEvent
public BeforeLeaveEvent(NavigationEvent event, Class<?> navigationTarget)
Construct event from a NavigationEvent.
Parameters:
event
- NavigationEvent that is on goingnavigationTarget
- Navigation target
-
BeforeLeaveEvent
public BeforeLeaveEvent(Router router, NavigationTrigger trigger, Location location, Class<?> navigationTarget, UI ui)
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
-
-
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
-
-