/** * Remove target route from this RouteTarget. * This will also clear the parent layout chain for the target. * * @param targetRoute * route to remove */ public void remove(Class<? extends Component> targetRoute) { throwIfImmutable(); if (targetRoute.equals(normal)) { normal = null; } else if (targetRoute.equals(parameter)) { parameter = null; } else if (targetRoute.equals(optionalParameter)) { optionalParameter = null; } else if (targetRoute.equals(wildCardParameter)) { wildCardParameter = null; } parentLayouts.remove(targetRoute); }
/** * Add a new route navigation target. * <p> * When adding a new target it will be validated that it is a valid path to * add with the already existing navigation targets. * * @param target * navigation target to add * @throws InvalidRouteConfigurationException * exception for miss configured routes where navigation targets * can not be clearly selected */ public void addRoute(Class<? extends Component> target) { throwIfImmutable(); addTargetByType(target); }
/** * Set the parent layout chain for target component. This will override any * existing parent layout chain for the target. * <p> * Note! if adding parents for a non registered target an * IllegalArgumentException will be thrown. * * @param target * target to add chain for * @param parents * parent layout chain */ public void setParentLayouts(Class<? extends Component> target, List<Class<? extends RouterLayout>> parents) { throwIfImmutable(); if (!containsTarget(target)) { throw new IllegalArgumentException( "Tried to add parent layouts for a non existing target " + target.getName()); } parentLayouts.put(target, Collections.unmodifiableList(new ArrayList<>(parents))); }