IDiagramModel
All diagram models implement this interface or an interface that inherits from this interface.
Properties
public string DataFormat { get; set; }
value = iDiagramModel.DataFormat
iDiagramModel.DataFormat = value
Gets or sets the format of this model's data.
public bool IsChangingModel { get; }
value = iDiagramModel.IsChangingModel
This property is true during a call to Boolean), indicating a change happening due to an undo or a redo.
public bool IsInTransaction { get; }
value = iDiagramModel.IsInTransaction
True if there is an UndoManager and a transaction has been started.
public bool IsModified { get; set; }
value = iDiagramModel.IsModified
iDiagramModel.IsModified = value
Gets or sets whether this model is considered changed from an earlier state.
public bool Modifiable { get; set; }
value = iDiagramModel.Modifiable
iDiagramModel.Modifiable = value
Gets or sets whether various model-changing methods are enabled.
public string Name { get; set; }
value = iDiagramModel.Name
iDiagramModel.Name = value
A name for this model.
public IEnumerable NodesSource { get; set; }
value = iDiagramModel.NodesSource
iDiagramModel.NodesSource = value
Gets or sets the collection of node data items for the model.
public bool SkipsUndoManager { get; set; }
value = iDiagramModel.SkipsUndoManager
iDiagramModel.SkipsUndoManager = value
Gets or sets a flag that controls whether the model notifies any UndoManager that a change has occurred.
public UndoManager UndoManager { get; set; }
value = iDiagramModel.UndoManager
iDiagramModel.UndoManager = value
Gets or sets the UndoManager for this model.
Methods
public ICopyDictionary AddCollectionCopy(IDataCollection coll, ICopyDictionary env)
result = iDiagramModel.AddCollectionCopy(coll, env)
Copy existing data and add to this model.
- coll
- the collection of data to be copied
- env
- the ICopyDictionary used to keep track of copied objects; if null, the method will call CreateCopyDictionary, use it, and return it
Returns: the updated copy dictionary
public object AddLink(object fromdata, object fromparam, object todata, object toparam)
result = iDiagramModel.AddLink(fromdata, fromparam, todata, toparam)
Add a link between one node/port and another node/port.
- fromdata
- a node key identifying the node data from which the link comes
- fromparam
- an optional value identifying which port on the "from" node the link is connected to
- todata
- a node key identify the node data to which the link goes
- toparam
- an optional value identifying which port on the "to" node the link is connected to
public void AddNode(object nodedata)
iDiagramModel.AddNode(nodedata)
Add a node data to NodesSource.
- nodedata
public object AddNodeCopy(object nodedata)
result = iDiagramModel.AddNodeCopy(nodedata)
Add a copy of a node data to this model.
- nodedata
Returns: the copied node data
public void ChangeModel(ModelChangedEventArgs e, bool undo)
iDiagramModel.ChangeModel(e, undo)
This is called during an Undo or a Redo to actually make state changes to this model or to this model's data.
- e
- an edit describing the change to be performed
- undo
- true if undoing; false if redoing
public void ClearUnresolvedReferences()
iDiagramModel.ClearUnresolvedReferences()
Forget all unresolved delayed or forward references.
public bool CommitTransaction(string tname)
result = iDiagramModel.CommitTransaction(tname)
Call the UndoManager's CommitTransaction method.
- tname
- a String describing the transaction
public ICopyDictionary CreateCopyDictionary()
result = iDiagramModel.CreateCopyDictionary()
Create an ICopyDictionary initialized for this model.
Returns: Normally this will be an empty dictionary.
public IDataCollection CreateDataCollection()
result = iDiagramModel.CreateDataCollection()
Create an empty IDataCollection for this model.
public IDiagramModel CreateInitializedCopy(IDataCollection init)
result = iDiagramModel.CreateInitializedCopy(init)
Create a copy of this model initialized with different data.
- init
- this may be null, meaning no initial data
Returns: a model of the same type as this
public void DoNodeAdded(object nodedata)
iDiagramModel.DoNodeAdded(nodedata)
This should be called when a node data object is added to the NodesSource collection.
- nodedata
public void DoNodeKeyChanged(object nodedata)
iDiagramModel.DoNodeKeyChanged(nodedata)
This should be called when a node data's key value may have changed.
- nodedata
public void DoNodeRemoved(object nodedata)
iDiagramModel.DoNodeRemoved(nodedata)
This should be called when a node data object is removed from the NodesSource collection.
- nodedata
public object FindNodeByKey(object key)
result = iDiagramModel.FindNodeByKey(key)
Given a key, find the node data with that key.
- key
- a value of null for this argument will result in the default value for the node data Type
Returns: a node data with that key, if it is present in the model; the value will be the default for the type if no such node data is known to be in this model
public string GetCategoryForNode(object nodedata)
result = iDiagramModel.GetCategoryForNode(nodedata)
To help distinguish between different kinds of nodes, each node has a "category" that is just a string.
- nodedata
Returns: the default category is the empty string
public IEnumerable<object> GetConnectedNodesForNode(object nodedata)
result = iDiagramModel.GetConnectedNodesForNode(nodedata)
Return a sequence of node data that are directly connected to a given node, in either direction.
- nodedata
Returns: an IEnumerable
public IEnumerable<object> GetFromNodesForNode(object nodedata)
result = iDiagramModel.GetFromNodesForNode(nodedata)
Return a sequence of node data that are directly connected by links going into a given node.
- nodedata
Returns: an IEnumerable
public Type GetNodeType()
result = iDiagramModel.GetNodeType()
Return the Type of the node data.
Returns: a Type, not a node data object, nor a string
public IEnumerable<object> GetToNodesForNode(object nodedata)
result = iDiagramModel.GetToNodesForNode(nodedata)
Return a sequence of node data that are directly connected by links coming out from a given node.
- nodedata
Returns: an IEnumerable
public bool IsLinked(object fromdata, object fromparam, object todata, object toparam)
result = iDiagramModel.IsLinked(fromdata, fromparam, todata, toparam)
This predicate is true if there is a link from one node data/port to another one.
- fromdata
- a node key identifying the node data from which the link comes
- fromparam
- an optional value identifying which port on the "from" node the link is connected to
- todata
- a node key identify the node data to which the link goes
- toparam
- an optional value identifying which port on the "to" node the link is connected to
Returns: true if there are any links
public bool IsLinkValid(object fromdata, object fromparam, object todata, object toparam)
result = iDiagramModel.IsLinkValid(fromdata, fromparam, todata, toparam)
This predicate is true if adding a link between two nodes/ports would result in a valid graph.
- fromdata
- a node key identifying the node data from which the link comes
- fromparam
- an optional value identifying which port on the "from" node the link is connected to
- todata
- a node key identify the node data to which the link goes
- toparam
- an optional value identifying which port on the "to" node the link is connected to
public bool IsNodeData(object nodedata)
result = iDiagramModel.IsNodeData(nodedata)
This predicate is true if the argument is a node data in this model.
- nodedata
- the object to be checked to see if it is a known node data in this model
Returns: true if the is in the NodesSource
public bool IsNodeType(object nodedata)
result = iDiagramModel.IsNodeType(nodedata)
This predicate is true when the argument is an instance of the node data Type.
- nodedata
- the arbitrary object to be checked for compatibility to be a node data
Returns: true if the can be cast to the the node data Type; false otherwise
public void RaiseChanged(ModelChangedEventArgs e)
iDiagramModel.RaiseChanged(e)
Raise a Changed event, given a ModelChangedEventArgs.
- e
- a ModelChangedEventArgs that describes what changed and how
public void RemoveLink(object fromdata, object fromparam, object todata, object toparam)
iDiagramModel.RemoveLink(fromdata, fromparam, todata, toparam)
Remove all links connecting the two nodes/ports in the one direction.
- fromdata
- a node key identifying the node data from which the link comes
- fromparam
- an optional value identifying which port on the "from" node the link is connected to
- todata
- a node key identify the node data to which the link goes
- toparam
- an optional value identifying which port on the "to" node the link is connected to
public void RemoveNode(object nodedata)
iDiagramModel.RemoveNode(nodedata)
Remove node data from NodesSource.
- nodedata
public bool RollbackTransaction()
result = iDiagramModel.RollbackTransaction()
Call the UndoManager's RollbackTransaction method.
public bool StartTransaction(string tname)
result = iDiagramModel.StartTransaction(tname)
Call the UndoManager's StartTransaction method.
- tname
- a String describing the transaction
Returns: the value of the call to StartTransaction
Events
public event EventHandler<ModelChangedEventArgs> Changed
iDiagramModel.Changed += handler
The Changed event is raised whenever the model is modified.