Search in sources :

Example 1 with Route

use of com.haulmont.cuba.gui.Route in project cuba by cuba-platform.

the class WebUrlRouting method getParentPrefix.

protected String getParentPrefix(Screen screen) {
    String parentPrefix = null;
    Route routeAnnotation = screen.getClass().getAnnotation(Route.class);
    if (routeAnnotation != null) {
        parentPrefix = routeAnnotation.parentPrefix();
    } else {
        RouteDefinition routeDef = getScreenContext(screen).getWindowInfo().getRouteDefinition();
        if (routeDef != null) {
            parentPrefix = routeDef.getParentPrefix();
        }
    }
    return parentPrefix;
}
Also used : RouteDefinition(com.haulmont.cuba.gui.sys.RouteDefinition) Preconditions.checkNotEmptyString(com.haulmont.bali.util.Preconditions.checkNotEmptyString) Route(com.haulmont.cuba.gui.Route)

Example 2 with Route

use of com.haulmont.cuba.gui.Route in project cuba by cuba-platform.

the class UiControllerClassMeta method traverseForRoute.

@Nullable
protected Route 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 ? route : traverseForRoute(superClass);
}
Also used : Screen(com.haulmont.cuba.gui.screen.Screen) Route(com.haulmont.cuba.gui.Route) Nullable(javax.annotation.Nullable)

Example 3 with Route

use of com.haulmont.cuba.gui.Route in project cuba by cuba-platform.

the class UiControllerClassMeta method getControllerRouteDefinition.

protected RouteDefinition getControllerRouteDefinition(Class<? extends FrameOwner> screenClass) {
    Route route = screenClass.getAnnotation(Route.class);
    if (route == null) {
        route = traverseForRoute(screenClass);
    }
    RouteDefinition routeDefinition = null;
    if (route != null) {
        String pathAttr = route.path();
        String parentPrefixAttr = route.parentPrefix();
        boolean rootRoute = route.root();
        routeDefinition = new RouteDefinition(pathAttr, parentPrefixAttr, rootRoute);
    }
    return routeDefinition;
}
Also used : Route(com.haulmont.cuba.gui.Route)

Aggregations

Route (com.haulmont.cuba.gui.Route)3 Preconditions.checkNotEmptyString (com.haulmont.bali.util.Preconditions.checkNotEmptyString)1 Screen (com.haulmont.cuba.gui.screen.Screen)1 RouteDefinition (com.haulmont.cuba.gui.sys.RouteDefinition)1 Nullable (javax.annotation.Nullable)1