Ejemplo n.º 1
0
 /// <summary>
 /// Called before the <paramref name="link"/> is removed from the diagram.
 /// </summary>
 /// <param name="link">a <see cref="Link"/></param>
 /// <remarks>
 /// <para>
 /// Removing a link will request a new automatic layout.
 /// </para>
 /// <para>
 /// The implementation of this method should not modify the model.
 /// This method cannot and should not prevent or alter the removal of the link from the diagram.
 /// </para>
 /// </remarks>
 protected virtual void OnLinkRemoving(Link link) {
   if (link == null) return;
   link.InvalidateLayout(LayoutChange.LinkRemoved);
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Called after the <paramref name="link"/> is added to the diagram.
 /// </summary>
 /// <param name="link">a <see cref="Link"/></param>
 /// <remarks>
 /// <para>
 /// Adding a link will request a new automatic layout.
 /// If either of the link's nodes are not <c>Visible</c>, the link will also be made not <c>Visible</c>.
 /// </para>
 /// <para>
 /// The implementation of this method should not modify the model.
 /// This method cannot and should not prevent or alter the addition of the link to the diagram.
 /// </para>
 /// </remarks>
 protected virtual void OnLinkAdded(Link link) {
   if (link == null) return;
   Diagram diagram = this.Diagram;
   if (diagram == null) return;
   bool vis = true;
   Group sg = link.ContainingSubGraph;
   if (sg != null && (!sg.Visible || !sg.IsExpandedSubGraph)) vis = false;
   if (vis) {
     Node from = link.FromNode;
     if (from != null && from.FindVisibleNode(null) == null) vis = false;
   }
   if (vis) {
     Node to = link.ToNode;
     if (to != null && to.FindVisibleNode(null) == null) vis = false;
   }
   if (link.Visible != vis) link.Visible = vis;
   link.InvalidateLayout(LayoutChange.LinkAdded);
 }