Package com.vaadin.flow.router
Class NavigationEvent
java.lang.Object
java.util.EventObject
com.vaadin.flow.router.NavigationEvent
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
ErrorNavigationEvent
Event object with data related to navigation.
- Since:
- 1.0
- Author:
- Vaadin Ltd
- See Also:
-
Field Summary
Fields inherited from class java.util.EventObject
source
-
Constructor Summary
ConstructorDescriptionNavigationEvent
(Router router, Location location, UI ui, NavigationTrigger trigger) Creates a new navigation event.NavigationEvent
(Router router, Location location, UI ui, NavigationTrigger trigger, elemental.json.JsonValue state, boolean forwardTo) Creates a new navigation event. -
Method Summary
Modifier and TypeMethodDescriptionGets the new location.Optional<elemental.json.JsonValue>
getState()
Gets navigation state.Gets the type of user action that triggered this navigation event.getUI()
Gets the UI in which the navigation occurs.boolean
Checks whether this event is created as a result ofBeforeEvent.forwardTo(com.vaadin.flow.router.NavigationHandler, com.vaadin.flow.router.NavigationState)
or not.Methods inherited from class java.util.EventObject
toString
-
Constructor Details
-
Method Details
-
getSource
- Overrides:
getSource
in classEventObject
-
getLocation
Gets the new location.- Returns:
- the new location, not
null
-
getUI
Gets the UI in which the navigation occurs.- Returns:
- the UI of the navigation
-
getTrigger
Gets the type of user action that triggered this navigation event.- Returns:
- the type of user action that triggered this navigation event, not
null
-
getState
Gets navigation state. It contains for example the scroll position and the complete href of the RouterLink that triggers this navigation.- Returns:
- the navigation state
-
isForwardTo
public boolean isForwardTo()Checks whether this event is created as a result ofBeforeEvent.forwardTo(com.vaadin.flow.router.NavigationHandler, com.vaadin.flow.router.NavigationState)
or not.- Returns:
true
if this event is created as a result callingBeforeEvent.forwardTo(com.vaadin.flow.router.NavigationHandler, com.vaadin.flow.router.NavigationState)
,false
otherwise
-