Interface IModel

GoDiagram®
v10.0.11
by Northwoods Software®
Namespace: Northwoods.Go.Models
Assembly: Northwoods.GoDiagram.Avalonia.dll
Syntax
public interface IModel

Properties

DataFormat

Gets or sets the name of the format of the diagram data.

Declaration
string DataFormat { get; set; }
Property Value
Type Description
string
See Also

IsReadOnly

Gets or sets whether this model may be modified, such as adding nodes.

Declaration
bool IsReadOnly { get; set; }
Property Value
Type Description
bool
See Also

Name

Gets or sets the name of this model.

Declaration
string Name { get; set; }
Property Value
Type Description
string
See Also

NodeDataSource

Gets or sets the collection of node data objects that correspond to Nodes, Groups, or non-Link Parts in the Diagram.

Declaration
IEnumerable<object> NodeDataSource { get; set; }
Property Value
Type Description
IEnumerable<object>
See Also

NodeKeyProperty

Gets or sets the name of the data property that returns a unique key for each node data object.

Declaration
string NodeKeyProperty { get; set; }
Property Value
Type Description
string
See Also

SharedData

Gets an object that can hold programmer-defined property values for the model as a whole, rather than just for one node or one link.

Declaration
object SharedData { get; set; }
Property Value
Type Description
object
See Also

SkipsUndoManager

Gets or sets whether ChangedEvents are not recorded by the UndoManager.

Declaration
bool SkipsUndoManager { get; set; }
Property Value
Type Description
bool
See Also

UndoManager

Gets or sets the UndoManager for this Model.

Declaration
UndoManager UndoManager { get; set; }
Property Value
Type Description
UndoManager
See Also

Methods

AddNodeData(object)

When you want to add a node or group to the diagram, call this method with a new data object.

Declaration
void AddNodeData(object nodedata)
Parameters
Type Name Description
object nodedata
See Also
AddNodeData(TNodeData)

ApplyIncrementalJson(string)

Modify this model by applying the changes given in an "incremental" model change in JSON format generated by ToIncrementalJson(ChangedEvent).

Declaration
void ApplyIncrementalJson(string s)
Parameters
Type Name Description
string s
See Also

Clear()

Clear out all references to any model data.

Declaration
void Clear()
See Also

Commit(Action<IModel>, string)

Starts a new transaction, calls the provided function, and commits the transaction.

Declaration
void Commit(Action<IModel> func, string tname = "")
Parameters
Type Name Description
Action<IModel> func
string tname
See Also
Commit(Action<Model<TNodeData, TNodeKey, TSharedData>>, string)

CommitTransaction(string)

Commit the changes of the current transaction.

Declaration
bool CommitTransaction(string tname)
Parameters
Type Name Description
string tname
Returns
Type Description
bool
See Also

ContainsNodeData(object)

Decide if a given node data object is in this model, using reference equality.

Declaration
bool ContainsNodeData(object nodedata)
Parameters
Type Name Description
object nodedata
Returns
Type Description
bool
See Also
ContainsNodeData(TNodeData)

CopyNodeData(object)

Make a copy of a node data object.

Declaration
object CopyNodeData(object nodedata)
Parameters
Type Name Description
object nodedata
Returns
Type Description
object
See Also
CopyNodeData(TNodeData)

FindNodeDataForKey(object)

Given a key, find the node data object in this model that uses the given value as its unique key.

Declaration
object FindNodeDataForKey(object key)
Parameters
Type Name Description
object key
Returns
Type Description
object
See Also

GetCategoryForNodeData(object)

Find the category of a given node data, a string naming the node template or group template or part template that the Diagram should use to represent the node data.

Declaration
string GetCategoryForNodeData(object nodedata)
Parameters
Type Name Description
object nodedata
Returns
Type Description
string
See Also

GetKeyForNodeData(object)

Given a node data object return its unique key.

Declaration
object GetKeyForNodeData(object nodedata)
Parameters
Type Name Description
object nodedata
Returns
Type Description
object
See Also

InsertListItem(IList, int, object)

Add an item to a data list that may be data bound by a Panel as its ItemList, given a new data value and the index at which to insert the new value, in a manner that can be undone/redone and that automatically updates any bindings.

Declaration
void InsertListItem(IList list, int idx, object val)
Parameters
Type Name Description
IList list
int idx
object val
See Also

RemoveListItem(IList, int)

Remove an item from a data list that may be data bound by a Panel as its ItemList, given the index at which to remove a data value, in a manner that can be undone/redone and that automatically updates any bindings.

Declaration
void RemoveListItem(IList list, int idx = -1)
Parameters
Type Name Description
IList list
int idx
See Also

RemoveNodeData(object)

When you want to remove a node or group from the diagram, call this method with an existing data object.

Declaration
void RemoveNodeData(object nodedata)
Parameters
Type Name Description
object nodedata
See Also
RemoveNodeData(TNodeData)

RollbackTransaction()

Rollback the current transaction, undoing any recorded changes.

Declaration
bool RollbackTransaction()
Returns
Type Description
bool
See Also

Set(object, string, object)

Change the value of some property of a node data, a link data, an item data, or the SharedData, given a string naming the property and the new value, in a manner that can be undone/redone and that automatically updates any bindings.

Declaration
void Set(object data, string propname, object val)
Parameters
Type Name Description
object data
string propname
object val
See Also

SetCategoryForNodeData(object, string)

Change the category of a given node data, a string naming the node template or group template or part template that the Diagram should use to represent the node data.

Declaration
void SetCategoryForNodeData(object nodedata, string cat)
Parameters
Type Name Description
object nodedata
string cat
See Also

SetKeyForNodeData(object, object)

Change the unique key of a given node data that is already in this model.

Declaration
void SetKeyForNodeData(object nodedata, object key)
Parameters
Type Name Description
object nodedata
object key
See Also
SetKeyForNodeData(TNodeData, TNodeKey)

StartTransaction(string)

Begin a transaction, where the changes are held by a Transaction object in the UndoManager.

Declaration
bool StartTransaction(string tname)
Parameters
Type Name Description
string tname
Returns
Type Description
bool
See Also

ToIncrementalJson(ChangedEvent)

Produce a JSON-format string representing the changes in the most recent Transaction.

Declaration
string ToIncrementalJson(ChangedEvent e)
Parameters
Type Name Description
ChangedEvent e
Returns
Type Description
string
See Also

ToJson()

Generate a string representation of the persistent data in this model, in JSON format, that can be read in later with a call to FromJson<T>(string).

Declaration
string ToJson()
Returns
Type Description
string
See Also

Events

Changed

Register or unregister an event handler that is called when there is a ChangedEvent.

Declaration
event EventHandler<ChangedEvent> Changed
Event Type
Type Description
EventHandler<ChangedEvent>
See Also