mxGraph
Public Member Functions | List of all members
com.mxgraph.mxCellCodec Class Reference

Codec for mxCells. This class is created and registered dynamically at load time and used implicitely via mxCodec and the mxCodecRegistry. More...

Inheritance diagram for com.mxgraph.mxCellCodec:
com.mxgraph.mxObjectCodec

Public Member Functions

 mxCellCodec ()
 Constructs a new cell codec. More...
 
 mxCellCodec (Object template)
 Constructs a new cell codec for the given template. More...
 
 mxCellCodec (Object template, string[] exclude, string[] idrefs, Dictionary< string, string > mapping)
 Constructs a new cell codec for the given arguments. More...
 
override bool IsExcluded (Object obj, string attr, Object value, bool isWrite)
 Excludes user objects that are XML nodes. More...
 
override XmlNode AfterEncode (mxCodec enc, Object obj, XmlNode node)
 Encodes an mxCell and wraps the XML up inside the XML of the user object (inversion). More...
 
override XmlNode BeforeDecode (mxCodec dec, XmlNode node, Object obj)
 Decodes an mxCell and uses the enclosing XML node as the user object for the cell (inversion). More...
 
- Public Member Functions inherited from com.mxgraph.mxObjectCodec
 mxObjectCodec (Object template)
 Constructs a new codec for the specified template object. More...
 
 mxObjectCodec (Object template, string[] exclude, string[] idrefs, Dictionary< string, string > mapping)
 Constructs a new codec for the specified template object. The variables in the optional exclude array are ignored by the codec. Variables in the optional idrefs array are turned into references in the XML. The optional mapping may be used to map from variable names to XML attributes. More...
 
string GetName ()
 Returns the name used for the nodenames and lookup of the codec when classes are encoded and nodes are decoded. For classes to work with this the codec registry automatically adds an alias for the classname if that is different than what this returns. The default implementation returns the classname of the template class. More...
 
virtual bool IsReference (Object obj, string attr, Object value, bool write)
 Returns true if the given fieldname is to be treated as a textual reference (ID). This implementation returns true if the given fieldname is in idrefs. More...
 
virtual XmlNode Encode (mxCodec enc, Object obj)
 Encodes the specified object and returns a node representing then given object. Calls beforeEncode after creating the node and afterEncode with the resulting node after processing. Enc is a reference to the calling encoder. It is used to encode complex objects and create references. More...
 
virtual Object BeforeEncode (mxCodec enc, Object obj, XmlNode node)
 Hook for subclassers to pre-process the object before encoding. This returns the input object. The return value of this function is used in encode to perform the default encoding into the given node. More...
 
virtual Object Decode (mxCodec dec, XmlNode node)
 Parses the given node into the object or returns a new object representing the given node. More...
 
virtual Object Decode (mxCodec dec, XmlNode node, Object into)
 Parses the given node into the object or returns a new object representing the given node. Dec is a reference to the calling decoder. It is used to decode complex objects and resolve references. If a node has an id attribute then the object cache is checked for the object. If the object is not yet in the cache then it is constructed using the constructor of template and cached in mxCodec.objects. This implementation decodes all attributes and childs of a node according to the following rules: More...
 
bool ProcessInclude (mxCodec dec, XmlNode node, Object into)
 
virtual Object AfterDecode (mxCodec dec, XmlNode node, Object obj)
 Hook for subclassers to Receive-process the object after decoding. This implementation returns the given object without any changes. The return value of this method is returned to the decoder from decode. More...
 

Additional Inherited Members

- Protected Member Functions inherited from com.mxgraph.mxObjectCodec
virtual Object CloneTemplate (XmlNode node)
 Returns a new instance of the template object for representing the given node. More...
 
virtual void EncodeObject (mxCodec enc, Object obj, XmlNode node)
 Encodes the value of each member in then given obj into the given node using encodeFields and encodeElements. More...
 
void EncodeFields (mxCodec enc, Object obj, XmlNode node)
 Encodes the members of the given object into the given node. More...
 
void EncodeElements (mxCodec enc, Object obj, XmlNode node)
 Encodes the child objects of arrays, dictionaries and enumerables. More...
 
void EncodeValue (mxCodec enc, Object obj, string fieldname, Object value, XmlNode node)
 Converts the given value according to the mappings and id-refs in this codec and uses writeAttribute to write the attribute into the given node. More...
 
bool IsPrimitiveValue (Object value)
 Returns true if the given object is a primitive value. More...
 
void WriteAttribute (mxCodec enc, Object obj, string attr, Object value, XmlNode node)
 Writes the given value into node using writePrimitiveAttribute or writeComplexAttribute depending on the type of the value.
 
void WritePrimitiveAttribute (mxCodec enc, Object obj, string attr, Object value, XmlNode node)
 Writes the given value as an attribute of the given node. More...
 
