Exemplo n.º 1
0
 public System.Collections.IEnumerable GetChildren(TreePath treePath)
 {
     if (treePath.IsEmpty())
     return _list;
        else
     return null;
 }
Exemplo n.º 2
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;
        }
Exemplo n.º 3
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;
        }
Exemplo n.º 4
0
        public override System.Collections.IEnumerable  GetChildren(Aga.Controls.Tree.TreePath treePath)
        {
            List <PiscesObject> items = new List <PiscesObject>();

            if (treePath.IsEmpty())
            {
                PiscesObject[] roots = db.GetRootObjects();

                foreach (PiscesObject o in roots)
                {
                    items.Add(o);
                }
            }
            else
            {
                PiscesObject   s        = treePath.LastNode as PiscesObject;
                PiscesObject[] children = db.GetChildren(s);

                foreach (PiscesObject si in children)
                {
                    items.Add(si);
                }
            }
            return(items);
        }
Exemplo n.º 5
0
		public TreePathEventArgs(TreePath path)
		{
			if (path == null)
				throw new ArgumentNullException();

			_path = path;
		}
Exemplo n.º 6
0
 public override bool IsLeaf(TreePath treePath)
 {
     if (Settings.Default.AreasViewAsList)
         return true;
     Area item = treePath.LastNode as Area;
     return item != null && ((item.ChildAreas != null && item.ChildAreas.Count == 0) | (item.Equipments.Count == 0));
 }
Exemplo n.º 7
0
        public System.Collections.IEnumerable GetChildren(TreePath treePath)
        {
            this.InitAssemblyCache();
            List<BaseItem> items = new List<BaseItem>();

            BaseItem parentItem = treePath.LastNode as BaseItem;
            TypeItem parentTypeItem = parentItem as TypeItem;
            NamespaceItem parentNamespaceItem = parentItem as NamespaceItem;

            Type parentType = parentTypeItem != null ? parentTypeItem.TypeInfo : this.baseType;
            string parentName = parentNamespaceItem != null ? parentNamespaceItem.Name : null;

            if (this.showNamespaces && parentTypeItem == null)
            {
                foreach (string subName in this.GetSubNamespaces(parentName))
                {
                    items.Add(new NamespaceItem(subName, parentItem));
                }
            }
            if (!this.showNamespaces || parentName != null)
            {
                foreach (Assembly assembly in this.assemblies)
                {
                    foreach (Type exportedType in assembly.GetExportedTypes())
                    {
                        if (this.showNamespaces && exportedType.Namespace != parentName) continue;
                        if (exportedType.BaseType != parentType && (!parentType.IsInterface || !exportedType.GetInterfaces().Contains(parentType))) continue;
                        if (this.filter != null && !this.filter(exportedType)) continue;
                        items.Add(new TypeItem(exportedType, parentItem));
                    }
                }
            }

            return items;
        }
Exemplo n.º 8
0
		public Node FindNode(TreePath path)
		{
			if (path.IsEmpty())
				return this.Root;

            return FindNode(this.Root, path, 0);
		}
Exemplo n.º 9
0
 public bool IsLeaf(TreePath path)
 {
     if (path.LastNode != null && path.LastNode is Expression) {
         return !((Expression)path.LastNode).HasChildren();
     }
     return true;
 }
Exemplo n.º 10
0
 public override System.Collections.IEnumerable GetChildren(TreePath treePath)
 {
     Task t= treePath.LastNode as Task;
     if(t==null)
         return new List<Task>(this.projects);
     return t.Tasks;
 }
Exemplo n.º 11
0
 public override bool IsLeaf(TreePath treePath)
 {
     DataRowNode n = treePath.LastNode as DataRowNode;
     if (n.Row["IsFolder"] == DBNull.Value)
         return false;
     return !Convert.ToBoolean(n.Row["IsFolder"]);
 }
 protected override void HandleModelChanged(object sender, ModelChangedArgs e) {
     TreePath treePath = new TreePath(view.Tree.Root);
     switch (e.Context) {
         case EventContext.WorkitemPropertiesUpdatedFromView:
             HandleWorkitemPropertiesUpdated(PropertyUpdateSource.WorkitemView);
             break;
         case EventContext.WorkitemPropertiesUpdatedFromPropertyView:
             HandleWorkitemPropertiesUpdated(PropertyUpdateSource.WorkitemPropertyView);
             break;
         case EventContext.WorkitemsChanged:
             treePath = view.Tree.GetPath(view.CurrentNode.Level == 2 ? view.CurrentNode.Parent : view.CurrentNode);
             model.InvokeStructureChanged(treePath);
             break;
         case EventContext.VirtualWorkitemRemoved:
             treePath = view.Tree.GetPath(view.CurrentNode.Parent??view.Tree.Root);
             model.InvokeStructureChanged(treePath);
             break;
         case EventContext.ProjectSelected:
             HandleModelChanged();
             break;
         case EventContext.WorkitemsRequested:
             HandleModelChanged();
             break;
         case EventContext.WorkitemSaved:
             treePath = view.Tree.GetPath(view.CurrentNode.Level == 2 ? view.CurrentNode.Parent : view.CurrentNode);
             model.InvokeStructureChanged(treePath);
             break;
         case EventContext.WorkitemCacheInvalidated:
             assetCache.Drop();
             break;
         default:
             throw new NotSupportedException();
     }
 }
