Пример #1
0
        private static TreeNode BuildInnerTree(XElement element, TreeNode parentNode, Tree tree)
        {
            TreeNode treeNode = TreeNodeCreatorFactory.CreateTreeNode(element, tree);

            if (treeNode == null)
            {
                return(null);
            }


            // Actions
            XElement actionsElement = element.Element(TreeMarkupConstants.Namespace + "Actions");

            if (actionsElement != null)
            {
                foreach (XElement actionElement in actionsElement.Elements())
                {
                    ActionNode actionNode = ActionNodeCreatorFactory.CreateActionNode(actionElement, tree);

                    if (actionNode != null)
                    {
                        treeNode.AddActionNode(actionNode);
                    }
                }
            }


            // OrderBys
            XElement orderBysElement = element.Element(TreeMarkupConstants.Namespace + "OrderBy");

            if (orderBysElement != null)
            {
                foreach (XElement orderByElement in orderBysElement.Elements())
                {
                    OrderByNode orderByNode = OrderByNodeCreatorFactory.CreateOrderByNode(orderByElement, tree);

                    if (orderByNode != null)
                    {
                        treeNode.AddOrderByNode(orderByNode);
                    }
                }
            }


            // Filters
            XElement filtersElement = element.Element(TreeMarkupConstants.Namespace + "Filters");

            if (filtersElement != null)
            {
                foreach (XElement filterElement in filtersElement.Elements())
                {
                    FilterNode filterNode = FilterNodeCreatorFactory.CreateFilterNode(filterElement, tree);

                    if (filterNode != null)
                    {
                        treeNode.AddFilterNode(filterNode);
                    }
                }
            }



            if (parentNode != null)
            {
                parentNode.AddChildTreeNode(treeNode);
            }



            // Children
            XElement childrenElement = element.Element(TreeMarkupConstants.Namespace + "Children");

            if (childrenElement != null)
            {
                foreach (XElement childElement in childrenElement.Elements())
                {
                    BuildInnerTree(childElement, treeNode, tree);
                }
            }


            treeNode.InitializeActions();
            treeNode.InitializeOrderByes();
            treeNode.InitializeFilters();

            return(treeNode);
        }
Пример #2
0
        private static TreeNode BuildInnerTree(XElement element, TreeNode parentNode, Tree tree)
        {
            TreeNode treeNode = TreeNodeCreatorFactory.CreateTreeNode(element, tree);
            if (treeNode == null) return null;


            // Actions
            XElement actionsElement = element.Element(TreeMarkupConstants.Namespace + "Actions");
            if (actionsElement != null)
            {
                foreach (XElement actionElement in actionsElement.Elements())
                {
                    ActionNode actionNode = ActionNodeCreatorFactory.CreateActionNode(actionElement, tree);

                    if (actionNode != null)
                    {
                        treeNode.AddActionNode(actionNode);
                    }
                }
            }


            // OrderBys
            XElement orderBysElement = element.Element(TreeMarkupConstants.Namespace + "OrderBy");
            if (orderBysElement != null)
            {
                foreach (XElement orderByElement in orderBysElement.Elements())
                {
                    OrderByNode orderByNode = OrderByNodeCreatorFactory.CreateOrderByNode(orderByElement, tree);

                    if (orderByNode != null)
                    {
                        treeNode.AddOrderByNode(orderByNode);
                    }
                }
            }


            // Filters
            XElement filtersElement = element.Element(TreeMarkupConstants.Namespace + "Filters");
            if (filtersElement != null)
            {
                foreach (XElement filterElement in filtersElement.Elements())
                {
                    FilterNode filterNode = FilterNodeCreatorFactory.CreateFilterNode(filterElement, tree);

                    if (filterNode != null)
                    {
                        treeNode.AddFilterNode(filterNode);
                    }
                }
            }



            if (parentNode != null)
            {
                parentNode.AddChildTreeNode(treeNode);
            }
            


            // Children
            XElement childrenElement = element.Element(TreeMarkupConstants.Namespace + "Children");
            if (childrenElement != null)
            {
                foreach (XElement childElement in childrenElement.Elements())
                {
                    BuildInnerTree(childElement, treeNode, tree);
                }
            }


            treeNode.InitializeActions();
            treeNode.InitializeOrderByes();
            treeNode.InitializeFilters();           

            return treeNode;
        }