public override System.Collections.IEnumerable GetChildren(TreePath treePath)
        {
            if (_showingCollections)
            {
                if (treePath.IsEmpty())
                {
                    return(DAL.GetCollectionsInfo());
                }

                var n = (SeriesEpisodesShortInfo)treePath.LastNode;

                return(DAL.GetElementsInCollection(n.Id, n.SectionType)); //changed to another root (Collection)
            }
            else
            {
                if (treePath.IsEmpty())
                {
                    return(DAL.GetSeriesInfo());
                }

                var n = (SeriesEpisodesShortInfo)treePath.LastNode;

                return
                    (string.IsNullOrEmpty(n.Season)
                        ? DAL.GetSeasonsForSeries(n.Id) //changed to another root (Series)
                        : DAL.GetEpisodesInSeason(n.SeriesId, n.Season));
            }
        }
Beispiel #2
0
        public System.Collections.IEnumerable GetChildren(TreePath treePath)
        {
            if (!treePath.IsEmpty() && !(treePath.LastNode is RevisionBrowserBaseItem))
            {
                return(null);
            }

            List <RevisionBrowserBaseItem> items = new List <RevisionBrowserBaseItem>();

            if (treePath.IsEmpty())
            {
                items.Add(new RevisionBrowserTypeItem(RevisionType.Version, this));
                items.Add(new RevisionBrowserTypeItem(RevisionType.Commit, this));
            }
            else
            {
                if (treePath.LastNode is RevisionBrowserTypeItem parent &&
                    Data?.Revisions != null &&
                    Data.Revisions.TryGetValue(parent.Type, out IEnumerable <object> objects))
                {
                    IEnumerable <object> filteredObjects = sortAndFilter(objects);
                    int iItem = filteredObjects.Count();
                    foreach (object item in filteredObjects)
                    {
                        getItemProperties(iItem, item,
                                          out string fullSha, out string name, out DateTime timestamp, out string tooltipText);
                        bool isReviewed = _data.ReviewedRevisions.Contains(fullSha);
                        items.Add(new RevisionBrowserItem(name, timestamp, fullSha, parent, this, tooltipText, isReviewed, iItem));
                        --iItem;
                    }
                }
            }
            return(items);
        }
 public IEnumerable GetChildren(TreePath treePath)
 {
     if (treePath.IsEmpty())
     {
         yield return(root);
     }
     else
     {
         Node node = treePath.LastNode as Node;
         if (node != null)
         {
             if (0 != node.Childs.Count)
             {
                 foreach (Node n in node.Childs)
                 {
                     if (forceVisible || n.IsVisible)
                     {
                         yield return(n);
                     }
                 }
             }
             else
             {
                 // yield break;
             }
         }
         else
         {
             yield break;
         }
     }
 }
Beispiel #4
0
 public IEnumerable GetChildren(TreePath treePath)
 {
     if (treePath.IsEmpty())
     {
         List <BaseItem> items = new List <BaseItem>();
         int             index = 0;
         foreach (var data in pathList)
         {
             BaseItem item = new FileItem(data, null, index);
             items.Add(item);
             _nodeMap.Add(item.ItemPath, item);
             ++index;
         } // foreach
         _itemsToRead.AddRange(items);
         RunWorkerAsync();
         foreach (BaseItem item in items)
         {
             yield return(item);
         } // end foreach
     }
     else
     {
         yield break;
     } // end if
 }
Beispiel #5
0
 public override System.Collections.IEnumerable GetChildren(TreePath treePath)
 {
     if (treePath.IsEmpty())
     {
         if (_tileSet != null)
         {
             if (_tileSet.SupportsCustomFiniteDisplayScalesUnconditionally)
             {
                 yield return(new ScaleItem(Strings.FiniteDisplayScales, new List <double>(_tileSet.FiniteDisplayScale)));
             }
             foreach (var grp in _tileSet.BaseMapLayerGroups)
             {
                 yield return(new BaseLayerGroupItem(grp));
             }
         }
     }
     else
     {
         var grp = treePath.LastNode as BaseLayerGroupItem;
         if (grp != null)
         {
             if (_tileSet != null)
             {
                 foreach (var layer in _tileSet.GetLayersForGroup(grp.Tag.Name))
                 {
                     yield return(new BaseLayerItem(layer, grp.Tag));
                 }
             }
         }
     }
 }
