public override void OnEndEdit(DiagramItemEventArgs e) { base.OnEndEdit(e); Debug.Assert(ParentShape != null, "ElementListCompartment should be contained in another shape."); if (ParentShape != null) { var ets = ParentShape as EntityTypeShape; Debug.Assert( ets != null, "Expected ElementListCompartment's parent type: EntityTypeShape, Actual: " + ParentShape.GetType().Name); if (ets != null && ets.Diagram != null) { var modelDiagram = ets.Diagram.ModelElement.ModelXRef.GetExisting(ets.Diagram) as Diagram; var diagrams = modelDiagram.Parent as Diagrams; if (diagrams != null) { var diagramArtifact = diagrams.Artifact as DiagramArtifact; if (diagramArtifact != null && e.DiagramItem.RepresentedElements != null && e.DiagramItem.RepresentedElements.Count == 1) { var representedItems = e.DiagramItem.RepresentedElements.GetEnumerator(); if (representedItems.MoveNext()) { var scalarProperty = representedItems.Current as ScalarProperty; if (scalarProperty != null) { diagramArtifact.RaisePropertyNameCommitted(ets.Name, scalarProperty.Name); } } } } } } }
/// <summary> /// Gets drawing information for a single list item in the list field. /// </summary> /// <param name="listField">The child list field requesting the drawing information.</param> /// <param name="row">The zero-based row number of the list item to draw.</param> /// <param name="itemDrawInfo">An ItemDrawInfo that receives the drawing information.</param> public override void GetItemDrawInfo(ListField listField, int row, ItemDrawInfo itemDrawInfo) { base.GetItemDrawInfo(listField, row, itemDrawInfo); Debug.Assert(ParentShape != null, "ElementListCompartment should be contained in another shape."); if (ParentShape != null) { var ets = ParentShape as EntityTypeShape; Debug.Assert( ets != null, "Expected ElementListCompartment's parent type:EntityTypeShape , Actual:" + ParentShape.GetType().Name); if (ets != null && ets.Diagram != null) { // if the compartment list item is in the EmphasizedShapes list, then set the flag so that the item will be drawn in alternate font. // (The list item's font will be bolded and underlined). if (ets.Diagram.EmphasizedShapes.Contains(new DiagramItem(this, ListField, new ListItemSubField(row)))) { itemDrawInfo.AlternateFont = true; } } } }
public static void DrawShape(ParentShape ps) { ps.Draw(); }