Пример #1
0
    /// <summary>
    /// Filters the out.
    /// </summary>
    /// <param name="info">The object info.</param>
    internal static void FilterOut(ObjectInfo info)
    {
      if (info == null)
      {
        throw new ArgumentNullException("info");
      }

      objectInfoCollection.Remove(info);
      FilterOut(info, true);
    }
Пример #2
0
    public void AddSequenceObject(string key, string typeName)
    {
      if (string.IsNullOrEmpty(key) || string.IsNullOrEmpty(typeName))
      {
        throw new ArgumentNullException(string.IsNullOrEmpty(key) ? "key" : "typeName");
      }

      ObjectInfo objectInfo = new ObjectInfo(key, typeName);
      DiagramContext.DiagramObjects.Add(objectInfo);
    }
Пример #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ContentChangedEventArgs"/> class.
 /// </summary>
 /// <param name="newInfo">The new info.</param>
 internal ContentChangedEventArgs(ObjectInfo newInfo)
 {
   this.NewInfo = newInfo;
 }
Пример #4
0
    /// <summary>
    /// Animate the new person that was added to the diagram.
    /// </summary>
    private void AnimateNewObjectInfo()
    {
      // The new person is optional, can be null.
      if (this.newObjectInfo == null)
      {
        return;
      }

      // Get the UI element to animate.                
      DiagramNode node = this.logic.GetDiagramNode(this.newObjectInfo);
      if (node != null)
      {
        // Create the new person animation.
        DoubleAnimation anim = new DoubleAnimation(0, 1, TimeSpan.FromMilliseconds(Constants.NewPersonAnimationDuration));

        // Animate the node.
        ScaleTransform transform = new ScaleTransform();
        transform.BeginAnimation(ScaleTransform.ScaleXProperty, anim);
        transform.BeginAnimation(ScaleTransform.ScaleYProperty, anim);
        node.RenderTransform = transform;
      }

      this.newObjectInfo = null;
    }
Пример #5
0
    /// <summary>
    /// Called when data changed in the main ObjectInfo collection. This can be
    /// a node being filtered out of the collection, updated ObjectInfo details, and
    /// updated relationship data.
    /// </summary>
    /// <param name="sender">The source of the event.</param>
    /// <param name="e">The <see cref="OpenSequence.Xps.Data.ContentChangedEventArgs"/> instance containing the event data.</param>
    private void OnDiagramModelContentChanged(object sender, ContentChangedEventArgs e)
    {
      if (this.populating)
      {
        return;
      }

      // Save the object info that is being added to the diagram.
      // This is optional and can be null.
      this.newObjectInfo = e.NewInfo;

      // Redraw the diagram.
      this.UpdateDiagram();
      this.InvalidateMeasure();
      this.InvalidateArrange();
      this.InvalidateVisual();
    }
Пример #6
0
 /// <summary>
 /// Create a DiagramNode.
 /// </summary>
 /// <param name="objectInfo">The object info.</param>
 /// <returns>The newly created DiagramNode.</returns>
 private static DiagramNode CreateNode(ObjectInfo objectInfo)
 {
   DiagramNode node = new DiagramSequenceNode();
   node.ObjectInfo = objectInfo;
   node.NodeType = NodeType.TypeInfo;
   return node;
 }
Пример #7
0
    /// <summary>
    /// Creates the primary model row.
    /// </summary>
    /// <param name="primaryObjectInfo">The primary object info.</param>
    /// <returns>The created DiagramRow instance.</returns>
    internal DiagramRow CreateClassModelPrimaryRow(ObjectInfo primaryObjectInfo)
    {
      // TODO: find proper algorithm to layout the shapes...
      // The object info nodes are contained in different groups, 
      DiagramGroup primaryGroup = new DiagramGroup();
      DiagramGroup baselessGroup = new DiagramGroup();

      // Set up the row.
      DiagramRow primaryRow = new DiagramRow();

      // do something with objectInfo's group
      ExtendedObjectInfo extendedInfo = primaryObjectInfo as ExtendedObjectInfo;
      if (extendedInfo != null)
      {
        // code is here currently to use property getter;
        if (string.Compare(extendedInfo.Group, "default", StringComparison.OrdinalIgnoreCase) == 0)
        {
          // this is the default group...
        }
        else
        {
          // these are any other groups...
        }

        foreach (ExtendedObjectInfo objectInfo in this.DiagramModel)
        {
          // find base type within current namespace
          ExtendedObjectInfo baseInfo = this.FindBaseTypeInNamespace(objectInfo);
          if (baseInfo != null)
          {
            if (!this.objectInfoLookup.ContainsKey(baseInfo))
            {
              DiagramNode node = CreateNode(baseInfo);

              // code is here currently to use property getter;
              if (node.NodeType == NodeType.TypeInfo || node.NodeType == NodeType.MessageInfo)
              {
                // exit.....
                if (node.Location.X == 0)
                {
                  // exit even faster...
                }
              }

              primaryGroup.Add(node);
              this.objectInfoLookup.Add(node.ObjectInfo, new DiagramConnectorNode(node, primaryGroup, primaryRow));
            }
          }
          else
          {
            if (baselessGroup.Nodes.Count < 10)
            {
              if (!this.objectInfoLookup.ContainsKey(objectInfo))
              {
                DiagramNode node = CreateNode(objectInfo);
                baselessGroup.Add(node);
                this.objectInfoLookup.Add(node.ObjectInfo, new DiagramConnectorNode(node, baselessGroup, primaryRow));
              }
            }
          }
        }
      }

      primaryRow.Add(primaryGroup);
      primaryRow.Add(baselessGroup);

      return primaryRow;
    }
Пример #8
0
    /// <summary>
    /// Gets the node bounds.
    /// </summary>
    /// <param name="objectInfo">The object info.</param>
    /// <returns>A Rect object that contains the node's bounds.</returns>
    internal Rect GetNodeBounds(ObjectInfo objectInfo)
    {
      Rect bounds = Rect.Empty;
      if (objectInfo != null && this.objectInfoLookup.ContainsKey(objectInfo))
      {
        DiagramConnectorNode connector = this.objectInfoLookup[objectInfo];
        bounds = new Rect(connector.TopLeft.X, connector.TopLeft.Y, connector.Node.ActualWidth, connector.Node.ActualHeight);
      }

      return bounds;
    }
Пример #9
0
    /// <summary>
    /// Gets the diagram node.
    /// </summary>
    /// <param name="objectInfo">The object info.</param>
    /// <returns>The diagram node identified by the given object info.</returns>
    internal DiagramNode GetDiagramNode(ObjectInfo objectInfo)
    {
      if (objectInfo == null)
      {
        return null;
      }

      if (!this.objectInfoLookup.ContainsKey(objectInfo))
      {
        return null;
      }

      return this.objectInfoLookup[objectInfo].Node;
    }
Пример #10
0
    /// <summary>
    /// Filters the out.
    /// </summary>
    /// <param name="info">The object info.</param>
    /// <param name="includeTargetCalls">if set to <c>true</c> include target calls.</param>
    internal static void FilterOut(ObjectInfo info, bool includeTargetCalls)
    {
      // find all Messages for this info...
      var query = from m in Messages
                  where m.Source == info || (includeTargetCalls && m.Target == info)
                  select m;
      List<MessageInfo> removals = query.ToList();

      foreach (var message in removals)
      {
        Messages.Remove(message);
      }
    }