com.vaadin.flow.component.page.
Class History.HistoryStateChangeEvent
- java.lang.Object
-
- java.util.EventObject
-
- com.vaadin.flow.component.page.History.HistoryStateChangeEvent
-
All Implemented Interfaces:
Enclosing class:
public static class History.HistoryStateChangeEvent extends EventObject
Event fired when the history state has changed.
This happens when
PopStateEvent
is fired in the browser, or when routing has been triggered by user clicking a link marked with attribute "router-link".Note that this event is not fired when only the hash has changed!
See Also:
-
-
Field Summary
-
Fields inherited from class java.util.EventObject
source
-
-
Constructor Summary
Constructors Constructor Description HistoryStateChangeEvent​(History history, elemental.json.JsonValue state, Location location, NavigationTrigger trigger)
Creates a new event.
-
Method Summary
All Methods Modifier and Type Method Description Location
getLocation()
Gets the location that was opened.
History
getSource()
Optional<elemental.json.JsonValue>
getState()
Gets the history state value as JSON.
NavigationTrigger
getTrigger()
Gets the type of user action that triggered this history change.
-
Methods inherited from class java.util.EventObject
toString
-
-
-
-
Constructor Detail
-
HistoryStateChangeEvent
public HistoryStateChangeEvent​(History history, elemental.json.JsonValue state, Location location, NavigationTrigger trigger)
Creates a new event.
Parameters:
history
- the history instance that fired the event, notnull
state
- the history state from the browser,null
if no state was providedlocation
- the new browser location, notnull
trigger
- the type of user action that triggered this history change, notnull
-
-
Method Detail
-
getSource
public History getSource()
Overrides:
getSource
in classEventObject
-
getLocation
public Location getLocation()
Gets the location that was opened. This is relative to the base url.
Returns:
the location, not null
-
getState
public Optional<elemental.json.JsonValue> getState()
Gets the history state value as JSON.
Returns:
an optional JSON state value or an empty optional if no state has been provided
-
getTrigger
public NavigationTrigger getTrigger()
Gets the type of user action that triggered this history change.
Returns:
the type of user action that triggered this history change, not
null
-
-