Beispiel #6
0
        public System.Collections.IEnumerable GetChildren(TreePath treePath)
        {
            if (treePath.IsEmpty())
            {
                //get folders
            }
            else
            {
                List <BaseItem> items  = new List <BaseItem>();
                BaseItem        parent = treePath.LastNode as BaseItem;
                if (parent != null)
                {
                    var folder = parent.ItemPath;
                    //get all users

                    //foreach (string str in Directory.GetDirectories())
                    //    items.Add(new FolderItem(str, parent));

                    //_itemsToRead.AddRange(items);

                    //foreach (BaseItem item in items)
                    //    yield return item;
                    yield return(null);
                }
            }
        }
        public IEnumerable GetChildren(TreePath treePath)
        {
            if (UpdateLocks > 0)
            {
                throw new InvalidOperationException("Tree enumeration attempted while update in progress");
            }

            List <TabularNamedObject> items = new List <TabularNamedObject>();

            if (treePath.IsEmpty())
            {
                // If no root was specified, use the entire model
                if (Options.HasFlag(LogicalTreeOptions.ShowRoot))
                {
                    items.Add(Model);
                }
                else
                {
                    return(GetChildren(Model));
                }
            }
            else
            {
                return(GetChildren(treePath.LastNode as ITabularObjectContainer));
            }

            return(items);
        }
Beispiel #8
0
 public IEnumerable GetChildren(TreePath treePath)
 {
     if (treePath.IsEmpty())
     {
         if (effectiveRules != null)
         {
             yield return(effectiveRules);
         }
         foreach (var externalRules in analyzer.ExternalRuleCollections)
         {
             yield return(externalRules);
         }
         if (analyzer.ModelRules != null)
         {
             yield return(analyzer.ModelRules);
         }
         if (analyzer.LocalUserRules != null)
         {
             yield return(analyzer.LocalUserRules);
         }
         if (analyzer.LocalMachineRules != null)
         {
             yield return(analyzer.LocalMachineRules);
         }
     }
 }
Beispiel #9
0
        public bool IsLeaf(TreePath treePath)
        {
            if (treePath.IsEmpty())
            {
                var relations = _dataService.GetRelations(null);
                return(relations == null || !relations.Any());
            }

            if (treePath.LastNode is DbItem)
            {
                var item      = treePath.LastNode as DbItem;
                var relations = _dataService.GetRelations(item.Id);
                return(relations == null || !relations.Any());
            }
            else if (treePath.LastNode is DbRelation)
            {
                var relation = treePath.LastNode as DbRelation;
                if (relation.ToId != null)
                {
                    var item = _dataService.GetItem(relation.ToId.Value);

                    return(item == null);
                }
            }

            return(true);
        }