void WriteComplexAttribute (mxCodec enc, Object obj, string attr, Object value, XmlNode node)
 Writes the given value as a child node of the given node. More...
 
virtual Object ConvertValueToXml (Object value)
 Converts true to "1" and false to "0". All other values are ignored. More...
 
virtual Object ConvertValueFromXml (Type type, Object value)
 Converts XML attribute values to object of the given type. More...
 
string GetAttributeName (string fieldname)
 Returns the XML node attribute name for the given C# field name. That is, it returns the mapping of the field name. More...
 
string GetFieldName (string attributename)
 Returns the C# field name for the given XML attribute name. That is, it returns the reverse mapping of the attribute name. More...
 
Object GetFieldValue (Object obj, string name)
 Returns the value of the field with the specified name in the specified object instance. More...
 
void SetFieldValue (Object obj, string name, Object value)
 Sets the value of the field with the specified name in the specified object instance. More...
 
void DecodeNode (mxCodec dec, XmlNode node, Object obj)
 Calls decodeAttributes and decodeChildren for the given node. More...
 
void DecodeAttributes (mxCodec dec, XmlNode node, Object obj)
 Decodes all attributes of the given node using decodeAttribute. More...
 
void DecodeAttribute (mxCodec dec, XmlNode attr, Object obj)
 Reads the given attribute into the specified object. More...
 
void DecodeChildren (mxCodec dec, XmlNode node, Object obj)
 Reads the given attribute into the specified object. More...
 
void DecodeChild (mxCodec dec, XmlNode child, Object obj)
 Reads the specified child into the given object. More...
 
Object GetFieldTemplate (Object obj, String fieldname, XmlNode child)
 Returns the template instance for the given field. This returns the value of the field, null if the value is an array or an empty collection if the value is a collection. The value is then used to populate the field for a new instance. For strongly typed languages it may be required to override this to return the correct collection instance based on the encoded child. More...
 
void AddObjectValue (Object obj, String fieldname, Object value, Object template)
 Sets the decoded child node as a value of the given object. If the object is a map, then the value is added with the given fieldname as a key. If the fieldname is not empty, then setFieldValue is called or else, if the object is a collection, the value is added to the collection. For strongly typed languages it may be required to override this with the correct code to add an entry to an object. More...
 
- Protected Attributes inherited from com.mxgraph.mxObjectCodec
Object template
 Holds the template object associated with this codec. More...
 
List< string > exclude
 Array containing the variable names that should be ignored by the codec. More...
 
List< string > idrefs
 Array containing the variable names that should be turned into or converted from references. See mxCodec.getId and mxCodec.getObject. More...
 
Dictionary< string, string > mapping
 Maps from from fieldnames to XML attribute names. More...
 
Dictionary< string, string > reverse
 Maps from from XML attribute names to fieldnames. More...
 
- Properties inherited from com.mxgraph.mxObjectCodec
Object Template [get]
 Returns the template object associated with this codec. More...
 

Detailed Description

Codec for mxCells. This class is created and registered dynamically at load time and used implicitely via mxCodec and the mxCodecRegistry.

Constructor & Destructor Documentation

com.mxgraph.mxCellCodec.mxCellCodec ( )
inline

Constructs a new cell codec.

com.mxgraph.mxCellCodec.mxCellCodec ( Object  template)
inline

Constructs a new cell codec for the given template.

com.mxgraph.mxCellCodec.mxCellCodec ( Object  template,
string[]  exclude,
string[]  idrefs,
Dictionary< string, string >  mapping 
)
inline

Constructs a new cell codec for the given arguments.

Member Function Documentation

override XmlNode com.mxgraph.mxCellCodec.AfterEncode ( mxCodec  enc,
Object  obj,
XmlNode  node 
)
inlinevirtual

Encodes an mxCell and wraps the XML up inside the XML of the user object (inversion).

Reimplemented from com.mxgraph.mxObjectCodec.

References com.mxgraph.mxCodec.Document.

override XmlNode com.mxgraph.mxCellCodec.BeforeDecode ( mxCodec  dec,
XmlNode  node,
Object  obj 
)
inlinevirtual

Decodes an mxCell and uses the enclosing XML node as the user object for the cell (inversion).

Reimplemented from com.mxgraph.mxObjectCodec.

References com.mxgraph.mxObjectCodec.Decode(), com.mxgraph.mxCodecRegistry.GetCodec(), com.mxgraph.mxCodec.GetElementById(), com.mxgraph.mxCodec.Lookup(), and com.mxgraph.mxCodec.Objects.

override bool com.mxgraph.mxCellCodec.IsExcluded ( Object  obj,
string  attr,
Object  value,
bool  isWrite 
)
inlinevirtual

Excludes user objects that are XML nodes.

Reimplemented from com.mxgraph.mxObjectCodec.


The documentation for this class was generated from the following file: