mxGraph
|
XML codec for .NET object graphs. In order to resolve forward references when reading files the XML document that contains the data must be passed to the constructor. More...
Public Member Functions | |
mxCodec () | |
Constructs an XML encoder/decoder with a new owner document. More... | |
mxCodec (XmlDocument document) | |
Constructs an XML encoder/decoder for the specified owner document. The document is required to resolve forward ID references. This means if you parse a graphmodel that is represented in XML you must also pass the document that contains the XML to the constructor, otherwise forward references will not be resolved. More... | |
Object | PutObject (string id, Object obj) |
Assoiates the given object with the given ID. More... | |
Object | GetObject (string id) |
Returns the decoded object for the element with the specified ID in document. If the object is not known then lookup is used to find an object. If no object is found, then the element with the respective ID from the document is parsed using decode. More... | |
Object | Lookup (string id) |
Hook for subclassers to implement a custom lookup mechanism for cell IDs. This implementation always returns null. More... | |
XmlNode | GetElementById (string id) |
Returns the element with the given ID from the document. More... | |
string | GetId (Object obj) |
Returns the ID of the specified object. This implementation calls reference first and if that returns null handles the object as an mxCell by returning their IDs using mxCell.getId. If no ID exists for the given cell, then an on-the-fly ID is generated using mxCellPath.create. More... | |
string | Reference (Object obj) |
Hook for subclassers to implement a custom method for retrieving IDs from objects. This implementation always returns null. More... | |
XmlNode | Encode (Object obj) |
Encodes the specified object and returns the resulting XML node. More... | |
Object | Decode (XmlNode node) |
Decodes the given XML node using decode(XmlNode, Object). More... | |
Object | Decode (XmlNode node, Object into) |
Decodes the given XML node. The optional "into" argument specifies an existing object to be used. If no object is given, then a new instance is created using the constructor from the codec. The function returns the passed in object or the new instance if no object was given. More... | |
void | EncodeCell (mxICell cell, XmlNode node, bool includeChildren) |
Encoding of cell hierarchies is built-into the core, but is a higher-level function that needs to be explicitely used by the respective object encoders (eg. mxModelCodec, mxChildChangeCodec and mxRootChangeCodec). This implementation writes the given cell and its children as a (flat) sequence into the given node. The children are not encoded if the optional includeChildren is false. The function is in charge of adding the result into the given node and has no return value. More... | |
mxICell | DecodeCell (XmlNode node, bool restoreStructures) |
Decodes cells that have been encoded using inversion, ie. where the user object is the enclosing node in the XML, and restores the group and graph structure in the cells. Returns a new mxCell instance that represents the given node. More... | |
void | InsertIntoGraph (mxICell cell) |
Inserts the given cell into its parent and terminal cells. More... | |
Static Public Member Functions | |
static void | SetAttribute (XmlNode node, string attribute, Object value) |
Sets the attribute on the specified node to value. This is a helper method that makes sure the attribute and value arguments are not null. More... | |
Protected Member Functions | |
void | AddElement (XmlNode node) |
Adds the given element to <elements> if it has an ID. More... | |
Protected Attributes | |
XmlDocument | document |
Holds the owner document of the codec. More... | |
Dictionary< string, object > | objects = new Dictionary<string, Object>() |
Maps from IDs to objects. More... | |
Dictionary< string, XmlNode > | elements = null |
Maps from IDs to elements. More... | |
bool | encodeDefaults = false |
Specifies if default values should be encoded. Default is false. More... | |
Properties | |
XmlDocument | Document [get, set] |
Sets or returns the owner document of the codec. More... | |
bool | IsEncodeDefaults [get, set] |
Sets or returns if default values of member variables should be encoded. More... | |
Dictionary< string, object > | Objects [get] |
Returns the object lookup table. More... | |
XML codec for .NET object graphs. In order to resolve forward references when reading files the XML document that contains the data must be passed to the constructor.
|
inline |
Constructs an XML encoder/decoder with a new owner document.
|
inline |
Constructs an XML encoder/decoder for the specified owner document. The document is required to resolve forward ID references. This means if you parse a graphmodel that is represented in XML you must also pass the document that contains the XML to the constructor, otherwise forward references will not be resolved.
document | Optional XML document that contains the data. If no document is specified then a new document is created using mxUtils.createDocument |
|
inlineprotected |
Adds the given element to <elements> if it has an ID.
node | Node to be added. |
|
inline |
Decodes the given XML node using decode(XmlNode, Object).
node | XML node to be decoded. |
|
inline |
Decodes the given XML node. The optional "into" argument specifies an existing object to be used. If no object is given, then a new instance is created using the constructor from the codec. The function returns the passed in object or the new instance if no object was given.
node | XML node to be decoded. |
into | Optional object to be decodec into. |
|
inline |
Decodes cells that have been encoded using inversion, ie. where the user object is the enclosing node in the XML, and restores the group and graph structure in the cells. Returns a new mxCell instance that represents the given node.
node | XML node that contains the cell data. |
restoreStructures | Boolean indicating whether the graph structure should be restored by calling insert and insertEdge on the parent and terminals, respectively. |
References com.mxgraph.mxObjectCodec.Decode().
|
inline |
Encodes the specified object and returns the resulting XML node.
obj | Object to be encoded. |
|
inline |
Encoding of cell hierarchies is built-into the core, but is a higher-level function that needs to be explicitely used by the respective object encoders (eg. mxModelCodec, mxChildChangeCodec and mxRootChangeCodec). This implementation writes the given cell and its children as a (flat) sequence into the given node. The children are not encoded if the optional includeChildren is false. The function is in charge of adding the result into the given node and has no return value.
cell | mxCell to be encoded. |
node | Parent XML node to add the encoded cell into. |
includeChildren | Boolean indicating if the method should include all descendents |
References com.mxgraph.mxICell.GetChildAt().
|
inline |
Returns the element with the given ID from the document.
id | ID of the element to be returned. |
|
inline |
Returns the ID of the specified object. This implementation calls reference first and if that returns null handles the object as an mxCell by returning their IDs using mxCell.getId. If no ID exists for the given cell, then an on-the-fly ID is generated using mxCellPath.create.
obj | Object to return the ID for. |
|
inline |
Returns the decoded object for the element with the specified ID in document. If the object is not known then lookup is used to find an object. If no object is found, then the element with the respective ID from the document is parsed using decode.
id | ID of the object to be returned. |
|
inline |
Inserts the given cell into its parent and terminal cells.
cell |
|
inline |
Hook for subclassers to implement a custom lookup mechanism for cell IDs. This implementation always returns null.
id | ID of the object to be returned. |
|
inline |
Assoiates the given object with the given ID.
id | ID for the object to be associated with. |
obj | Object to be associated with the ID. |
|
inline |
Hook for subclassers to implement a custom method for retrieving IDs from objects. This implementation always returns null.
obj | Object whose ID should be returned. |
|
inlinestatic |
Sets the attribute on the specified node to value. This is a helper method that makes sure the attribute and value arguments are not null.
node | XML node to set the attribute for. |
attribute | Attributename to be set. |
value | New value of the attribute. |
|
protected |
Holds the owner document of the codec.
|
protected |
Maps from IDs to elements.
|
protected |
Specifies if default values should be encoded. Default is false.
|
protected |
Maps from IDs to objects.
|
getset |
Sets or returns the owner document of the codec.
|
getset |
Sets or returns if default values of member variables should be encoded.
Referenced by com.mxgraph.mxObjectCodec.EncodeValue().
|
get |
Returns the object lookup table.