Package com.vaadin.client.flow
Class RouterLinkHandler
- java.lang.Object
-
- com.vaadin.client.flow.RouterLinkHandler
-
public class RouterLinkHandler extends Object
Handler for click events originating from application navigation link elements marked with "router-link".Events are sent to server for handling.
- Since:
- 1.0
- Author:
- Vaadin Ltd
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidbind(Registry registry, elemental.dom.Element element)Adds a click event listener for the given element for intercepting application navigation related click events and sending them to server.static booleanisInsidePageNavigation(String path, boolean hasFragment)Checks whether the given path is for navigating inside the same page as the current one.static voidsendServerNavigationEvent(Registry registry, String location, Object stateObject, boolean routerLinkEvent)Notifies the server about navigation to the given location.
-
-
-
Method Detail
-
bind
public static void bind(Registry registry, elemental.dom.Element element)
Adds a click event listener for the given element for intercepting application navigation related click events and sending them to server.- Parameters:
registry- the registryelement- the element to listen to click events in
-
isInsidePageNavigation
public static boolean isInsidePageNavigation(String path, boolean hasFragment)
Checks whether the given path is for navigating inside the same page as the current one.If the paths are different, it is always outside the current page navigation. If they are the same, then it depends on whether the new href has any hash
#.- Parameters:
path- the path to check againsthasFragment- thetrueif the navigated url contains a fragment,falseif not- Returns:
trueif the given location is for navigating inside the current page,falseif not
-
sendServerNavigationEvent
public static void sendServerNavigationEvent(Registry registry, String location, Object stateObject, boolean routerLinkEvent)
Notifies the server about navigation to the given location.Ensures that navigation works even if the session has expired.
- Parameters:
registry- the registrylocation- the location to navigate to, relative to the base URIstateObject- the state object ornullif none applicablerouterLinkEvent-trueif this event was triggered by interaction with a router link;falseif triggered by history navigation
-
-