protected override void fillModel(IEnumerable <JiraIssue> issues) { clearGroupNodes(); List <JiraIssue> subs = new List <JiraIssue>(); List <JiraIssue> orphanSubs = new List <JiraIssue>(); foreach (var issue in issues) { if (!(issue.IsSubtask && GroupSubtasksUnderParent)) { AbstractIssueGroupNode group = findGroupNode(issue); if (group != null) { group.IssueNodes.Add(new IssueNode(issue)); } } else { subs.Add(issue); } } foreach (JiraIssue sub in subs) { IssueNode parent = findIssueNodeByKey(sub.ParentKey); if (parent != null) { parent.SubtaskNodes.Add(new IssueNode(sub)); } else { orphanSubs.Add(sub); } } // orphaned subtasks go at the end of the tree. // Not really kosher, priority order is lost :( foreach (JiraIssue sub in orphanSubs) { AbstractIssueGroupNode group = findGroupNode(sub); if (group != null) { group.IssueNodes.Add(new IssueNode(sub)); } } if (StructureChanged != null) { StructureChanged(this, new TreePathEventArgs(TreePath.Empty)); } }
public override IEnumerable GetChildren(TreePath treePath) { if (treePath.IsEmpty()) { return(getGroupNodes()); } AbstractIssueGroupNode groupNode = treePath.LastNode as AbstractIssueGroupNode; if (groupNode != null) { return(groupNode.IssueNodes); } IssueNode issueNode = treePath.LastNode as IssueNode; return(issueNode != null ? issueNode.SubtaskNodes : null); }