Exemplo n.º 13
0
 public override IEnumerable GetChildren(TreePath treePath)
 {
     List<TemplateTreeItem> dataItems = new List<TemplateTreeItem>();
     if (treePath.IsEmpty())
     {
         var data = _dataSource.GroupBy(i => Regex.Matches(i.Description, @"\b[\w]*\b").Cast<Match>().First().Value);
         dataItems.AddRange(data.Select(group => new TemplateTreeItem()
         {
             Description = group.Key, Id = Guid.NewGuid(), IsLeaf = !group.Any(), Tag = group
         }).OrderBy(o=>o.Description));
     }
     else
     {
         IGrouping<string, EquipmentTemplate> items = ((TemplateTreeItem)treePath.LastNode).Tag as IGrouping<string, EquipmentTemplate>;
         if (items==null)
             throw new Exception("Error in tree");
         dataItems.AddRange(items.Select(item => new TemplateTreeItem()
         {
             Description = item.Description,
             Id = item.ElementId,
             IsLeaf = true,
             Tag = item
         }).OrderBy(o => o.Description));
     }
     return dataItems;
 }
		public TreePath(TreePath parent, object node)
		{
			_path = new object[parent.FullPath.Length + 1];
			for (int i = 0; i < _path.Length - 1; i++)
				_path[i] = parent.FullPath[i];
			_path[_path.Length - 1] = node;
		}
Exemplo n.º 15
0
 public Node FindNode(TreePath path)
 {
     if (path.IsEmpty())
         return _root;
     else
         return FindNode(_root, path, 0);
 }
Exemplo n.º 16
0
        public System.Collections.IEnumerable GetChildren(TreePath treePath)
        {
            if (treePath.IsEmpty())
                foreach (string str in Environment.GetLogicalDrives())
                {
                    RootItem item = new RootItem(str);
                    yield return item;
                }
            else
            {
                List<BaseItem> items = new List<BaseItem>();
                BaseItem parent = treePath.LastNode as BaseItem;
                if (parent != null)
                {
                    foreach (string str in Directory.GetDirectories(parent.ItemPath))
                        items.Add(new FolderItem(str, parent));
                    foreach (string str in Directory.GetFiles(parent.ItemPath))
                        items.Add(new FileItem(str, parent));

                    _itemsToRead.AddRange(items);
                    if (!_worker.IsBusy)
                        _worker.RunWorkerAsync();

                    foreach (BaseItem item in items)
                        yield return item;
                }
                else
                    yield break;
            }
        }
Exemplo n.º 17
0
 private void ReportRenamed(string oldReportName, string newReportName)
 {
     var treePath = new TreePath(new[] { projectRoot, reportsNode });
     OnNodesRemoved(new TreeModelEventArgs(treePath, new[] { new ReportNode(oldReportName) }));
     OnNodesInserted(new TreeModelEventArgs(treePath, new[] { 0 }, 
         new[] { new ReportNode(newReportName) }));
 }
 public override IEnumerable GetChildren(TreePath treePath)
 {
     if (treePath.IsEmpty())
     {
         yield return new PluginDetailsNode("Component Handler Factory", componentDescriptor.ComponentHandlerFactory.ToString());
         yield return new PluginDetailsNode("Component Properties", string.Empty);
         yield return new PluginDetailsNode("Component Type Name", componentDescriptor.ComponentTypeName.FullName);
         yield return new PluginDetailsNode("Disabled", componentDescriptor.IsDisabled.ToString());
         yield return new PluginDetailsNode("Traits Properties", string.Empty);
     }
     else
     {
         var node = (PluginDetailsNode) treePath.LastNode;
         if (node.Name == "Component Properties")
         {
             if (componentDescriptor.ComponentProperties != null)
                 foreach (var property in componentDescriptor.ComponentProperties)
                     yield return new PluginDetailsNode(property.Key, property.Value);
         }
         else if (node.Name == "Disabled" && componentDescriptor.IsDisabled)
         {
             yield return new PluginDetailsNode("Disabled Reason", componentDescriptor.DisabledReason);
         }
         else if (node.Name == "Traits Properties")
         {
             if (componentDescriptor.TraitsProperties != null)
                 foreach (var property in componentDescriptor.TraitsProperties)
                     yield return new PluginDetailsNode(property.Key, property.Value);
         }
     }
 }
