Package com.vaadin.flow.component.page
Class History.HistoryStateChangeEvent
- java.lang.Object
-
- java.util.EventObject
-
- com.vaadin.flow.component.page.History.HistoryStateChangeEvent
-
- All Implemented Interfaces:
Serializable
- Enclosing class:
- History
public static class History.HistoryStateChangeEvent extends EventObject
Event fired when the history state has changed.This happens when
PopStateEventis 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:
- Serialized Form
-
-
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 Instance Methods Concrete Methods Modifier and Type Method Description LocationgetLocation()Gets the location that was opened.HistorygetSource()Optional<elemental.json.JsonValue>getState()Gets the history state value as JSON.NavigationTriggergetTrigger()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, notnullstate- the history state from the browser,nullif no state was providedlocation- the new browser location, notnulltrigger- the type of user action that triggered this history change, notnull
-
-
Method Detail
-
getSource
public History getSource()
- Overrides:
getSourcein 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
-
-