protected RouteDefinition loadRouteDefinition(Element screenElement) { String screenId = screenElement.attributeValue("id"); String route = screenElement.attributeValue("route"); String parentPrefix = screenElement.attributeValue("routeParentPrefix"); RouteDefinition routeDefinition; WindowInfo superScreen = screens.get(screenId); RouteDefinition superScreenRouteDefinition = superScreen != null ? superScreen.getRouteDefinition() : null; if (route != null && !route.isEmpty()) { if (superScreenRouteDefinition != null) { String superScreenRoute = superScreenRouteDefinition.getPath(); String superScreenParentPrefix = superScreenRouteDefinition.getParentPrefix(); if (!route.equals(superScreenRoute)) { routes.remove(superScreenRoute); } if (parentPrefix == null || parentPrefix.isEmpty()) { parentPrefix = superScreenParentPrefix; } } routeDefinition = new RouteDefinition(route, parentPrefix); } else { routeDefinition = superScreenRouteDefinition; } return routeDefinition; }
protected String buildDialogRoute(Screen dialog) { RouteDefinition dialogRouteDefinition = getRouteDef(dialog); Iterator<Screen> currentTabScreens = ui.getScreens().getOpenedScreens().getCurrentBreadcrumbs().iterator(); Screen currentScreen = currentTabScreens.hasNext() ? currentTabScreens.next() : null; String currentScreenRoute = currentScreen != null ? buildScreenRoute(currentScreen) : ""; if (dialogRouteDefinition == null) { return currentScreenRoute; } String dialogRoute = dialogRouteDefinition.getPath(); if (dialogRoute == null || dialogRoute.isEmpty()) { return currentScreenRoute; } String parentPrefix = dialogRouteDefinition.getParentPrefix(); if (StringUtils.isNotEmpty(parentPrefix) && dialogRoute.startsWith(parentPrefix + '/') && currentScreenRoute.endsWith(parentPrefix)) { dialogRoute = dialogRoute.substring(parentPrefix.length() + 1); } return currentScreenRoute == null || currentScreenRoute.isEmpty() ? dialogRoute : currentScreenRoute + '/' + dialogRoute; }
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; }