/// <summary> Get the set of child elements grouped by their qualifiers. </summary> private IDictionary GetChildGroups() { HybridDictionary groups = new HybridDictionary(); string qualifierName; ElementGroup group; foreach (XElement element in _element.Elements()) { if (element.Name.LocalName.IndexOf(".") >= 0) { qualifierName = element.Name.LocalName.Substring(0, element.Name.LocalName.IndexOf(".")); group = groups[qualifierName] as ElementGroup; if (group != null) { group.Add(element); } else { group = new ElementGroup(); group.Name = qualifierName; group.Add(element); groups.Add(qualifierName, group); } } } return(groups); }
private Table CreateGroupTable(ElementGroup group) { Table groupTable = new Table(); groupTable.BackColor = CTabSurfaceColor; groupTable.Tag = group; groupTable.OnGetValue += new GetTableValueHandler(GroupsGetValue); groupTable.OnGetDesignerRequired += new GetTableDesignerRequiredHandler(GroupsGetDesignerRequired); groupTable.OnGetDesigner += new GetTableDesignerHandler(GroupsGetDesigner); groupTable.BeginUpdate(); TableColumn column; foreach (XElement element in group) { // Ensure that there are columns for each attribute foreach (XAttribute attribute in element.Attributes()) { column = groupTable.Columns[attribute.Name.LocalName]; if (column == null) { column = new TableColumn(groupTable); column.Name = attribute.Name.LocalName; column.Title = attribute.Name.LocalName; groupTable.Columns.Add(column); } } // Ensure that there is a 'Details' column if there are any child elements if (element.HasElements) { column = groupTable.Columns["InternalDetails"]; if (column == null) { column = new TableColumn(groupTable); column.Name = "InternalDetails"; column.Title = Strings.Analyzer_DetailsColumnTitle; groupTable.Columns.Add(column); } } // Add a row for each element groupTable.Rows.Add(element); } groupTable.EndUpdate(); return(groupTable); }