LinkingBaseTool
This abstract class is the base class for LinkingTool and RelinkingTool.
Inherits: DiagramTool
Constructors
protected LinkingBaseTool()
linkingBaseTool = LinkingBaseTool()
This does common initialization for the linking tools.
Properties
protected bool Forwards { get; set; }
value = linkingBaseTool.Forwards
linkingBaseTool.Forwards = value
Gets or sets whether the linking operation is in the forwards direction.
protected Node OriginalFromNode { get; set; }
value = linkingBaseTool.OriginalFromNode
linkingBaseTool.OriginalFromNode = value
Gets or sets the original node from which the link was connected.
protected FrameworkElement OriginalFromPort { get; set; }
value = linkingBaseTool.OriginalFromPort
linkingBaseTool.OriginalFromPort = value
Gets or sets the FrameworkElement that is the port from which the link was connected.
protected Link OriginalLink { get; set; }
value = linkingBaseTool.OriginalLink
linkingBaseTool.OriginalLink = value
Gets or sets the original Link being reconnected by the RelinkingTool.
protected Node OriginalToNode { get; set; }
value = linkingBaseTool.OriginalToNode
linkingBaseTool.OriginalToNode = value
Gets or sets the original node to which the link was connected.
protected FrameworkElement OriginalToPort { get; set; }
value = linkingBaseTool.OriginalToPort
linkingBaseTool.OriginalToPort = value
Gets or sets the FrameworkElement that is the port to which the link was connected.
public double PortGravity { get; set; }
value = linkingBaseTool.PortGravity
linkingBaseTool.PortGravity = value
Gets or sets the distance at which link snapping occurs.
protected FrameworkElement TargetPort { get; set; }
value = linkingBaseTool.TargetPort
linkingBaseTool.TargetPort = value
Gets or sets a proposed FrameworkElement port for connecting a link.
public Node TemporaryFromNode { get; set; }
value = linkingBaseTool.TemporaryFromNode
linkingBaseTool.TemporaryFromNode = value
Gets or sets the temporary Node at the "from" end of the link.
protected FrameworkElement TemporaryFromPort { get; }
value = linkingBaseTool.TemporaryFromPort
Gets the element representing the port for the TemporaryFromNode.
public Link TemporaryLink { get; set; }
value = linkingBaseTool.TemporaryLink
linkingBaseTool.TemporaryLink = value
Gets or sets the temporary Link that is shown while the user is drawing or reconnecting a link.
public DataTemplate TemporaryLinkTemplate { get; set; }
value = linkingBaseTool.TemporaryLinkTemplate
linkingBaseTool.TemporaryLinkTemplate = value
Gets or sets the DataTemplate used to render the TemporaryLink.
public DataTemplate TemporaryNodeTemplate { get; set; }
value = linkingBaseTool.TemporaryNodeTemplate
linkingBaseTool.TemporaryNodeTemplate = value
Gets or sets the DataTemplate used to render the TemporaryFromNode and TemporaryToNode.
public Node TemporaryToNode { get; set; }
value = linkingBaseTool.TemporaryToNode
linkingBaseTool.TemporaryToNode = value
Gets or sets the temporary Node at the "to" end of the link.
protected FrameworkElement TemporaryToPort { get; }
value = linkingBaseTool.TemporaryToPort
Gets the element representing the port for the TemporaryToNode.
protected Dictionary<FrameworkElement, bool> ValidPortsCache { get; set; }
value = linkingBaseTool.ValidPortsCache
linkingBaseTool.ValidPortsCache = value
Gets or sets the dictionary used to keep track of ports for which a link may be valid.
Methods
protected virtual void CopyPortProperties(Node realnode, FrameworkElement realport, Node tempnode, FrameworkElement tempport, bool toend)
linkingBaseTool.CopyPortProperties(realnode, realport, tempnode, tempport, toend)
Make a temporary port look and act like a real one.
- realnode
- realport
- tempnode
- tempport
- toend
protected virtual Link CreateTemporaryLink()
result = linkingBaseTool.CreateTemporaryLink()
Construct a Link to act as a temporary link.
protected virtual Node CreateTemporaryNode(bool toend)
result = linkingBaseTool.CreateTemporaryNode(toend)
Construct a Node to act as a temporary node.
- toend
Returns: an unbound Node defined by the TemporaryNodeTemplate, or if that is null, by the default template named "DefaultTemporaryNodeTemplate".
public override void DoMouseMove()
linkingBaseTool.DoMouseMove()
Mouse movement results in the temporary node moving to where the valid TargetPort is located, or to where the mouse is if there is no valid target port nearby.
public override void DoStart()
linkingBaseTool.DoStart()
If needed, call Boolean) and CreateTemporaryLink, and capture the mouse.
public override void DoStop()
linkingBaseTool.DoStop()
Release the mouse capture and clear out any temporary state.
protected virtual FrameworkElement FindTargetPort(bool toend)
result = linkingBaseTool.FindTargetPort(toend)
Find a port with which the user could complete a valid link.
- toend
- true if looking for a "to" port
Returns: a FrameworkElement representing a valid port, or null if no such port is near the current mouse point (within PortGravity distance)
public virtual bool IsInSameNode(FrameworkElement fromport, FrameworkElement toport)
result = linkingBaseTool.IsInSameNode(fromport, toport)
This predicate is true if both argument ports are in the same Node.
- fromport
- toport
public virtual bool IsLinked(FrameworkElement fromport, FrameworkElement toport)
result = linkingBaseTool.IsLinked(fromport, toport)
This predicate is true if there is a link in the model going from to .
- fromport
- a FrameworkElement representing the "from" port
- toport
- a FrameworkElement representing the "to" port
public virtual bool IsValidFrom(Node fromnode, FrameworkElement fromport)
result = linkingBaseTool.IsValidFrom(fromnode, fromport)
This predicate is true if it is permissible to connect a link from a given node/port.
- fromnode
- fromport
Returns: False if the is in a Layer that does not AllowLink. False if DependencyObject) for the is either false or null. False if the number of links connected to the would exceed the DependencyObject) value. Otherwise true.
public virtual bool IsValidLink(Node fromnode, FrameworkElement fromport, Node tonode, FrameworkElement toport)
result = linkingBaseTool.IsValidLink(fromnode, fromport, tonode, toport)
This predicate should be true when it is logically valid to connect a link from one node/port to another node/port.
- fromnode
- the "from" Node
- fromport
- the "from" FrameworkElement
- tonode
- the "to" Node (perhaps the same as )
- toport
- the "to" FrameworkElement (perhaps the same as )
Returns: False if FrameworkElement) is false for the and . False if FrameworkElement) is false for the and . False if FrameworkElement) is true unless DependencyObject) is true for both ports. False if FrameworkElement) is true unless DependencyObject) is true for both ports. False if trying to link to the link's own label node(s). False if Object) or one of the model-specific IsRelinkValid methods is false, depending on whether OriginalLink is null (a new link) or non-null (a relink). Otherwise true.
public virtual bool IsValidTo(Node tonode, FrameworkElement toport)
result = linkingBaseTool.IsValidTo(tonode, toport)
This predicate is true if it is permissible to connect a link to a given node/port.
- tonode
- toport
Returns: False if the is in a Layer that does not AllowLink. False if DependencyObject) for the is either false or null. False if the number of links connected to the would exceed the DependencyObject) value. Otherwise true.
protected virtual void SetNoTargetPortProperties(Node tempnode, FrameworkElement tempport)
linkingBaseTool.SetNoTargetPortProperties(tempnode, tempport)
Reset temporary port properties to neutral values when there is no target port.
- tempnode
- tempport
Fields
public static readonly DependencyProperty PortGravityProperty
value = LinkingBaseTool.PortGravityProperty
Identifies the PortGravity dependency property.
public static readonly DependencyProperty TemporaryLinkTemplateProperty
value = LinkingBaseTool.TemporaryLinkTemplateProperty
Identifies the TemporaryLinkTemplate dependency property.
public static readonly DependencyProperty TemporaryNodeTemplateProperty
value = LinkingBaseTool.TemporaryNodeTemplateProperty
Identifies the TemporaryNodeTemplate dependency property.