internal void RemoveNestedChild(INestableChild element) { if (element != null && nestedChilds.Remove(element)) { OnRemoveNestedChild(new NestingEventArgs(element)); } }
public NestingRelationship Clone(INestable parentType, INestableChild innerType) { NestingRelationship nesting = new NestingRelationship(parentType, innerType); nesting.CopyFrom(this); return(nesting); }
/// <exception cref="RelationshipException"> /// Cannot create relationship between the two types. /// </exception> /// <exception cref="ArgumentNullException"> /// <paramref name="parentType"/> or <paramref name="innerType"/> is null. /// </exception> public NestingRelationship AddNesting(INestable parentType, INestableChild innerType) { NestingRelationship nesting = new NestingRelationship(parentType, innerType); AddRelationship(nesting); return(nesting); }
internal void AddNestedChild(INestableChild element) { if (element != null && !nestedChilds.Contains(element)) { nestedChilds.Add(element); OnAddNestedChild(new NestingEventArgs(element)); } }
internal NestableChildHelper(INestableChild nestableChild) { if (nestableChild == null) { throw new ArgumentException(nameof(nestableChild)); } this.nestableChild = nestableChild; }
internal bool IsNestedAncestor(INestableChild type) { var thisNestableChild = nestable as INestableChild; if (thisNestableChild != null && thisNestableChild.NestingParent != null && thisNestableChild.NestingParent.IsNestedAncestor(type)) { return(true); } else { return(type == thisNestableChild); } }
/// <exception cref="ArgumentNullException"> /// <paramref name="first"/> is null.-or- /// <paramref name="second"/> is null. /// </exception> internal NestingRelationship(INestable first, INestableChild second) { if (first == null) { throw new ArgumentNullException("first"); } if (second == null) { throw new ArgumentNullException("second"); } this.first = first; this.second = second; Attach(); }
/// <summary> /// Adds the relationships from <paramref name="nrRelationships"/> to the /// diagram. /// </summary> /// <param name="nrRelationships">The relationships to add.</param> private void AddRelationships(NRRelationships nrRelationships) { foreach (NRNesting nrNesting in nrRelationships.Nestings) { INestable parentType = types[nrNesting.ParentType] as INestable; INestableChild innerType = types[nrNesting.InnerType]; if (parentType != null && innerType != null) { diagram.AddNesting(parentType, innerType); } } foreach (NRGeneralization nrGeneralization in nrRelationships.Generalizations) { CompositeType derivedType = types[nrGeneralization.DerivedType] as CompositeType; CompositeType baseType = types[nrGeneralization.BaseType] as CompositeType; if (derivedType != null && baseType != null) { diagram.AddGeneralization(derivedType, baseType); } } foreach (NRRealization nrRealization in nrRelationships.Realizations) { CompositeType implementingType = types[nrRealization.ImplementingType] as CompositeType; InterfaceType interfaceType = types[nrRealization.BaseType] as InterfaceType; if (implementingType != null && interfaceType != null) { diagram.AddRealization(implementingType, interfaceType); } } foreach (NRAssociation nrAssociation in nrRelationships.Associations) { TypeBase first = types[nrAssociation.StartType]; TypeBase second = types[nrAssociation.EndType]; if (first != null && second != null) { AssociationRelationship associationRelationship = diagram.AddAssociation(first, second); associationRelationship.EndMultiplicity = nrAssociation.EndMultiplicity; associationRelationship.StartMultiplicity = nrAssociation.StartMultiplicity; associationRelationship.EndRole = nrAssociation.EndRole; associationRelationship.StartRole = nrAssociation.StartRole; } } }
protected override bool CloneRelationship(IDiagram diagram, Shape first, Shape second) { if (diagram.DiagramType != DiagramType.ClassDiagram) { return(false); } INestable firstType = first.Entity as INestable; INestableChild secondType = second.Entity as INestableChild; if (firstType != null && secondType != null) { NestingRelationship clone = nesting.Clone(firstType, secondType); return(((ClassDiagram)diagram).InsertNesting(clone)); } else { return(false); } }
private void CreateNesting() { INestable parent = first.Entity as INestable; INestableChild child = second.Entity as INestableChild; try { if (parent == null) { throw new RelationshipException(Strings.ErrorParentNestingNotSupported); } if (child == null) { throw new RelationshipException(Strings.ErrorChildNestingNotSupported); } diagram.AddNesting(parent, child); } catch (RelationshipException ex) { MessageBox.Show(Strings.ErrorCannotCreateRelationship + " " + ex.Message); } }
public NestingEventArgs(INestableChild element) { this.element = element; }
public void AddNestedChild(INestableChild type) { nestableHelper.AddNestedChild(type); }
public void AddNestedChild(INestableChild type) { nestableHelper.AddNestedChild(type); type.NestingParent = this; }
public void RemoveNestedChild(INestableChild type) { nestableHelper.RemoveNestedChild(type); type.NestingParent = null; }
public NestingRelationship AddNesting(INestable parentType, INestableChild innerType) { return(model.AddNesting(parentType, innerType)); }
public void RemoveNestedChild(INestableChild type) { nestableHelper.RemoveNestedChild(type); }
public bool IsNestedAncestor(INestableChild type) { return(nestableHelper.IsNestedAncestor(type)); }