/** * Localized menu item caption. * * @param id screen ID as defined in <code>screens.xml</code> * @deprecated Use {@link MenuConfig#getItemCaption(String)} */ @Deprecated public static String getMenuItemCaption(String id) { MenuConfig menuConfig = AppBeans.get(MenuConfig.NAME); return menuConfig.getItemCaption(id); }
String caption = menuConfig.getItemCaption(screen);
protected void initDefaultScreenField() { boolean screenSelectionEnabled = webConfig.getUserCanChooseDefaultScreen(); if (!screenSelectionEnabled) { defaultScreenField.setEditable(false); defaultScreenField.setDescription(getMessage("defaultScreenSelectionDisabled")); } Map<String, String> map = new LinkedHashMap<>(); for (MenuItem item : collectPermittedScreens(menuConfig.getRootItems())) { map.put(menuConfig.getItemCaption(item.getId()), item.getScreen()); } defaultScreenField.setOptionsMap(map); String defaultScreen = userSettingService.loadSetting(ClientType.WEB, "userDefaultScreen"); if (StringUtils.isEmpty(defaultScreen) || !screenSelectionEnabled) { defaultScreen = webConfig.getDefaultScreenId(); } defaultScreenField.setValue(defaultScreen); }
private void walkMenu(MenuItem info, Node<BasicPermissionTarget> node) { String id = info.getId(); String caption = menuConfig.getItemCaption(id) .replaceAll("<.+?>", "") .replaceAll(">", ""); caption = StringEscapeUtils.unescapeHtml4(caption); if (info.getChildren() != null && !info.getChildren().isEmpty()) { Node<BasicPermissionTarget> n = new Node<>(new BasicPermissionTarget("category:" + id, caption, id)); node.addChild(n); for (MenuItem item : info.getChildren()) { walkMenu(item, n); } } else { if (!info.isSeparator()) { Node<BasicPermissionTarget> n = new Node<>(new BasicPermissionTarget("item:" + id, caption, id)); node.addChild(n); } } }
protected void createMenuBarItem(Window webWindow, MenuItem item) { if (item.isPermitted(session)) { AppMenu.MenuItem menuItem = appMenu.createMenuItem(item.getId(), menuConfig.getItemCaption(item.getId()), null, createMenuBarCommand(item)); assignShortcut(webWindow, menuItem, item); assignStyleName(menuItem, item); assignIcon(menuItem, item); assignDescription(menuItem, item); createSubMenu(webWindow, menuItem, item, session); if (!isMenuItemEmpty(menuItem)) { appMenu.addMenuItem(menuItem); } } }
menuConfig.getItemCaption(child.getId()), null, createMenuBarCommand(child)); if (child.isPermitted(session)) { AppMenu.MenuItem menuItem = appMenu.createMenuItem(child.getId(), menuConfig.getItemCaption(child.getId()), null, null);
protected void createMenuBarItem(Window webWindow, SideMenu menu, MenuItem item) { if (item.isPermitted(session)) { SideMenu.MenuItem menuItem = menu.createMenuItem(item.getId(), menuConfig.getItemCaption(item.getId()), null, createMenuBarCommand(item)); createSubMenu(webWindow, menu, menuItem, item, session); assignStyleName(menuItem, item); assignIcon(menuItem, item); assignDescription(menuItem, item); assignExpanded(menuItem, item); assignShortcut(webWindow, menuItem, item); if (!isMenuItemEmpty(menuItem)) { menu.addMenuItem(menuItem); } } }
protected void createSubMenu(Window webWindow, SideMenu menu, SideMenu.MenuItem vItem, MenuItem parentItem, UserSession session) { if (parentItem.isPermitted(session)) { for (MenuItem child : parentItem.getChildren()) { if (child.isSeparator()) { continue; } if (child.isPermitted(session)) { SideMenu.MenuItem menuItem = menu.createMenuItem(child.getId(), menuConfig.getItemCaption(child.getId())); assignDescription(menuItem, child); assignIcon(menuItem, child); assignStyleName(menuItem, child); if (child.getChildren().isEmpty()) { menuItem.setCommand(createMenuBarCommand(child)); assignShortcut(webWindow, menuItem, child); vItem.addChildItem(menuItem); } else { createSubMenu(webWindow, menu, menuItem, child, session); assignExpanded(menuItem, child); if (!isMenuItemEmpty(menuItem)) { vItem.addChildItem(menuItem); } } } } } }