Class BeforeLeaveEvent

All Implemented Interfaces:
Serializable

public class BeforeLeaveEvent extends BeforeEvent
Event created before navigation happens.
Since:
1.0
Author:
Vaadin Ltd
See Also:
  • Constructor Details

    • BeforeLeaveEvent

      public BeforeLeaveEvent(NavigationEvent event, Class<?> navigationTarget, List<Class<? extends RouterLayout>> layouts)
      Constructs event from a NavigationEvent.
      Parameters:
      event - NavigationEvent that is on-going, not null
      navigationTarget - navigation target, not null
      layouts - navigation layout chain, not null
    • 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, not null
      navigationTarget - navigation target, not null
      parameters - route parameters, not null
      layouts - navigation layout chain, not null
    • 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, 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
    • 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, 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
  • Method Details

    • 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