Beispiel #10
0
        public override System.Collections.IEnumerable GetChildren(TreePath treePath)
        {
            List <DataRowNode> items = new List <DataRowNode>();

            if (treePath.IsEmpty())
            {
                items.Add(m_root);
            }
            else
            {
                DataRowNode n = treePath.LastNode as DataRowNode;

                DataRow row = n.Row;
                int     id  = Convert.ToInt32(row[m_IDColumnName]);

                DataRow[] rows = m_table.Select("ParentID = " + id + " and " + m_IDColumnName + " <> " + id);
                foreach (DataRow r in rows)
                {
                    DataRowNode node = new DataRowNode(r, r["Name"].ToString());
                    node.Row = r;
                    //SampleApp.Properties.Resources.ResourceManager.
                    //node.Icon = new Bitmap(SampleApp.Properties.Resources.Records,new Size(15,15));
                    items.Add(node);
                }
            }
            return(items);
        }
 public override IEnumerable GetChildren(TreePath treePath)
 {
     if (treePath.IsEmpty())
     {
         foreach (var plugin in registry.Plugins)
         {
             yield return(new PluginNode(plugin.PluginId));
         }
     }
     else if (treePath.LastNode is PluginNode)
     {
         var pluginNode = (PluginNode)treePath.LastNode;
         foreach (var service in registry.Services)
         {
             if (service.Plugin.PluginId == pluginNode.Text)
             {
                 yield return(new ServiceNode(service.ServiceId));
             }
         }
     }
     else if (treePath.LastNode is ServiceNode)
     {
         var serviceNode = (ServiceNode)treePath.LastNode;
         foreach (var component in registry.Components)
         {
             if (component.Service.ServiceId == serviceNode.Text)
             {
                 yield return(new ComponentNode(component.ComponentId));
             }
         }
     }
 }
Beispiel #12
0
 public System.Collections.IEnumerable GetChildren(TreePath treePath)
 {
     if (treePath.IsEmpty())
     {
         var categories = new List <Category>();
         foreach (var c in _queuedExports)
         {
             var cat = categories.Find(q => q.Label == c.Category);
             if (cat == null)
             {
                 cat = new Category {
                     Label = c.Category, Enabled = CheckState.Checked
                 };
                 categories.Add(cat);
             }
             cat._items.Add(new Item {
                 Attached = c
             });
         }
         return(categories);
     }
     else
     {
         // find all of the items in the given category
         var cat = treePath.LastNode as Category;
         if (cat != null)
         {
             return(cat._items);
         }
     }
     return(null);
 }
Beispiel #13
0
 public override IEnumerable GetChildren(TreePath treePath)
 {
     if (treePath.IsEmpty())
     {
         yield return(root);
     }
     else if (treePath.LastNode == root)
     {
         foreach (var pluginDescriptor in PluginDescriptors)
         {
             var pluginNode = new PluginNode(pluginDescriptor);
             root.Nodes.Add(pluginNode);
             foreach (var file in pluginDescriptor.FilePaths)
             {
                 var fullPath = Path.Combine(pluginDescriptor.BaseDirectory.FullName, file);
                 var exists   = fileSystem.FileExists(fullPath);
                 pluginNode.Nodes.Add(new FileNode(file, exists));
             }
             yield return(pluginNode);
         }
     }
     else if (treePath.LastNode is PluginNode)
     {
         var pluginNode = (PluginNode)treePath.LastNode;
         foreach (var child in pluginNode.Nodes)
         {
             yield return(child);
         }
     }
 }
