Search in sources :

Example 1 with Route

use of io.jmix.ui.navigation.Route in project jmix by jmix-framework.

the class UiControllerMeta method extractRouteDefinition.

@Nullable
protected RouteDefinition extractRouteDefinition() {
    Map<String, Object> route = getAnnotationAttributes(Route.class.getName());
    if (route == null) {
        route = traverseForRoute();
    }
    RouteDefinition routeDefinition = null;
    if (route != null) {
        String pathAttr = (String) route.get(Route.PATH_ATTRIBUTE);
        String parentPrefixAttr = (String) route.get(Route.PARENT_PREFIX_ATTRIBUTE);
        boolean rootRoute = (boolean) route.get(Route.ROOT_ATTRIBUTE);
        routeDefinition = new RouteDefinition(pathAttr, parentPrefixAttr, rootRoute);
    }
    return routeDefinition;
}
Also used : RouteDefinition(io.jmix.ui.navigation.RouteDefinition) Route(io.jmix.ui.navigation.Route) Nullable(javax.annotation.Nullable)

Example 2 with Route

use of io.jmix.ui.navigation.Route in project jmix by jmix-framework.

the class UiControllerMeta method traverseForRoute.

@Nullable
protected Map<String, Object> traverseForRoute(Class screenClass) {
    // noinspection unchecked
    Class<? extends FrameOwner> superClass = screenClass.getSuperclass();
    if (Screen.class.getName().equals(superClass.getName())) {
        return null;
    }
    Route route = superClass.getAnnotation(Route.class);
    return route != null ? getControllerAnnotationAttributes(Route.class.getName(), superClass) : traverseForRoute(superClass);
}
Also used : Screen(io.jmix.ui.screen.Screen) Route(io.jmix.ui.navigation.Route) Nullable(javax.annotation.Nullable)

Aggregations

Route (io.jmix.ui.navigation.Route)2 Nullable (javax.annotation.Nullable)2 RouteDefinition (io.jmix.ui.navigation.RouteDefinition)1 Screen (io.jmix.ui.screen.Screen)1