public void GetNodes()
    {
        XmlTree        xTree      = new XmlTree();
        ITreeService   treeParams = new TreeService(1099, "content", false, false, TreeDialogModes.none, null);
        TreeDefinition tree       = TreeDefinitionCollection.Instance.FindTree("content");
        BaseTree       instance   = tree.CreateInstance();

        instance.SetTreeParameters((ITreeService)treeParams);
        instance.Render(ref xTree);
        Response.ContentType = "application/json";
        Response.Write(((object)xTree).ToString());
    }
Example #2
0
        /// <summary>
        /// This will load the particular ITree object and call it's render method to get the nodes that need to be rendered.
        /// </summary>
        /// <param name="appAlias"></param>
        /// <param name="treeAlias"></param>
        private void LoadTree(string treeAlias)
        {
            TreeDefinition treeDef = TreeDefinitionCollection.Instance.FindTree(treeAlias);

            if (treeDef != null)
            {
                BaseTree bTree = treeDef.CreateInstance();
                bTree.SetTreeParameters(m_treeParams);
                bTree.Render(ref m_xTree);
            }
            else
            {
                LoadNullTree();
            }
        }
Example #3
0
        /// <summary>
        /// This will load the particular ITree object and call it's render method to get the nodes that need to be rendered.
        /// </summary>
        /// <param name="treeParams"></param>
        private void LoadTree(TreeRequestParams treeParams)
        {
            TreeDefinition treeDef = TreeDefinitionCollection.Instance.FindTree(treeParams.TreeType);

            if (treeDef != null)
            {
                BaseTree bTree = treeDef.CreateInstance();
                bTree.SetTreeParameters(treeParams);
                bTree.Render(ref _xTree);
            }
            else
            {
                LoadNullTree(treeParams);
            }
        }
        internal static BaseTree GetLegacyTreeForLegacyServices(Core.Models.ApplicationTree appTree)
        {
            if (appTree == null)
            {
                throw new ArgumentNullException("appTree");
            }

            BaseTree tree;

            var controllerAttempt = appTree.TryGetControllerTree();

            if (controllerAttempt.Success)
            {
                var legacyAtt = controllerAttempt.Result.GetCustomAttribute <LegacyBaseTreeAttribute>(false);
                if (legacyAtt == null)
                {
                    LogHelper.Warn <LegacyTreeDataConverter>("Cannot render tree: " + appTree.Alias + ". Cannot render a " + typeof(TreeController) + " tree type with the legacy web services unless attributed with " + typeof(LegacyBaseTreeAttribute));
                    return(null);
                }

                var treeDef = new TreeDefinition(
                    legacyAtt.BaseTreeType,
                    new ApplicationTree(false, true, (byte)appTree.SortOrder, appTree.ApplicationAlias, appTree.Alias, appTree.Title, appTree.IconClosed, appTree.IconOpened, "", legacyAtt.BaseTreeType.GetFullNameWithAssembly(), ""),
                    new Application(appTree.Alias, appTree.Alias, "", 0));

                tree           = treeDef.CreateInstance();
                tree.TreeAlias = appTree.Alias;
            }
            else
            {
                //get the tree that we need to render
                var treeDef = TreeDefinitionCollection.Instance.FindTree(appTree.Alias);
                if (treeDef == null)
                {
                    return(null);
                }
                tree = treeDef.CreateInstance();
            }

            return(tree);
        }