Beispiel #14
0
        public System.Collections.IEnumerable GetChildren(TreePath treePath)
        {
            List <BaseItem> items = null;

            if (treePath.IsEmpty())
            {
                if (_cache.ContainsKey("ROOT"))
                {
                    items = _cache["ROOT"];
                }
                else
                {
                    items = new List <BaseItem>();
                    _cache.Add("ROOT", items);
                    foreach (string str in Environment.GetLogicalDrives())
                    {
                        items.Add(new RootItem(str, this));
                    }
                }
            }
            else
            {
                BaseItem parent = treePath.LastNode as BaseItem;
                if (parent != null)
                {
                    if (_cache.ContainsKey(parent.ItemPath))
                    {
                        items = _cache[parent.ItemPath];
                    }
                    else
                    {
                        items = new List <BaseItem>();
                        try
                        {
                            foreach (string str in Directory.GetDirectories(parent.ItemPath))
                            {
                                items.Add(new FolderItem(str, parent, this));
                            }
                            foreach (string str in Directory.GetFiles(parent.ItemPath))
                            {
                                FileItem item = new FileItem(str, parent, this);
                                items.Add(item);
                            }
                        }
                        catch (IOException)
                        {
                            return(null);
                        }
                        _cache.Add(parent.ItemPath, items);
                        _itemsToRead.AddRange(items);
                        if (!_worker.IsBusy)
                        {
                            _worker.RunWorkerAsync();
                        }
                    }
                }
            }
            return(items);
        }
 public bool IsLeaf(TreePath treePath)
 {
     if (treePath.IsEmpty())
     {
         return(false);
     }
     return((treePath.LastNode as Change).IsLeaf);
 }
 public PlaylistTreeNodeBase FindNode(TreePath path)
 {
     if (path.IsEmpty())
     {
         return(Root);
     }
     return(FindNode(Root, path, 0));
 }
        /// <summary>
        /// Returns a node list of all child nodes of a given parent node
        /// </summary>
        /// <param name="treePath">The path of the parent node</param>
        /// <returns>The list of child nodes for the given parent path node</returns>
        public override System.Collections.IEnumerable GetChildren(TreePath treePath)
        {
            NodeIdWrapper parentNodeId;
            bool          settingTopNode = false;

            if (treePath.IsEmpty())
            {
                settingTopNode = true;
                parentNodeId   = model.get_root();
            }
            else
            {
                GrtTreeNode parent = treePath.LastNode as GrtTreeNode;
                if (parent != null)
                {
                    parentNodeId = parent.NodeId;
                }
                else
                {
                    parentNodeId = null;
                }
            }

            if (parentNodeId != null)
            {
                // The backend has child nodes on a node not before it was expanded.
                int childCount = model.count_children(parentNodeId);
                if (childCount == 0)
                {
                    // But expand only if we don't have any children yet. Otherwise
                    // get many unnecessary refresh calls.
                    model.expand_node(parentNodeId);
                    childCount = model.count_children(parentNodeId);
                }

                for (int i = 0; i < childCount; i++)
                {
                    NodeIdWrapper nodeId = model.get_child(parentNodeId, i);
                    GrtTreeNode   node;
                    string        caption;

                    model.get_field(nodeId, columns[0].index, out caption);

                    node = new GrtTreeNode(caption, nodeId, null, this);
                    if (settingTopNode)
                    {
                        topNode = node;
                    }

                    //items.Add(node);
                    yield return(node);
                }
            }

            //return items;
        }
        public override IEnumerable GetChildren(TreePath treePath)
        {
            if (treePath.IsEmpty())
            {
                return(nodes);
            }
            IssueNode n = treePath.LastNode as IssueNode;

            return(n != null ? n.SubtaskNodes : null);
        }
Beispiel #19
0
 public IEnumerable GetChildren(TreePath treePath)
 {
     if (treePath.IsEmpty())
     {
         foreach (AssemblyGroup grp in _ac.Groups)
         {
             yield return(new AssemblyGroupTreeItem(grp));
         }
     }
 }
