/** * Register a navigation target with specified path and given parent layout * chain. * <p> * Note! Any {@link ParentLayout}, {@link Route} or {@link RouteAlias} will * be ignored in route handling. * * @param path * path to register navigation target to * @param navigationTarget * navigation target to register * @param parentChain * chain of parent layouts that should be used with this target * @throws InvalidRouteConfigurationException * thrown if exact route already defined in this scope */ public void setRoute(String path, Class<? extends Component> navigationTarget, List<Class<? extends RouterLayout>> parentChain) { handledRegistry.setRoute(path, navigationTarget, parentChain); }
/** * Register a navigation target with specified path and given parent layout * chain. * <p> * Note! Any {@link ParentLayout}, {@link Route} or {@link RouteAlias} will * be ignored in route handling. * * @param path * path to register navigation target to * @param navigationTarget * navigation target to register * @param parentChain * chain of parent layouts that should be used with this target * @throws InvalidRouteConfigurationException * thrown if exact route already defined in this scope */ // This method is unchecked for the type due to varargs public void setRoute(String path, Class<? extends Component> navigationTarget, Class<? extends RouterLayout>... parentChain) { handledRegistry .setRoute(path, navigationTarget, Arrays.asList(parentChain)); }
/** * Register a navigation target on the specified path. Any * {@link ParentLayout} annotation on class will be used to populate layout * chain, but {@link Route} and {@link RouteAlias} will not be taken into * consideration. * * @param path * path to register navigation target to * @param navigationTarget * navigation target to register * @throws InvalidRouteConfigurationException * thrown if exact route already defined in this scope */ public void setParentAnnotatedRoute(String path, Class<? extends Component> navigationTarget) { handledRegistry.setRoute(path, navigationTarget, RouteUtil.getParentLayoutsForNonRouteTarget(navigationTarget)); }
/** * Giving a navigation target here will handle the {@link Route} annotation * to get the path and also register any {@link RouteAlias} that may be on * the class. * * @param navigationTarget * navigation target to register * @throws InvalidRouteConfigurationException * thrown if exact route already defined in this scope */ public void setAnnotatedRoute(Class<? extends Component> navigationTarget) { if (!navigationTarget.isAnnotationPresent(Route.class)) { String message = String .format("Given navigationTarget %s is missing the '@Route' annotation.", navigationTarget.getName()); throw new InvalidRouteConfigurationException(message); } String route = RouteUtil.getRoutePath(navigationTarget, navigationTarget.getAnnotation(Route.class)); handledRegistry.setRoute(route, navigationTarget, RouteUtil.getParentLayouts(navigationTarget, route)); for (RouteAlias alias : navigationTarget .getAnnotationsByType(RouteAlias.class)) { String path = RouteUtil.getRouteAliasPath(navigationTarget, alias); handledRegistry.setRoute(path, navigationTarget, RouteUtil.getParentLayouts(navigationTarget, path)); } }