com.mxgraph.io

## Class mxCellCodec

- java.lang.Object
- - com.mxgraph.io.mxObjectCodec
  - - com.mxgraph.io.mxCellCodec

-     public class mxCellCodec
      extends mxObjectCodec

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

- - ### Field Summary

    - ### Fields inherited from class com.mxgraph.io.mxObjectCodec

      `accessors, exclude, fields, idrefs, mapping, reverse, template`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `mxCellCodec()` Constructs a new cell codec.
    `mxCellCodec(java.lang.Object template)` Constructs a new cell codec for the given template.
    `mxCellCodec(java.lang.Object template, java.lang.String[] exclude, java.lang.String[] idrefs, java.util.Map<java.lang.String,java.lang.String> mapping)` Constructs a new cell codec for the given arguments.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `org.w3c.dom.Node` | `afterEncode(mxCodec enc, java.lang.Object obj, org.w3c.dom.Node node)` Encodes an mxCell and wraps the XML up inside the XML of the user object (inversion).
    `org.w3c.dom.Node` | `beforeDecode(mxCodec dec, org.w3c.dom.Node node, java.lang.Object obj)` Decodes an mxCell and uses the enclosing XML node as the user object for the cell (inversion).
    `boolean` | `isExcluded(java.lang.Object obj, java.lang.String attr, java.lang.Object value, boolean write)` Excludes user objects that are XML nodes.

    - ### Methods inherited from class com.mxgraph.io.mxObjectCodec

      `addObjectValue, afterDecode, beforeEncode, cloneTemplate, convertValueFromXml, convertValueToXml, decode, decode, decodeAttribute, decodeAttributes, decodeChild, decodeChildren, decodeNode, encode, encodeElements, encodeFields, encodeObject, encodeValue, getAccessor, getAttributeName, getField, getFieldName, getFieldTemplate, getFieldValue, getFieldValueWithAccessor, getMethod, getName, getTemplate, isPrimitiveValue, isReference, processInclude, setFieldValue, setFieldValueWithAccessor, writeAttribute, writeComplexAttribute, writePrimitiveAttribute`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### mxCellCodec

          public mxCellCodec()

      Constructs a new cell codec.

    - #### mxCellCodec

          public mxCellCodec(java.lang.Object template)

      Constructs a new cell codec for the given template.

    - #### mxCellCodec

          public mxCellCodec(java.lang.Object template,
                     java.lang.String[] exclude,
                     java.lang.String[] idrefs,
                     java.util.Map<java.lang.String,java.lang.String> mapping)

      Constructs a new cell codec for the given arguments.

  - ### Method Detail

    - #### isExcluded

          public boolean isExcluded(java.lang.Object obj,
                           java.lang.String attr,
                           java.lang.Object value,
                           boolean write)

      Excludes user objects that are XML nodes.
      Overrides:
        `isExcluded` in class `mxObjectCodec`
      Parameters:
        `obj` - Object instance that contains the field.
        `attr` - Fieldname of the field.
        `value` - Value of the field.
        `write` - Boolean indicating if the field is being encoded or decoded. write is true if the field is being encoded, else it is being decoded.
      Returns:
        Returns true if the given attribute should be ignored.

    - #### afterEncode

          public org.w3c.dom.Node afterEncode(mxCodec enc,
                                     java.lang.Object obj,
                                     org.w3c.dom.Node node)

      Encodes an mxCell and wraps the XML up inside the XML of the user object (inversion).
      Overrides:
        `afterEncode` in class `mxObjectCodec`
      Parameters:
        `enc` - Codec that controls the encoding process.
        `obj` - Object to be encoded.
        `node` - XML node that represents the default encoding.
      Returns:
        Returns the resulting node of the encoding.

    - #### beforeDecode

          public org.w3c.dom.Node beforeDecode(mxCodec dec,
                                      org.w3c.dom.Node node,
                                      java.lang.Object obj)

      Decodes an mxCell and uses the enclosing XML node as the user object for the cell (inversion).
      Overrides:
        `beforeDecode` in class `mxObjectCodec`
      Parameters:
        `dec` - Codec that controls the decoding process.
        `node` - XML node to be decoded.
        `obj` - Object to encode the node into.
      Returns:
        Returns the node used for the default decoding.

Copyright (c) 2010 Gaudenz Alder. All rights reserved.