Beispiel #20
0
        public System.Collections.IEnumerable GetChildren(TreePath treePath)
        {
            if (treePath.IsEmpty())
            {
                foreach (var item in _menu.Items)
                {
                    if (item.Function == UIItemFunctionType.Command)
                    {
                        var ci  = (ICommandItem)item;
                        var cmd = _wl.GetCommandByName(ci.Command);
                        Debug.Assert(cmd != null);

                        yield return(new CommandItem(ci, CommandIconCache.GetStandardCommandIcon(cmd.ImageURL)));
                    }
                    else if (item.Function == UIItemFunctionType.Flyout)
                    {
                        yield return(new FlyoutItem((IFlyoutItem)item));
                    }
                    else
                    {
                        yield return(new SeparatorItem((ISeparatorItem)item));
                    }
                }
            }
            else
            {
                var flyout = treePath.LastNode as FlyoutItem;
                if (flyout != null)
                {
                    foreach (var item in flyout.SubItem)
                    {
                        if (item.Function == UIItemFunctionType.Command)
                        {
                            var ci  = (ICommandItem)item;
                            var cmd = _wl.GetCommandByName(ci.Command);
                            Debug.Assert(cmd != null);

                            yield return(new CommandItem(ci, CommandIconCache.GetStandardCommandIcon(cmd.ImageURL)));
                        }
                        else if (item.Function == UIItemFunctionType.Flyout)
                        {
                            yield return(new FlyoutItem((IFlyoutItem)item));
                        }
                        else
                        {
                            yield return(new SeparatorItem((ISeparatorItem)item));
                        }
                    }
                }
                else
                {
                    yield break;
                }
            }
        }
        public override bool IsLeaf(TreePath treePath)
        {
            if (treePath.IsEmpty())
            {
                return(false);
            }

            var node = (PluginDetailsNode)treePath.LastNode;

            return(node.Name != "Disabled" || !serviceDescriptor.IsDisabled);
        }
Beispiel #22
0
 public IEnumerable <object> GetChildren(TreePath treePath)
 {
     if (treePath.IsEmpty())
     {
         return(Root.Children);
     }
     else
     {
         return(((INode)treePath.LastNode).Children);
     }
 }
 public Node FindNode(TreePath path)
 {
     if (path.IsEmpty())
     {
         return(_root);
     }
     else
     {
         return(FindNode(_root, path, 0));
     }
 }
        public System.Collections.IEnumerable GetChildren(TreePath treePath)
        {
            if (string.IsNullOrEmpty(this.basePath) && treePath.IsEmpty())
            {
                foreach (string str in Environment.GetLogicalDrives())
                {
                    LogicalDriveItem item = new LogicalDriveItem(str);
                    yield return(item);
                }
            }
            else
            {
                List <BaseItem> items  = new List <BaseItem>();
                BaseItem        parent = treePath.LastNode as BaseItem;
                string          path   = parent != null ? parent.ItemPath : this.basePath;
                if (!string.IsNullOrEmpty(path) && Directory.Exists(path))
                {
                    try
                    {
                        IEnumerable <string> dirQuery  = Directory.GetDirectories(path);
                        IEnumerable <string> fileQuery = Directory.GetFiles(path);
                        if (this.filter != null)
                        {
                            dirQuery  = dirQuery.Where(s => this.filter(s));
                            fileQuery = fileQuery.Where(s => this.filter(s));
                        }
                        foreach (string str in dirQuery)
                        {
                            items.Add(new FolderItem(str, parent));
                        }
                        foreach (string str in fileQuery)
                        {
                            items.Add(new FileItem(str, parent));
                        }
                    }
                    catch (UnauthorizedAccessException) {}

                    this.itemsToRead.AddRange(items);
                    if (!this.itemLoader.IsBusy)
                    {
                        this.itemLoader.RunWorkerAsync();
                    }

                    foreach (BaseItem item in items)
                    {
                        yield return(item);
                    }
                }
                else
                {
                    yield break;
                }
            }
        }