Exemplo n.º 19
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;
         }
     }
 }
 public override IEnumerable GetChildren(TreePath treePath)
 {
     if (treePath.IsEmpty())
     {
         yield return new PluginDetailsNode("Assembly References", string.Empty);
         yield return new PluginDetailsNode("Base Directory", pluginDescriptor.BaseDirectory.FullName);
         yield return new PluginDetailsNode("Disabled", pluginDescriptor.IsDisabled.ToString());
         yield return new PluginDetailsNode("Plugin Dependencies", string.Empty);
         yield return
             new PluginDetailsNode("Plugin Handler Factory", pluginDescriptor.PluginHandlerFactory.ToString())
             ;
         yield return new PluginDetailsNode("Plugin Properties", string.Empty);
         yield return new PluginDetailsNode("Plugin Type Name", pluginDescriptor.PluginTypeName.FullName);
         yield return new PluginDetailsNode("Probing Paths", string.Empty);
         yield return new PluginDetailsNode("Traits Properties", string.Empty);
     }
     else
     {
         var node = (PluginDetailsNode) treePath.LastNode;
         if (node.Name == "Assembly References" && pluginDescriptor.AssemblyBindings != null)
         {
             foreach (var assemblyReference in pluginDescriptor.AssemblyBindings)
             {
                 string codeBase = assemblyReference.CodeBase != null ? 
                     assemblyReference.CodeBase.ToString() : "(unknown)";
                 yield return new PluginDetailsNode(assemblyReference.AssemblyName.ToString(), 
                     codeBase);
             }
         }
         else if (node.Name == "Disabled" && pluginDescriptor.IsDisabled)
         {
             yield return new PluginDetailsNode("Disabled Reason", pluginDescriptor.DisabledReason);
         }
         else
             switch (node.Name)
             {
                 case "Plugin Dependencies":
                     if (pluginDescriptor.PluginDependencies != null)
                         foreach (var pluginDependency in pluginDescriptor.PluginDependencies)
                             yield return new PluginDetailsNode(pluginDependency.PluginId, string.Empty);
                     break;
                 case "Plugin Properties":
                     if (pluginDescriptor.PluginProperties != null)
                         foreach (var pluginProperty in pluginDescriptor.PluginProperties)
                             yield return new PluginDetailsNode(pluginProperty.Key, pluginProperty.Value);
                     break;
                 case "Probing Paths":
                     if (pluginDescriptor.ProbingPaths != null)
                         foreach (var probingPath in pluginDescriptor.ProbingPaths)
                             yield return new PluginDetailsNode(probingPath, string.Empty);
                     break;
                 case "Traits Properties":
                     if (pluginDescriptor.TraitsProperties != null)
                         foreach (var traitsProperty in pluginDescriptor.TraitsProperties)
                             yield return new PluginDetailsNode(traitsProperty.Key, traitsProperty.Value);
                     break;
             }
     }
 }
Exemplo n.º 21
0
        public override bool IsLeaf(TreePath treePath)
        {
            if (treePath.LastNode is FileNode)
                return true;

            return treePath.LastNode is PluginNode && 
                ((PluginNode)treePath.LastNode).Nodes.Count == 0;
        }
