Ejemplo n.º 1
0
        public TabularFolderCollection(Table table, TabularObjectCache cache, Culture culture, TabularLogicalTree treeModel)
        {
            // Get a collection of all display folder paths used in the table:
            List <string> paths;

            paths = table.Measures.Select(m => m.GetDisplayFolder(culture).TrimFolder()).Union(
                table.Columns.Select(c => c.GetDisplayFolder(culture).TrimFolder()).Union(
                    table.Hierarchies.Select(h => h.GetDisplayFolder(culture).TrimFolder())))
                    .Where(n => !string.IsNullOrEmpty(n)).Distinct().OrderBy(n => n).ToList();

            foreach (var path in paths)
            {
                TabularFolder folder = null;
                var           p      = string.Empty;
                foreach (var pathBit in path.Split('\\'))
                {
                    p += string.IsNullOrEmpty(p) ? pathBit : ("\\" + pathBit);
                    if (Contains(p))
                    {
                        folder = this[p];
                    }
                    else
                    {
                        var newFolder = new TabularFolder(table, culture, p, cache, treeModel);
                        this.Add(newFolder);
                        if (folder != null)
                        {
                            folder.ChildFolders.Add(newFolder);
                        }
                        folder = newFolder;
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public TabularFolder(Table table, Culture culture, string path, TabularObjectCache cache, TabularLogicalTree treeModel)
        {
            ChildFolders = new List <TabularFolder>();

            TreeModel = treeModel;
            _table    = table;
            Culture   = culture;
            Path      = path;
            _cache    = cache;
        }
Ejemplo n.º 3
0
 public IEnumerable <TabularHierarchyLevel> GetLevels(TabularObjectCache cache)
 {
     return(Hierarchy.Levels.Select(l => cache[l] as TabularHierarchyLevel));
 }