PartManager
This class handles the Changed event for the Diagram's Model and is responsible for creating and removing Nodes and Links for the data in the model.
Inherits: FrameworkElement
Constructors
public PartManager()
partManager = PartManager()
The constructor for the standard part manager that is the initial value of PartManager.
Properties
public bool AddsToLogicalTree { get; set; }
value = partManager.AddsToLogicalTree
partManager.AddsToLogicalTree = value
Gets or sets whether Parts are added and removed from the logical tree. [WPF only]
public bool ChecksTransactionLevel { get; set; }
value = partManager.ChecksTransactionLevel
partManager.ChecksTransactionLevel = value
Gets or sets whether this part manager will output warnings to Trace listeners when model changes occur outside of a transaction.
public Diagram Diagram { get; internal set; }
value = partManager.Diagram
partManager.Diagram = value
Gets the Diagram for which this PartManager manages the lifetime of Parts depending on the contents of the Model.
public IEnumerable<Link> Links { get; }
value = partManager.Links
Gets a IEnumerable<Link> holding all of the Links that are in the diagram, including links that are not bound to data.
public int LinksCount { get; }
value = partManager.LinksCount
Gets the current number of Links in the diagram, including links that are not bound to data.
public IEnumerable<Node> Nodes { get; }
value = partManager.Nodes
Gets an IEnumerable<Node> holding all of the Nodes that are in the diagram, including Groups, including nodes that are not bound to data, but excluding Adornments.
public int NodesCount { get; }
value = partManager.NodesCount
Gets the current number of Nodes in the diagram, including nodes that are not bound to data and including Groups, but excluding Adornments.
public bool UpdatesRouteDataPoints { get; set; }
value = partManager.UpdatesRouteDataPoints
partManager.UpdatesRouteDataPoints = value
Gets or sets whether this PartManager should call Link) for each Link that has a new list of Points.
Methods
public Link AddLinkForData(object linkdata, IDiagramModel model)
result = partManager.AddLinkForData(linkdata, model)
Make sure a Link exists for some data in the model, added to the LinkLayer specified by its LayerName.
- linkdata
- the data in the that holds link relationship information
- model
- the model that the is in, an ILinksModel
Returns: the Link for the , either an existing one or a newly created one, or null if IDiagramModel) returns false or if the diagram is uninitialized
public Link AddLinkForData(object fromnodedata, object tonodedata, IDiagramModel model)
result = partManager.AddLinkForData(fromnodedata, tonodedata, model)
Make sure a Link exists for the link relationship between the given pair of node data, added to the LinkLayer specified by its LayerName.
- fromnodedata
- the data from which the link relationship comes
- tonodedata
- the data to which the link relationship goes
- model
- the model that the node data are in, not an ILinksModel
Returns: the Link for the connecting the two node data, either an existing one or a newly created one, or null if IDiagramModel) returns false or if the diagram is uninitialized
public Node AddNodeForData(object nodedata, IDiagramModel model)
result = partManager.AddNodeForData(nodedata, model)
Make sure a Node exists for some data in the model, added to the NodeLayer specified by its LayerName.
- nodedata
- the data in the that holds node information
- model
- the model that the is in
Returns: the Node for the , either an existing one or a newly created one, or null if IDiagramModel) returns false or if the diagram is uninitialized
public virtual ICopyDictionary CopyParts(IEnumerable<Part> coll, IDiagramModel destmodel)
result = partManager.CopyParts(coll, destmodel)
Copy a collection of Parts from this model to a given model.
- coll
- a collection of Parts that are in this model
- destmodel
- if null, this creates a model like this one by calling IDataCollection); the new model is available from the returned ICopyDictionary as its DestinationModel property
Returns: an ICopyDictionary that maps original parts to the copied ones
public virtual void DeleteParts(IEnumerable<Part> coll)
partManager.DeleteParts(coll)
Remove a collection of Parts from this model.
- coll
- a collection of Parts that are in this model
protected virtual void DoRebuildLinkElements()
partManager.DoRebuildLinkElements()
This is called by RebuildLinkElements to construct or reconstruct Links in the diagram.
protected virtual void DoRebuildNodeElements()
partManager.DoRebuildNodeElements()
Make new Nodes for all of model data and add them to the Diagram.
protected virtual bool FilterLinkForData(object fromnodedata, object tonodedata, IDiagramModel model)
result = partManager.FilterLinkForData(fromnodedata, tonodedata, model)
Decide whether the link relationship between a particular pair of node data should be represented in the diagram by a Link.
- fromnodedata
- the data from which the link relationship comes
- tonodedata
- the data to which the link relationship goes
- model
- the model that the node data are in, not an ILinksModel
Returns: true only if IDiagramModel) should make and add a Link to the diagram
protected virtual bool FilterLinkForData(object linkdata, IDiagramModel model)
result = partManager.FilterLinkForData(linkdata, model)
Decide whether a particular should be represented in the diagram by a Link.
- linkdata
- the data in the that holds link relationship information
- model
- the model that the is in, an ILinksModel
Returns: true only if IDiagramModel) should make and add a Link to the diagram
protected virtual bool FilterNodeForData(object nodedata, IDiagramModel model)
result = partManager.FilterNodeForData(nodedata, model)
Decide whether a particular should be represented in the diagram by a Node.
- nodedata
- the data in the that holds node information
- model
- the model that the is in
Returns: true only if IDiagramModel) should make and add a Node to the diagram
protected virtual string FindCategoryForLink(object linkdata, IDiagramModel model)
result = partManager.FindCategoryForLink(linkdata, model)
Determine the category for the link, to be able to decide between different templates for the Link.
- linkdata
- if the model is an ILinksModel, this is the link data; otherwise this is a VirtualLinkData
- model
Returns: If there is no category associated with the link data, this uses the category of the "from" node data if it is not an empty string, or else tries to use the category of the "to" node data. The default category is the empty string.
protected virtual string FindCategoryForNode(object nodedata, IDiagramModel model, bool isgroup, bool islinklabel)
result = partManager.FindCategoryForNode(nodedata, model, isgroup, islinklabel)
Determine the category for the node, to be able to decide between different templates for the Node.
- nodedata
- model
- isgroup
- islinklabel
Returns: the result of calling Object)
public virtual IDiagramModel FindCommonDataModel(object fromnodedata, object tonodedata)
result = partManager.FindCommonDataModel(fromnodedata, tonodedata)
Find the model for the two data objects representing nodes.
- fromnodedata
- tonodedata
Returns: normally the Model, but may return the PartsModel if the both and are Nodes, otherwise null.
public Link FindLinkForData(object fromnodedata, object tonodedata, IDiagramModel model)
result = partManager.FindLinkForData(fromnodedata, tonodedata, model)
Given a pair of node data for which there is a link relationship, find the corresponding Link in this diagram.
- fromnodedata
- the data from which the link relationship comes
- tonodedata
- the data to which the link relationship goes
- model
- the model that the node data are in, not an ILinksModel
Returns: a Link, or null if such a link has not been created for that pair of node data
public Link FindLinkForData(object linkdata, IDiagramModel model)
result = partManager.FindLinkForData(linkdata, model)
Given some in a , find the corresponding Link in this diagram.
- linkdata
- the data in the that holds link relationship information
- model
- the model that the is in, an ILinksModel
Returns: a Link, or null if such a link has not been created for that data
public virtual IEnumerable<Link> FindLinksForData(IDataCollection datacoll)
result = partManager.FindLinksForData(datacoll)
Return a collection of Links in this diagram corresponding to some model data.
- datacoll
- an IDataCollection
Returns: If this model is an ILinksModel, this just calls IDiagramModel) and collects the Links that are found. Otherwise it looks for Links that are connected to the nodes in the data collection.
public virtual IDiagramModel FindNodeDataModel(object nodedata)
result = partManager.FindNodeDataModel(nodedata)
Find the model for some data.
- nodedata
Returns: normally the Model, but may return the PartsModel if the is a Part.
public Node FindNodeForData(object nodedata, IDiagramModel model)
result = partManager.FindNodeForData(nodedata, model)
Given some in a , find the corresponding Node in this diagram.
- nodedata
- the data in the that holds node information
- model
- the model that the is in
Returns: a Node, or null if such a node has not been created for that data
public virtual IEnumerable<Node> FindNodesForData(IDataCollection datacoll)
result = partManager.FindNodesForData(datacoll)
Return a collection of Nodes in this diagram corresponding to some model data.
- datacoll
- an IDataCollection
public virtual IEnumerable<Part> FindPartsForData(IDataCollection datacoll)
result = partManager.FindPartsForData(datacoll)
Return a collection of Parts in this diagram corresponding to some model data.
- datacoll
Returns: a sequence of both Nodes and Links
protected virtual DataTemplate FindTemplateForLink(object linkdata, IDiagramModel model, string category)
result = partManager.FindTemplateForLink(linkdata, model, category)
Given a category and the link data, find a DataTemplate to use in making the Link.
- linkdata
- model
- category
Returns: a DataTemplate taken from either LinkTemplate or LinkTemplateDictionary, or null if no template is found
protected virtual DataTemplate FindTemplateForNode(object nodedata, IDiagramModel model, bool isgroup, bool islinklabel, string category)
result = partManager.FindTemplateForNode(nodedata, model, isgroup, islinklabel, category)
Given a category and the node data, find a DataTemplate to use in making the Node or Group.
- nodedata
- model
- isgroup
- islinklabel
- category
Returns: a DataTemplate taken from either NodeTemplate or NodeTemplateDictionary (or if is true, from either GroupTemplate or GroupTemplateDictionary), or null if no template is found
protected virtual Link MakeLinkForData(object linkdata, IDiagramModel model, DataTemplate templ, string category)
result = partManager.MakeLinkForData(linkdata, model, templ, category)
Construct a new Link, setting its Content and ContentTemplate properties.
- linkdata
- the data that this link is bound to; must not be a Link or any UIElement
- model
- the model that the is in
- templ
- the DataTemplate for the ContentTemplate property
- category
- the category for the link
Returns: a newly created Link
protected virtual Node MakeNodeForData(object nodedata, IDiagramModel model, bool isgroup, bool islinklabel, string category, DataTemplate templ)
result = partManager.MakeNodeForData(nodedata, model, isgroup, islinklabel, category, templ)
Construct a new Node, setting its Content and ContentTemplate properties.
- nodedata
- the data that this node is bound to; must not be a Node or any UIElement
- model
- the model that the is in
- isgroup
- whether the node should be a Group instead of a Node
- islinklabel
- whether the node acts as the label node for a link
- category
- the category of the node
- templ
- the DataTemplate for the ContentTemplate property
Returns: a newly created Node or Group, bound to via a PartBinding
protected virtual void OnLinkAdded(Link link)
partManager.OnLinkAdded(link)
Called after the is added to the diagram.
- link
- a Link
protected virtual void OnLinkRemoved(Link link, LinkLayer layer)
partManager.OnLinkRemoved(link, layer)
Called after the is removed from the diagram.
- link
- a Link
- layer
- the LinkLayer that the was removed from
protected virtual void OnLinkRemoving(Link link)
partManager.OnLinkRemoving(link)
Called before the is removed from the diagram.
- link
- a Link
protected virtual void OnMemberAdded(Node group, Part part)
partManager.OnMemberAdded(group, part)
Called after a part is added to a group node's members.
- group
- a Group
- part
- a Part that has been added to the
protected virtual void OnMemberRemoved(Node group, Part part)
partManager.OnMemberRemoved(group, part)
Called after a part is removed from a group node's members.
- group
- a Group
- part
- a Part that has been removed from the
public virtual void OnModelChanged(ModelChangedEventArgs e)
partManager.OnModelChanged(e)
This is called for each Changed event of the Model.
- e
- the Change property gives a basic description of the change to the model
protected virtual void OnNodeAdded(Node node)
partManager.OnNodeAdded(node)
Called after a is added to the diagram.
- node
- a Node
protected virtual void OnNodeRemoved(Node node, NodeLayer layer)
partManager.OnNodeRemoved(node, layer)
Called after a is removed from the diagram.
- node
- a Node
- layer
- the NodeLayer that the was removed from
protected virtual void OnNodeRemoving(Node node)
partManager.OnNodeRemoving(node)
Called before a is removed from the diagram.
- node
- a Node
public virtual void RealizeSubGraphMembers(Group sg)
partManager.RealizeSubGraphMembers(sg)
This is called by ExpandSubGraph to make sure the group's member Nodes and Links all exist in the diagram.
- sg
- a Group
public virtual void RealizeTreeChildren(Node parent)
partManager.RealizeTreeChildren(parent)
This is called by ExpandTree to make sure all of the node's connected Nodes exist in the diagram.
- parent
public void RebuildLinkElements()
partManager.RebuildLinkElements()
Discard all existing Links and then make new ones for all of model data and add them to the Diagram.
public void RebuildNodeElements()
partManager.RebuildNodeElements()
Discard all existing Nodes and Links and then make new ones for all of model data and add them to the Diagram.
public virtual void ReleaseSubGraphMembers(Group sg)
partManager.ReleaseSubGraphMembers(sg)
This is called by CollapseSubGraph to allow the member Nodes and Links to be removed from the diagram.
- sg
- a Group
public virtual void ReleaseTreeChildren(Node parent)
partManager.ReleaseTreeChildren(parent)
This is called by CollapseTree to allow all of the child nodes and links for a particular Node to be removed from the diagram.
- parent
public void RemoveLinkForData(object fromnodedata, object tonodedata, IDiagramModel model)
partManager.RemoveLinkForData(fromnodedata, tonodedata, model)
Remove any Link that exists for a pair of given node data.
- fromnodedata
- the data from which the link relationship comes
- tonodedata
- the data to which the link relationship goes
- model
- the model that the node data are in, not an ILinksModel
public void RemoveLinkForData(object linkdata, IDiagramModel model)
partManager.RemoveLinkForData(linkdata, model)
Remove any Link that exists in the diagram for the .
- linkdata
- the data in the that holds link relationship information
- model
- the model that the is in, an ILinksModel
public void RemoveNodeForData(object nodedata, IDiagramModel model)
partManager.RemoveNodeForData(nodedata, model)
Remove any Node in this diagram that exists for the .
- nodedata
- model
public virtual void SelectData(IDataCollection datacoll)
partManager.SelectData(datacoll)
Select the Parts in this diagram corresponding to a collection of model data.
- datacoll
- an IDataCollection
protected virtual void UpdateRouteDataPoints(Link link)
partManager.UpdateRouteDataPoints(link)
This is called after link routing, if UpdatesRouteDataPoints is true, to allow the link's Points to be copied to the link data.
- link