/// <summary> /// This is called by <see cref="Group.ExpandSubGraph"/> to make sure the group's /// member <see cref="Node"/>s and <see cref="Link"/>s all exist in the diagram. /// </summary> /// <param name="sg">a <see cref="Group"/></param> /// <remarks> /// <para> /// This depends on the diagram's <see cref="Northwoods.GoXam.Diagram.Model"/> /// being a <see cref="Northwoods.GoXam.Model.ISubGraphModel"/>. /// You might want to override this method to bring in data to the model, /// if the needed data isn't in the model already. /// </para> /// </remarks> public virtual void RealizeSubGraphMembers(Group sg) { if (sg == null) return; Diagram diagram = this.Diagram; if (diagram != null && ((diagram.Filter & PartManagerFilter.CollapsedSubGraphMembers) != 0) && sg.IsBoundToData) { ISubGraphModel sgmodel = diagram.Model as ISubGraphModel; if (sgmodel == null) return; GroupPanel gp = sg.GroupPanel; Point pos = (gp != null ? sg.GetElementPoint(gp, Spot.TopLeft) : new Point()); foreach (Object childdata in sgmodel.GetMemberNodesForGroup(sg.Data)) { if (FindNodeForData(childdata, sgmodel) == null) { AddNodeForData(childdata, sgmodel); if (gp != null) { Node mem = FindNodeForData(childdata, sgmodel); if (mem != null) { Point loc = mem.Position; if (Double.IsNaN(loc.X) || Double.IsNaN(loc.Y)) mem.Position = pos; } } } } ISubGraphLinksModel sglmodel = diagram.Model as ISubGraphLinksModel; if (sglmodel != null) { foreach (Object childdata in sglmodel.GetMemberLinksForGroup(sg.Data)) { if (FindLinkForData(childdata, sglmodel) == null) AddLinkForData(childdata, sglmodel); } } } }