src/main/java/com/mxgraph/io/mxRootChangeCodec.java
public Node beforeDecode(mxCodec dec, Node node, Object into)
	{
		if (into instanceof mxRootChange)
		{
			mxRootChange change = (mxRootChange) into;

			if (node.getFirstChild() != null
					&& node.getFirstChild().getNodeType() == Node.ELEMENT_NODE)
			{
				// Makes sure the original node isn't modified
				node = node.cloneNode(true);

				Node tmp = node.getFirstChild();
				change.setRoot(dec.decodeCell(tmp, false));

				Node tmp2 = tmp.getNextSibling();
				tmp.getParentNode().removeChild(tmp);
				tmp = tmp2;

				while (tmp != null)
				{
					tmp2 = tmp.getNextSibling();

					if (tmp.getNodeType() == Node.ELEMENT_NODE)
					{
						dec.decodeCell(tmp, true);
					}

					tmp.getParentNode().removeChild(tmp);
					tmp = tmp2;
				}
			}
		}

		return node;
	}
/**
	 * Reads the cells into the graph model. All cells are children of the root
	 * element in the node.
	 */
Reads the cells into the graph model. All cells are children of the root
element in the node.
Reads the cells into the graph model . All cells are children of the root element in the node .
public Node beforeDecode(mxCodec dec, Node node, Object into)
	{
		if (into instanceof mxRootChange)
		{
			mxRootChange change = (mxRootChange) into;
			if (node.getFirstChild() != null
					&& node.getFirstChild().getNodeType() == Node.ELEMENT_NODE)
			{
				node = node.cloneNode(true);
				Node tmp = node.getFirstChild();
				change.setRoot(dec.decodeCell(tmp, false));
				Node tmp2 = tmp.getNextSibling();
				tmp.getParentNode().removeChild(tmp);
				tmp = tmp2;
				while (tmp != null)
				{
					tmp2 = tmp.getNextSibling();
					if (tmp.getNodeType() == Node.ELEMENT_NODE)
					{
						dec.decodeCell(tmp, true);
					}
					tmp.getParentNode().removeChild(tmp);
					tmp = tmp2;
				}
			}
		}
		return node;
	}
public Node beforeDecode ( mxCodec dec , Node node , Object into ) { if ( into instanceof mxRootChange ) { mxRootChange change = ( mxRootChange ) into ; if ( node . getFirstChild ( ) != null && node . getFirstChild ( ) . getNodeType ( ) == Node . ELEMENT_NODE ) { node = node . cloneNode ( true ) ; Node tmp = node . getFirstChild ( ) ; change . setRoot ( dec . decodeCell ( tmp , false ) ) ; Node tmp2 = tmp . getNextSibling ( ) ; tmp . getParentNode ( ) . removeChild ( tmp ) ; tmp = tmp2 ; while ( tmp != null ) { tmp2 = tmp . getNextSibling ( ) ; if ( tmp . getNodeType ( ) == Node . ELEMENT_NODE ) { dec . decodeCell ( tmp , true ) ; } tmp . getParentNode ( ) . removeChild ( tmp ) ; tmp = tmp2 ; } } } return node ; }
Reads the cells into the graph model.
Reads the cells into the graph model .
// Makes sure the original node isn't modified