Exemplo n.º 22
0
		public virtual bool IsLeaf(TreePath treePath)
		{
			Node node = FindNode(treePath);
			if (node != null)
				return node.IsLeaf;
			else
				throw new ArgumentException("treePath");
		}
        public override bool IsLeaf(TreePath treePath)
        {
            if (treePath.IsEmpty())
                return false;

            var node = (PluginDetailsNode)treePath.LastNode;
            return node.Name != "Disabled" || !serviceDescriptor.IsDisabled;
        }
        /// <summary>Grabs the children of the passed path</summary>
        /// <param name="treePath">Path to get the children of</param>
        /// <returns>IEnumerable collection with the child items</returns>
        public IEnumerable GetChildren(TreePath treePath)
        {
            List<BaseItem> items = new List<BaseItem>();
            if (treePath.IsEmpty())
            {
                if (_tree.Cache.ContainsKey("ROOT"))
                {
                    items = _tree.Cache["ROOT"];
                }
                else
                {
                    items = new List<BaseItem>();
                    _tree.Cache.Add("ROOT", items);
                }
            }
            else
            {
                ServerItem server = treePath.FirstNode as ServerItem;
                BaseItem database = treePath.FullPath.FirstOrDefault(i => (i as BaseItem).Type == ItemType.Database) as BaseItem;
                BaseItem parent = treePath.LastNode as BaseItem;
                if (parent != null && server != null)
                {
                    if (_tree.Cache.ContainsKey(parent.ItemPath))
                    {
                        items = _tree.Cache[parent.ItemPath];
                    }
                    else
                    {
                        //Populate the items based on the parent
                        switch (parent.Type)
                        {
                            case ItemType.Server:
                                items = GetDatabases(server);
                                break;
                            case ItemType.Database:
                                items = GetDatabaseChildren(parent);
                                break;
                            case ItemType.Folder:
                                if (database != null)
                                    items = GetFolderChildren(parent, server, database.Name);
                                break;
                            case ItemType.Table:
                            case ItemType.View:
                                items = GetTableViewChildren(parent);
                                break;
                            default:
                                break;
                        }

                        _tree.Cache.Add(parent.ItemPath, items);
                    }

                    parent.IsLoaded = true;
                }
            }

            return items;
        }
Exemplo n.º 25
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;
 }
Exemplo n.º 26
0
 public IEnumerable GetChildren(TreePath treePath)
 {
     DetailTreeNode parent = treePath.LastNode as DetailTreeNode;
     if (parent == null)
     {
         return node_.ChildNodes();
     }
     return parent.ChildNodes();
 }
Exemplo n.º 27
0
 public System.Collections.IEnumerable GetChildren(TreePath treePath)
 {
     Node node = FindNode(treePath);
     if (node != null)
         foreach (Node n in node.Nodes)
             yield return n;
     else
         yield break;
 }
Exemplo n.º 28
0
		public NodeModule FindNode(TreePath path)
		{
            if (path.FullPath.Length == 0)
                return null;
			else if (path.FullPath.Length==1)
				return _root;
			else
				return FindNode(_root, path, 1);
		}
Exemplo n.º 29
0
 private Node GetNode(TreePath treePath) {
   Node parent = root;
   foreach (object obj in treePath.FullPath) {
     Node node = obj as Node;
     if (node == null || node.Parent != parent)
       return null;
     parent = node;
   }
   return parent;
 }
Exemplo n.º 30
0
 public IEnumerable GetChildren(TreePath treePath) {
   Node node = GetNode(treePath);
   if (node != null) {
     foreach (Node n in node.Nodes)
       if (forceVisible || n.IsVisible)
         yield return n;
   } else {
     yield break;
   }
 }
Exemplo n.º 31
0
 /// <summary>Trigger for the NodesChanged event</summary>
 /// <param name="Tree">Path of the parent of the changed items</param>
 /// <param name="Indices">Indices (0-based) where to add the children changed</param>
 /// <param name="Children">Children objects to be changed under the Tree</param>
 public void OnNodesChanged(TreePath Tree, int[] Indices, object[] Children)
 {
     if (NodesChanged != null && Children != null)
     {
         if (Indices == null)
         {
             Indices = BuildIndices(Children.Length);
         }
         NodesChanged(this, new TreeModelEventArgs(Tree, Indices, Children));
     }
 }
Exemplo n.º 32
0
 public TreeNodeAdv FindNode(TreePath path)
 {
     return(FindNode(path, false));
 }
Exemplo n.º 33
0
        public override bool IsLeaf(Aga.Controls.Tree.TreePath treePath)
        {
            PiscesObject o = treePath.LastNode as PiscesObject;

            return(!(o is PiscesFolder));
        }
Exemplo n.º 34
0
 public override bool IsLeaf(TreePath treePath)
 {
     return(InnerModel.IsLeaf(treePath));
 }
Exemplo n.º 35
0
 public bool IsLeaf(TreePath treePath)
 {
     return(true);
 }
Exemplo n.º 36
0
 public abstract System.Collections.IEnumerable GetChildren(TreePath treePath);
 /// <summary>
 ///
 /// </summary>
 /// <param name="parent">Path to a parent node</param>
 /// <param name="children">Child nodes</param>
 public TreeModelEventArgs(TreePath parent, object[] children)
     : this(parent, null, children)
 {
 }
Exemplo n.º 38
0
 public override IEnumerable GetChildren(TreePath treePath)
 {
     return(_list);
 }
Exemplo n.º 39
0
 public override bool IsLeaf(TreePath treePath)
 {
     return(true);
 }
Exemplo n.º 40
0
 public abstract IEnumerable GetChildren(TreePath treePath);
Exemplo n.º 41
0
 public abstract bool IsLeaf(TreePath treePath);