Exemplo n.º 1
0
        /// <summary>
        /// Create a Dataflow Node
        /// </summary>
        /// <param name="dataflow">
        /// The SDMX Model Dataflow object
        /// </param>
        /// <returns>
        /// The Dataflow Node
        /// </returns>
        private JsTreeNode CreateDataflowNode(IDataflowObject dataflow)
        {
            var dataflowNode = new JsTreeNode();

            // dataflowNode.data.attributes.rel = MakeKey(dataflow);
            dataflowNode.SetId(Utils.MakeKey(dataflow).Replace('.', '_').Replace('+', '-'));
            SetupNode(dataflowNode, dataflow);
            IDataStructureObject dsd = NsiClientHelper.GetDsdFromDataflow(dataflow, _dataStructure);

            if (dsd != null && NsiClientHelper.DataflowDsdIsCrossSectional(dsd))
            {
                dataflowNode.SetRel("xs-dataflow");
            }
            else
            {
                dataflowNode.SetRel("dataflow");
            }
            dataflowNode.AddClass("dataflow-item");
            dataflowNode.SetLeaf(true);

            // dataflowNode.state = "closed";
            dataflowNode.metadata = new JSTreeMetadata
            {
                DataflowID      = dataflow.Id,
                DataflowVersion = dataflow.Version,
                DataflowAgency  = dataflow.AgencyId
            };

            // dataflowNode.metadata.dataflow_name = dataflow.PrimaryName;
            return(dataflowNode);
        }
        /// <summary>
        /// Build the  <see cref="_idNodeMap"/>
        /// </summary>
        private void BuildIdNodeMap()
        {
            this._idNodeMap.Clear();
            this._rootNodes.Clear();
            this._prevCulture = Thread.CurrentThread.CurrentUICulture;
            var needParent = new Queue <ICode>();

            foreach (ICode code in this._codeList.Items)
            {
                var node = new JsTreeNode();
                node.SetId(string.Format(CultureInfo.InvariantCulture, "{0}{1}", IDPrefix, code.Id));
                SetupNode(node, code);
                this._idNodeMap.Add(code, node);
                node.SetLeaf(true);
                if (!string.IsNullOrEmpty(code.ParentCode))
                {
                    needParent.Enqueue(code);
                }
                else
                {
                    this._rootNodes.Add(node);
                }
            }

            while (needParent.Count > 0)
            {
                ICode      code = needParent.Dequeue();
                JsTreeNode child;
                if (this._idNodeMap.TryGetValue(code, out child))
                {
                    var        parentCode = (ICode)this._codeList.GetCodeById(code.ParentCode);
                    JsTreeNode parent;
                    if (this._idNodeMap.TryGetValue(parentCode, out parent))
                    {
                        parent.state = JSTreeConstants.OpenState;
                        parent.SetLeaf(false);
                        parent.children.Add(child);
                    }
                }
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Build the  <see cref="_idNodeMap"/>
        /// </summary>
        private void BuildIdNodeMap()
        {
            this._idNodeMap.Clear();
            this._rootNodes.Clear();
            this._prevCulture = Thread.CurrentThread.CurrentUICulture;
            var needParent = new Queue<ICode>();
            foreach (ICode code in this._codeList.Items)
            {
                var node = new JsTreeNode();
                node.SetId(string.Format(CultureInfo.InvariantCulture, "{0}{1}", IDPrefix, code.Id));
                SetupNode(node, code);
                this._idNodeMap.Add(code, node);
                node.SetLeaf(true);
                if (!string.IsNullOrEmpty(code.ParentCode))
                {
                    needParent.Enqueue(code);
                }
                else
                {
                    this._rootNodes.Add(node);
                }
            }

            while (needParent.Count > 0)
            {
                ICode code = needParent.Dequeue();
                JsTreeNode child;
                if (this._idNodeMap.TryGetValue(code, out child))
                {
                    var parentCode = (ICode)this._codeList.GetCodeById(code.ParentCode);
                    JsTreeNode parent;
                    if (this._idNodeMap.TryGetValue(parentCode, out parent))
                    {
                        parent.state = JSTreeConstants.OpenState;
                        parent.SetLeaf(false);
                        parent.children.Add(child);
                    }
                }
            }
        }
        /// <summary>
        /// Create a Dataflow Node
        /// </summary>
        /// <param name="dataflow">
        /// The SDMX Model Dataflow object
        /// </param>
        /// <returns>
        /// The Dataflow Node
        /// </returns>
        private JsTreeNode CreateDataflowNode(IDataflowObject dataflow)
        {
            var dataflowNode = new JsTreeNode();

            // dataflowNode.data.attributes.rel = MakeKey(dataflow);
            dataflowNode.SetId(Utils.MakeKey(dataflow).Replace('.', '_').Replace('+', '-'));
            SetupNode(dataflowNode, dataflow);
            IDataStructureObject dsd = NsiClientHelper.GetDsdFromDataflow(dataflow, _dataStructure);
            if (dsd != null && NsiClientHelper.DataflowDsdIsCrossSectional(dsd))
            {
                dataflowNode.SetRel("xs-dataflow");
            }
            else
            {
                dataflowNode.SetRel("dataflow");
            }
            dataflowNode.AddClass("dataflow-item");
            dataflowNode.SetLeaf(true);

            // dataflowNode.state = "closed";
            dataflowNode.metadata = new JSTreeMetadata
            {
                DataflowID = dataflow.Id,
                DataflowVersion = dataflow.Version,
                DataflowAgency = dataflow.AgencyId
            };

            // dataflowNode.metadata.dataflow_name = dataflow.PrimaryName;
            return dataflowNode;
        }