/// <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> /// Create a CategoryScheme Node /// </summary> /// <param name="categoryScheme"> /// The SDMX Model category scheme object /// </param> /// <returns> /// The CategoryScheme Node /// </returns> private static JsTreeNode CreateCategorySchemeNode(ICategorySchemeObject categoryScheme) { var categorySchemeNode = new JsTreeNode(); // categorySchemeNode.data.attributes["rel"] = MakeKey(categoryScheme); categorySchemeNode.SetId(Utils.MakeKey(categoryScheme).Replace('.', '_')); // categorySchemeNode.data.icon = "folder"; categorySchemeNode.SetRel("category-scheme"); SetupNode(categorySchemeNode, categoryScheme); return(categorySchemeNode); }
/// <summary> /// Create a Category Node /// </summary> /// <param name="category"> /// The SDMX Model category object /// </param> /// <param name="categoryCount"> /// The caregory counter. This methods updates it /// </param> /// <returns> /// The Category Node /// </returns> private static JsTreeNode CreateCategoryNode(ICategoryObject category, ref int categoryCount) { var categoryNode = new JsTreeNode(); // categoryNode.data.attributes["rel"] = category.Id; // categoryNode.SetId(category.Id); categoryNode.SetId( string.Format( CultureInfo.InvariantCulture, CategoryIdFormat, categoryCount.ToString("x", CultureInfo.InvariantCulture))); categoryCount++; SetupNode(categoryNode, category); categoryNode.SetRel("category"); return(categoryNode); }
/// <summary> /// Build a JQuery plugin JSTree JSON_DATA json string. It uses the <see cref="_dataflows"/> and <see cref="_categories"/> /// </summary> /// <returns> /// A list of nodes /// </returns> private List <JsTreeNode> BuildJSTree() { this._prevCulture = Thread.CurrentThread.CurrentUICulture; var categorisedDataflowIndex = new Dictionary <string, IDataflowObject>(); var uncategorisedDataflow = new List <IDataflowObject>(); var nodeList = new List <JsTreeNode>(); foreach (IDataflowObject d in this._dataflows) { if (GetCategorisations(d, _categorisations).Count == 0) { uncategorisedDataflow.Add(d); } else { string key = Utils.MakeKey(d); categorisedDataflowIndex.Add(key, d); } } nodeList.AddRange(CreateCategorisedNodes(this._categories, categorisedDataflowIndex)); var uncategorisedNode = new JsTreeNode(); //////var data = new Data(); uncategorisedNode.SetRel("category-scheme"); uncategorisedNode.SetId("uncategorised"); ////data.title = Messages.text_dataflows_uncategorized; ////uncategorisedNode.data.Add(data); uncategorisedNode.data = Messages.text_dataflows_uncategorized; foreach (IDataflowObject dataflow in uncategorisedDataflow) { uncategorisedNode.children.Add(CreateDataflowNode(dataflow)); } if (uncategorisedNode.children.Count > 0) { nodeList.Add(uncategorisedNode); } return(nodeList); }
/// <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 a JQuery plugin JSTree JSON_DATA json string. It uses the <see cref="_dataflows"/> and <see cref="_categories"/> /// </summary> /// <returns> /// A list of nodes /// </returns> private List<JsTreeNode> BuildJSTree() { this._prevCulture = Thread.CurrentThread.CurrentUICulture; var categorisedDataflowIndex = new Dictionary<string, IDataflowObject>(); var uncategorisedDataflow = new List<IDataflowObject>(); var nodeList = new List<JsTreeNode>(); foreach (IDataflowObject d in this._dataflows) { if (GetCategorisations(d, _categorisations).Count == 0) { uncategorisedDataflow.Add(d); } else { string key = Utils.MakeKey(d); categorisedDataflowIndex.Add(key, d); } } nodeList.AddRange(CreateCategorisedNodes(this._categories, categorisedDataflowIndex)); var uncategorisedNode = new JsTreeNode(); //////var data = new Data(); uncategorisedNode.SetRel("category-scheme"); uncategorisedNode.SetId("uncategorised"); ////data.title = Messages.text_dataflows_uncategorized; ////uncategorisedNode.data.Add(data); uncategorisedNode.data = Messages.text_dataflows_uncategorized; foreach (IDataflowObject dataflow in uncategorisedDataflow) { uncategorisedNode.children.Add(CreateDataflowNode(dataflow)); } if (uncategorisedNode.children.Count > 0) { nodeList.Add(uncategorisedNode); } return nodeList; }
/// <summary> /// Create a CategoryScheme Node /// </summary> /// <param name="categoryScheme"> /// The SDMX Model category scheme object /// </param> /// <returns> /// The CategoryScheme Node /// </returns> private static JsTreeNode CreateCategorySchemeNode(ICategorySchemeObject categoryScheme) { var categorySchemeNode = new JsTreeNode(); // categorySchemeNode.data.attributes["rel"] = MakeKey(categoryScheme); categorySchemeNode.SetId(Utils.MakeKey(categoryScheme).Replace('.', '_')); // categorySchemeNode.data.icon = "folder"; categorySchemeNode.SetRel("category-scheme"); SetupNode(categorySchemeNode, categoryScheme); return categorySchemeNode; }
/// <summary> /// Create a Category Node /// </summary> /// <param name="category"> /// The SDMX Model category object /// </param> /// <param name="categoryCount"> /// The caregory counter. This methods updates it /// </param> /// <returns> /// The Category Node /// </returns> private static JsTreeNode CreateCategoryNode(ICategoryObject category, ref int categoryCount) { var categoryNode = new JsTreeNode(); // categoryNode.data.attributes["rel"] = category.Id; // categoryNode.SetId(category.Id); categoryNode.SetId( string.Format( CultureInfo.InvariantCulture, CategoryIdFormat, categoryCount.ToString("x", CultureInfo.InvariantCulture))); categoryCount++; SetupNode(categoryNode, category); categoryNode.SetRel("category"); return categoryNode; }