public virtual XTreeMenuInfo GetMenu(XGetTreeMenuRequest request, IXExecutionContext context, XTreePageInfoStd treePage) { XTreeStructInfo treeStructInfo = treePage.TreeStruct; XTreeLevelInfoIT treelevel = treeStructInfo.Executor.GetTreeLevel(treeStructInfo, request.Params, request.Path); XTreeMenuInfo treemenu = treelevel.GetMenu(request, context); if (treemenu == null) { treemenu = treePage.DefaultLevelMenu.GetMenu(treelevel, request, context); } return(treemenu); }
/// <summary> /// Возвращает описатель меню по метаданным /// </summary> /// <param name="xmlMenu">xml-узел i:level-menu,i:empty-tree-menu,i:default-level-menu</param> /// <returns>Объект меню или null, если метаописание меню не содержит структуры (i:menu)</returns> protected XTreeMenuInfo createMenuInfo(XmlElement xmlMenu) { XTreeMenuInfo menu = null; XmlNamespaceManager nsMan = m_mdManager.NamespaceManager; XTreeMenuCacheMode cacheMode; string sValue = xmlMenu.GetAttribute("cache-for"); if (sValue.Length > 0) { cacheMode = XTreeMenuCacheModeParser.Parse(sValue); } else { cacheMode = XTreeMenuCacheMode.Unknow; } xmlMenu = (XmlElement)xmlMenu.SelectSingleNode("i:menu", nsMan); if (xmlMenu != null) { string sCaption; XmlNode node = xmlMenu.SelectSingleNode("i:caption/text() | @t", nsMan); if (node != null) { sCaption = node.InnerText; } else { sCaption = String.Empty; } menu = new XTreeMenuInfo(sCaption); // заполним коллекции обрабочиков foreach (XmlElement xmlNode in xmlMenu.SelectNodes("i:macros-resolver", nsMan)) { menu.MacroResolvers.Add(new XUserCodeWeb(xmlNode.InnerText, xmlNode.GetAttribute("mode") == "replace")); } foreach (XmlElement xmlNode in xmlMenu.SelectNodes("i:visibility-handler", nsMan)) { menu.VisibilityHandlers.Add(new XUserCodeWeb(xmlNode.InnerText, xmlNode.GetAttribute("mode") == "replace")); } foreach (XmlElement xmlNode in xmlMenu.SelectNodes("i:execution-handler", nsMan)) { menu.ExecutionHandlers.Add(new XUserCodeWeb(xmlNode.InnerText, xmlNode.GetAttribute("mode") == "replace")); } buildMenuItems(menu, xmlMenu); menu.CacheMode = cacheMode; } return(menu); }
public override XMenuItemBase Clone() { XTreeMenuInfo menu = new XTreeMenuInfo(this.Caption, this.Trustworthy); menu.CacheMode = this.CacheMode; menu.ExecutionHandlers.AddRange(this.ExecutionHandlers); menu.VisibilityHandlers.AddRange(this.VisibilityHandlers); menu.MacroResolvers.AddRange(this.MacroResolvers); menu.Stylesheet = this.Stylesheet; foreach (XMenuItemBase item in this.Items) { menu.Items.Add(item.Clone()); } return(menu); }
public XTreeMenuHandler CreateMenuHandler(XmlElement xmlLevelMenu) { XTreeMenuHandler menuHandler; if (xmlLevelMenu == null) { menuHandler = XTreeMenuHandler.Empty; } else { XTreeMenuInfo menuInfo = createMenuInfo(xmlLevelMenu); IXTreeLevelMenuDataProvider prv = getTreeLevelMenuDataProvider(xmlLevelMenu); if (menuInfo == null && prv == null) { menuHandler = XTreeMenuHandler.Empty; } else { menuHandler = new XTreeMenuHandler(menuInfo, prv); } } return(menuHandler); }
public XTreeMenuHandler(XTreeMenuInfo menuMD, IXTreeLevelMenuDataProvider dataProvider) { m_menuMD = menuMD; m_dataProvider = dataProvider; }