@Override public Optional<Class<? extends Component>> getNavigationTarget( String pathString, List<String> segments) { Objects.requireNonNull(pathString, "pathString must not be null."); if (getConfiguration().hasRoute(pathString, segments)) { return getConfiguration().getRoute(pathString, segments); } return parentRegistry.getNavigationTarget(pathString, segments); }
@Override public Optional<Class<? extends Component>> getNavigationTarget( String pathString) { Objects.requireNonNull(pathString, "pathString must not be null."); Optional<Class<? extends Component>> navigationTarget = getNavigationTarget( pathString, Collections.emptyList()); if (navigationTarget.isPresent()) { return navigationTarget; } return parentRegistry.getNavigationTarget(pathString); }
private static RouteRegistry getSessionRegistry() { return SessionRouteRegistry .getSessionRegistry(VaadinSession.getCurrent()); }
ConfiguredRoutes configuration = getConfiguration(); List<RouteBaseData<?>> addedVisible = event.getAddedRoutes() .stream().filter(routeData -> !configuration fireEvent(new RoutesChangedEvent(event.getSource(), addedVisible, removedVisible));
/** * Get the session registry for VaadinSession. If no SessionRegistry exists * then one will be created for given VaadinSession. * * @param session * vaadin session to get registry for * @return session registry for given session */ public static RouteRegistry getSessionRegistry(VaadinSession session) { Objects.requireNonNull(session, "Null session is not supported for session route registry"); SessionRouteRegistry registry = session .getAttribute(SessionRouteRegistry.class); if (registry == null) { registry = new SessionRouteRegistry(session, session.getService()); session.setAttribute(SessionRouteRegistry.class, registry); } if (!registry.session.equals(session)) { throw new IllegalStateException( "Session has as the attribute a route registered to another session"); } return registry; }
@Override public List<Class<? extends RouterLayout>> getRouteLayouts(String path, Class<? extends Component> navigationTarget) { if (getConfiguration().hasRoute(path)) { return super.getRouteLayouts(path, navigationTarget); } return parentRegistry.getRouteLayouts(path, navigationTarget); } }
public RouteRegistry getRegistry() { // If we have a session then return the session registry // else return router registry if (VaadinSession.getCurrent() != null) { return SessionRouteRegistry .getSessionRegistry(VaadinSession.getCurrent()); } return registry; }