com.vaadin.flow.server.startup.
Class RouteTarget
- java.lang.Object
-
- com.vaadin.flow.server.startup.RouteTarget
-
All Implemented Interfaces:
public class RouteTarget extends Object implements Serializable
Route target holder that handles getting the correct type of has parameter target.
See Also:
-
-
Constructor Summary
Constructors Constructor and Description RouteTarget(Class<? extends Component> target)
Create a new Route target holder.
-
Method Summary
All Methods Modifier and Type Method and Description void
addRoute(Class<? extends Component> target)
Add a new route navigation target.
Class<? extends Component>
getTarget(List<String> segments)
Get route target for given segments.
ThemeDefinition
getThemeFor(Class<?> target)
Gets the theme that should be used for the given navigation target.
void
setThemeFor(Class<?> target, ThemeDefinition theme)
Sets the theme used by this RouteTarget for a given navigation target.
-
-
-
Constructor Detail
-
RouteTarget
public RouteTarget(Class<? extends Component> target) throws InvalidRouteConfigurationException
Create a new Route target holder.
Parameters:
target
- navigation targetThrows:
InvalidRouteConfigurationException
- exception for miss configured routes where navigation targets can not be clearly selected
-
-
Method Detail
-
addRoute
public void addRoute(Class<? extends Component> target) throws InvalidRouteConfigurationException
Add a new route navigation target.
When adding a new target it will be validated that it is a valid path to add with the already existing navigation targets.
Parameters:
target
- navigation target to addThrows:
InvalidRouteConfigurationException
- exception for miss configured routes where navigation targets can not be clearly selected
-
getTarget
public Class<? extends Component> getTarget(List<String> segments)
Get route target for given segments.
Parameters:
segments
- route segmentsReturns:
navigation target corresponding to given segments
-
setThemeFor
public void setThemeFor(Class<?> target, ThemeDefinition theme)
Sets the theme used by this RouteTarget for a given navigation target.
Parameters:
target
- navigation targettheme
- themeDefinition to be used when the navigation target is used
-
getThemeFor
public ThemeDefinition getThemeFor(Class<?> target)
Gets the theme that should be used for the given navigation target.
Parameters:
target
- navigation targetReturns:
theme class to be used when the navigation target is used, or
null
if no theme was set for it
-
-