void AddBindingChildNodes( TaskRunnerInformation task, TaskRunnerBindingInformation binding, TreeNavigator navigator, TaskBindingTreeNode node) { foreach (TaskBindingTreeNode childNode in node.CreateChildNodes(task, binding)) { TreeNavigator childNavigator = navigator.AddChild(); if (!childNode.Icon.IsNull) { childNavigator.SetValue(bindingNodeIconField, ImageService.GetIcon(childNode.Icon, Gtk.IconSize.Menu)); } childNavigator.SetValue(bindingNodeNameField, childNode.Name); childNavigator.SetValue(bindingNodeField, childNode); AddBindingChildNodes(task, binding, childNavigator, childNode); navigator.MoveToParent(); } if (node.IsRootNode) { RefreshBindingNodeName(node, navigator); } }
void SyncNode(TreeNavigator navigator, bool forceExpansion = false) { var node = navigator.GetValue(nodeField); UpdateText(navigator, node); bool isExpanded = forceExpansion || view.IsRowExpanded(navigator.CurrentPosition); ClearChildNodes(navigator); syncedNodes.Remove(node); navigator.RemoveChildren(); if (!node.HasVisibleChildren) { return; } if (isExpanded) { foreach (var childNode in node.Children.Where(child => child.Visible)) { navigator.AddChild(); SetNode(navigator, childNode); SyncNode(navigator); navigator.MoveToParent(); } } else { AddDummyChild(navigator); } if (isExpanded) { syncedNodes.Add(node); view.ExpandRow(navigator.CurrentPosition, false); } }
private void AddChilds(TreeNavigator node, List <HierarchyItem> children) { foreach (var child in children) { node.AddChild().SetValue(_name, child.Name).SetValue(_path, child.ServerPath); AddChilds(node, child.Children); node.MoveToParent(); } }
void AddNode(TreeNavigator treeNavigator, SyntaxNode syntaxNode) { var leadingTrivia = syntaxNode.GetLeadingTrivia(); var trailingTrivia = syntaxNode.GetTrailingTrivia(); AddLeadingTrivia(leadingTrivia); SetNodeText(treeNavigator, syntaxNode.GetType().Name, syntaxNode.Span, Colors.DarkBlue); foreach (var child in syntaxNode.ChildNodesAndTokens()) { treeNavigator.AddChild(); if (child.IsNode) { AddNode(treeNavigator, child.AsNode()); } else { var token = child.AsToken(); if (token.LeadingTrivia != leadingTrivia) { AddLeadingTrivia(token.LeadingTrivia); } SetNodeText(treeNavigator, token.GetType().Name, token.Span, Colors.DarkGreen); if (token.TrailingTrivia != trailingTrivia) { AddTrailingTrivia(token.TrailingTrivia); } } treeNavigator.MoveToParent(); } AddTrailingTrivia(trailingTrivia); void AddLeadingTrivia(SyntaxTriviaList triviaList) { foreach (var trivia in triviaList) { AddTrivia(trivia); treeNavigator.InsertAfter(); } } void AddTrailingTrivia(SyntaxTriviaList triviaList) { foreach (var trivia in triviaList) { treeNavigator.InsertAfter(); AddTrivia(trivia); } } void AddTrivia(SyntaxTrivia trivia) => SetNodeText(treeNavigator, trivia.GetType().Name, trivia.Span, Colors.DarkRed); }
void AddChildTreeNodes(TreeNavigator navigator, BaseViewModel viewModel) { foreach (BaseViewModel childViewModel in viewModel.Children) { TreeNavigator childNavigator = navigator.AddChild(); SetTreeNodeValues(childNavigator, childViewModel); AddChildTreeNodes(childNavigator, childViewModel); navigator.MoveToParent(); } }
void AddTaskChildNodes(TreeNavigator navigator, TaskRunnerTreeNode node) { foreach (TaskRunnerTreeNode childNode in node.GetChildNodes()) { TreeNavigator childNavigator = navigator.AddChild(); childNavigator.SetValue(taskRunnerNodeNameField, childNode.Name); childNavigator.SetValue(taskRunnerField, childNode); AddTaskChildNodes(childNavigator, childNode); navigator.MoveToParent(); } }
private void AddLesson(TreeNavigator navigator, Lesson lesson) { navigator.AddChild() .SetValue(imageCol, LessonIcon) .SetValue(nameCol, lesson.Title) .SetValue(subjectCol, lesson.Subject) .SetValue(lessonCol, lesson) .MoveToParent(); }
void AddDummyChild(TreeNavigator navigator) { navigator.AddChild(); navigator.SetValue(textField, "Loading..."); navigator.MoveToParent(); }
void AddDummyChild (TreeNavigator navigator) { navigator.AddChild (); navigator.SetValue (textField, "Loading..."); navigator.MoveToParent (); }
void SyncNode (TreeNavigator navigator, bool forceExpansion = false) { var node = navigator.GetValue (nodeField); UpdateText (navigator, node); bool isExpanded = forceExpansion || view.IsRowExpanded (navigator.CurrentPosition); ClearChildNodes (navigator); syncedNodes.Remove (node); navigator.RemoveChildren (); if (!node.HasVisibleChildren) return; if (isExpanded) { foreach (var childNode in node.Children.Where (child => child.Visible)) { navigator.AddChild (); SetNode (navigator, childNode); SyncNode (navigator); navigator.MoveToParent (); } } else { AddDummyChild (navigator); } if (isExpanded) { syncedNodes.Add (node); view.ExpandRow (navigator.CurrentPosition, false); } }
// public VirtualGridRow GetSelectedGridRow() // { // TreePosition tp = Tree.SelectedRow; // // foreach (VirtualGridRow row in Rows) // { // TreeNavigator tn = DataStore.GetNavigatorAt (tp); // //DataStore. // //VirtualGridRow rw = (VirtualGridRow)GetValue(tn,""); // //tn.GetValue( // } // return null; // } public void addData(TreeNavigator navigator, VirtualTreeRow row) { if (navigator == null) { throw new ArgumentNullException("navigator"); } if (row == null) { throw new ArgumentNullException("row"); } //add children if ((row.Children != null) && (row.Children.Count > 0)) { TreeNavigator current = navigator; int idx = 0; foreach (KeyValuePair <String, VirtualTreeRow> kp in row.Children) { if (idx > 0) { current.InsertAfter(); } setData(current, kp.Value.Data); if (kp.Value.Children.Count > 0) { addData(current.AddChild(), kp.Value); current.MoveToParent(); } else { if (kp.Value.Rows.Count > 0) { addData(current.AddChild(), kp.Value); current.MoveToParent(); } } idx++; } } //if no children available add the assigned rows if ((row.Children == null) || (row.Children.Count < 1)) { int idx = 0; foreach (VirtualGridRow rw in row.Rows) { if (idx > 0) { navigator.InsertAfter(); } setData(navigator, rw.Datas); idx++; } } }
void AddNode(TreeNavigator treeNavigator, SyntaxNode syntaxNode, bool hideLeadingTrivia = false) { var leadingTrivia = syntaxNode.GetLeadingTrivia(); var trailingTrivia = syntaxNode.GetTrailingTrivia(); if (!hideLeadingTrivia) { AddLeadingTrivia(leadingTrivia); } AddSyntaxNode(treeNavigator, syntaxNode); bool isFirst = true; foreach (var child in syntaxNode.ChildNodesAndTokens()) { //leading trivia is duplicated between the compilation unit and its first child bool hideChildLeadingTrivia = isFirst && syntaxNode is ICompilationUnitSyntax; isFirst = false; treeNavigator.AddChild(); if (child.IsNode) { AddNode(treeNavigator, child.AsNode(), hideChildLeadingTrivia); } else { var token = child.AsToken(); if (token.LeadingTrivia != leadingTrivia) { AddLeadingTrivia(token.LeadingTrivia); } AddSyntaxToken(treeNavigator, token); if (token.TrailingTrivia != trailingTrivia) { AddTrailingTrivia(token.TrailingTrivia); } } treeNavigator.MoveToParent(); } AddTrailingTrivia(trailingTrivia); void AddLeadingTrivia(SyntaxTriviaList triviaList) { foreach (var trivia in triviaList) { AddSyntaxTrivia(treeNavigator, trivia); treeNavigator.InsertAfter(); } } void AddTrailingTrivia(SyntaxTriviaList triviaList) { foreach (var trivia in triviaList) { treeNavigator.InsertAfter(); AddSyntaxTrivia(treeNavigator, trivia); } } }
private void AddChilds(TreeNavigator node, List<HierarchyItem> children) { foreach (var child in children) { node.AddChild().SetValue(_name, child.Name).SetValue(_path, child.ServerPath); AddChilds(node, child.Children); node.MoveToParent(); } }