Beispiel #25
0
        public System.Collections.IEnumerable GetChildren(TreePath treePath)
        {
            using (var session = m_data.OpenSession(m_snapshot.Id))
                using (var tx = session.BeginTransaction())
                {
                    if (treePath.IsEmpty())
                    {
                        //top level queries
                        var calls = session.CreateQuery(kTopLevelQuery)
                                    .SetMaxResults(100)
                                    .List <Call>();
                        foreach (var c in calls)
                        {
                            var item = new FunctionItem();
                            item.Id     = c.ParentId;
                            item.Thread = c.Thread.Id;
                            item.Name   = FunctionInfo.GetFullSignature(c.Parent);
                            item.Time   = Math.Round(c.Time, 3);
                            yield return(item);
                        }
                    }
                    else
                    {
                        var parentNode = treePath.LastNode as FunctionItem;
                        session.EnableFilter("Thread").SetParameter("threadId", parentNode.Thread);
                        var data = session.CreateQuery(kChildQuery)
                                   .SetInt32("childId", parentNode.Id)
                                   .List <object[]>();

                        foreach (var row in data)
                        {
                            Call c          = row[0] as Call;
                            var  parentTime = Convert.ToDouble(row[1]);
                            var  item       = new FunctionItem();
                            item.Thread = parentNode.Thread;
                            item.Id     = c.ParentId;
                            item.Name   = FunctionInfo.GetFullSignature(c.Parent);
                            item.Time   = Math.Round(c.Time, 3);
                            if (parentTime == 0)
                            {
                                item.PercentTime = 0;
                            }
                            else
                            {
                                item.PercentTime = Math.Round(100 * c.Time / parentTime, 3);
                            }
                            yield return(item);
                        }
                    }

                    tx.Commit();
                    yield break;
                }
        }
        /// <summary>
        /// Returns a node list of all child nodes of a given parent node
        /// </summary>
        /// <param name="treePath">The path of the parent node</param>
        /// <returns>The list of child nodes for the given parent path node</returns>
        public override System.Collections.IEnumerable GetChildren(TreePath treePath)
        {
            List <GrtTreeNode> items = null;
            NodeIdWrapper      parentNodeId;
            bool settingTopNode = false;

            if (treePath.IsEmpty())
            {
                settingTopNode = true;
                parentNodeId   = model.get_root();
            }
            else
            {
                GrtTreeNode parent = treePath.LastNode as GrtTreeNode;
                if (parent != null)
                {
                    parentNodeId = parent.NodeId;
                }
                else
                {
                    parentNodeId = null;
                }
            }

            if (parentNodeId != null)
            {
                int childCount = model.count_children(parentNodeId);

                items = new List <GrtTreeNode>();

                for (int i = 0; i < childCount; i++)
                {
                    NodeIdWrapper nodeId = model.get_child(parentNodeId, i);
                    GrtTreeNode   node;
                    string        caption;

                    model.get_field(nodeId, columns[0].index, out caption);

                    if (disabledNames.Contains(caption))
                    {
                        continue;
                    }

                    node = new GrtTreeNode(caption, nodeId, null, this);
                    if (settingTopNode)
                    {
                        topNode = node;
                    }

                    items.Add(node);
                }
            }
            return(items);
        }
 public IEnumerable GetChildren(TreePath treePath)
 {
     if (treePath.IsEmpty())
     {
         return(TableChanges.Keys.OrderBy(k => k.Description));
     }
     else
     {
         return(TableChanges[(treePath.LastNode as Change)]);
     }
 }
Beispiel #28
0
        public IEnumerable GetChildren(TreePath treePath)
        {
            if (this.RootSection == null)
            {
                return(null);
            }
            SectionEntry ed  = treePath.IsEmpty() ? this.RootSection : ((SectionEntry)treePath.LastNode);
            List <Entry> ret = new List <Entry>(ed.Entries);

            ret.Add(null);//a null entry, which will be the button for adding new entries
            return(ret);
        }
Beispiel #29
0
 public override System.Collections.IEnumerable GetChildren(TreePath treePath)
 {
     if (treePath.IsEmpty())
     {
         List <LuaWatchVariable> variables = new List <LuaWatchVariable>(watchVariables);
         variables.Add(newWatchVariable);
         return(variables);
     }
     else
     {
         return(base.GetChildren(treePath));
     }
 }
Beispiel #30
0
 public override System.Collections.IEnumerable GetChildren(TreePath treePath)
 {
     if (treePath.IsEmpty())
     {
         foreach (var layer in _map.MapLayer)
         {
             yield return(new LayerItem(layer));
         }
     }
     else
     {
         yield break;
     }
 }