/** * Gets a human-readable title for the module, or null if none. * <p> * We do not use {@link ModuleInfo#getTitle()} because that method tries very * hard to return something in every case, whereas we only want to give really * nice titles, or null if the module is inappropriate. * </p> */ public static String title(final ModuleInfo info) { // use object label, if available final String label = info.getLabel(); if (label != null && !label.isEmpty()) return label; // use name of leaf menu item, if available final MenuPath menuPath = info.getMenuPath(); if (menuPath != null && menuPath.size() > 0) { final MenuEntry menuLeaf = menuPath.getLeaf(); final String menuName = menuLeaf.getName(); if (menuName != null && !menuName.isEmpty()) return menuName; } return null; }