maxGraph/docs/php-api/files/io/mxCodec-php.html

79 lines
38 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>mxCodec</title><link rel="stylesheet" type="text/css" href="../../styles/main.css"><script language=JavaScript src="../../javascript/main.js"></script><script language=JavaScript src="../../javascript/prettify.js"></script><script language=JavaScript src="../../javascript/searchdata.js"></script></head><body class="ContentPage" onLoad="NDOnLoad();prettyPrint();"><script language=JavaScript><!--
if (browserType) {document.write("<div class=" + browserType + ">");if (browserVer) {document.write("<div class=" + browserVer + ">"); }}// --></script>
<!-- Generated by Natural Docs, version 1.51 -->
<!-- http://www.naturaldocs.org -->
<!-- saved from url=(0026)http://www.naturaldocs.org -->
<div id=Content><div class="CClass"><div class=CTopic id=MainTopic><h1 class=CTitle><a name="mxCodec"></a>mxCodec</h1><div class=CBody><p>XML codec for PHP object graphs.&nbsp; In order to resolve forward references when reading files the XML document that contains the data must be passed to the constructor.</p><!--START_ND_SUMMARY--><div class=Summary><div class=STitle>Summary</div><div class=SBorder><table border=0 cellspacing=0 cellpadding=0 class=STable><tr class="SMain"><td class=SEntry><a href="#mxCodec" >mxCodec</a></td><td class=SDescription>XML codec for PHP object graphs. </td></tr><tr class="SGroup SIndent1"><td class=SEntry><a href="#mxCodec.Variables" >Variables</a></td><td class=SDescription></td></tr><tr class="SVariable SIndent2 SMarked"><td class=SEntry><a href="#mxCodec.document" id=link1 onMouseOver="ShowTip(event, 'tt1', 'link1')" onMouseOut="HideTip('tt1')">document</a></td><td class=SDescription>The owner document of the codec.</td></tr><tr class="SVariable SIndent2"><td class=SEntry><a href="#mxCodec.objects" id=link2 onMouseOver="ShowTip(event, 'tt2', 'link2')" onMouseOut="HideTip('tt2')">objects</a></td><td class=SDescription>Maps from IDs to objects.</td></tr><tr class="SVariable SIndent2 SMarked"><td class=SEntry><a href="#mxCodec.elements" id=link3 onMouseOver="ShowTip(event, 'tt3', 'link3')" onMouseOut="HideTip('tt3')">elements</a></td><td class=SDescription>Maps from IDs to elements.</td></tr><tr class="SVariable SIndent2"><td class=SEntry><a href="#mxCodec.encodeDefaults" id=link4 onMouseOver="ShowTip(event, 'tt4', 'link4')" onMouseOut="HideTip('tt4')">encodeDefaults</a></td><td class=SDescription>Specifies if default values should be encoded. </td></tr><tr class="SGroup SIndent1"><td class=SEntry><a href="#mxCodec.Functions" >Functions</a></td><td class=SDescription></td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#mxCodec.mxGraphViewHtmlReader" >mxGraphViewHtmlReader</a></td><td class=SDescription>Constructs a new HTML graph view reader.</td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#mxCodec.putObject" id=link5 onMouseOver="ShowTip(event, 'tt5', 'link5')" onMouseOut="HideTip('tt5')">putObject</a></td><td class=SDescription>Assoiates the given object with the given ID.</td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#mxCodec.getObject" id=link6 onMouseOver="ShowTip(event, 'tt6', 'link6')" onMouseOut="HideTip('tt6')">getObject</a></td><td class=SDescription>Returns the decoded object for the element with the specified ID in <a href="#mxCodec.document" class=LVariable id=link7 onMouseOver="ShowTip(event, 'tt1', 'link7')" onMouseOut="HideTip('tt1')">document</a>. </td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#mxCodec.lookup" id=link8 onMouseOver="ShowTip(event, 'tt7', 'link8')" onMouseOut="HideTip('tt7')">lookup</a></td><td class=SDescription>Hook for subclassers to implement a custom lookup mechanism for cell IDs. </td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#mxCodec.getElementById" id=link9 onMouseOver="ShowTip(event, 'tt8', 'link9')" onMouseOut="HideTip('tt8')">getElementById</a></td><td class=SDescription>Returns the element with the given ID from <a href="#mxCodec.document" class=LVariable id=link10 onMouseOver="ShowTip(event, 'tt1', 'link10')" onMouseOut="HideTip('tt1')">document</a>.</td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#mxCodec.addElement" id=link11 onMouseOver="ShowTip(event, 'tt9', 'link11')" onMouseOut="HideTip('tt9')">addElement</a></td><td class=SDescription>Adds the given element to <a href="#mxCodec.elements" class=LVariable id=link12 onMouseOver="ShowTip(event, 'tt3', 'link12')" onMouseOut="HideTip('tt3')">elements</a> if it has an ID.</td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#mxCodec.getId" id=link13 onMouseOver="ShowTip(event, 'tt10', 'link13')" onMouseOut="HideTip('tt10')">getId</a></td><td class=SDescription>Returns the ID of the specified object. </td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#mxCodec.reference" id=link14 onMouseOver="ShowTip(event, 'tt11', 'link14')" onMouseOut="HideTip('tt11')">reference</a></td><td class=SDescription>Hook for subclassers to implement a custom method for retrieving IDs from objects. </td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#mxCodec.encode" id=link15 onMouseOver="ShowTip(event, 'tt12', 'link15')" onMouseOut="HideTip('tt12')">encode</a></td><td class=SDescription>Encodes the specified object and returns the resulting XML node.</td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#mxCodec.decode" id=link16 onMouseOver="ShowTip(event, 'tt13', 'link16')" onMouseOut="HideTip('tt13')">decode</a></td><td class=SDescription>Decodes the given XML node. </td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#mxCodec.encodeCell" id=link17 onMouseOver="ShowTip(event, 'tt14', 'link17')" onMouseOut="HideTip('tt14')">encodeCell</a></td><td class=SDescription>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. </td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#mxCodec.decodeCell" id=link18 onMouseOver="ShowTip(event, 'tt15', 'link18')" onMouseOut="HideTip('tt15')">decodeCell</a></td><td class=SDescription>Decodes cells that have been encoded using inversion, ie. </td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#mxCodec.insertIntoGraph" id=link19 onMouseOver="ShowTip(event, 'tt16', 'link19')" onMouseOut="HideTip('tt16')">insertIntoGraph</a></td><td class=SDescription>Inserts the given cell into its parent and terminal cells.</td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#mxCodec.setAttribute" id=link20 onMouseOver="ShowTip(event, 'tt17', 'link20')" onMouseOut="HideTip('tt17')">setAttribute</a></td><td class=SDescription>Sets the attribute on the specified node to value. </td></tr></table></div></div><!--END_ND_SUMMARY--></div></div></div>
<div class="CGroup"><div class=CTopic><h3 class=CTitle><a name="mxCodec.Variables"></a>Variables</h3></div></div>
<div class="CVariable"><div class=CTopic><h3 class=CTitle><a name="mxCodec.document"></a>document</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">var $document</td></tr></table></blockquote><p>The owner document of the codec.</p></div></div></div>
<div class="CVariable"><div class=CTopic><h3 class=CTitle><a name="mxCodec.objects"></a>objects</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">var $objects</td></tr></table></blockquote><p>Maps from IDs to objects.</p></div></div></div>
<div class="CVariable"><div class=CTopic><h3 class=CTitle><a name="mxCodec.elements"></a>elements</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">var $elements</td></tr></table></blockquote><p>Maps from IDs to elements.</p></div></div></div>
<div class="CVariable"><div class=CTopic><h3 class=CTitle><a name="mxCodec.encodeDefaults"></a>encodeDefaults</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">var $encodeDefaults</td></tr></table></blockquote><p>Specifies if default values should be encoded.&nbsp; Default is false.</p></div></div></div>
<div class="CGroup"><div class=CTopic><h3 class=CTitle><a name="mxCodec.Functions"></a>Functions</h3></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="mxCodec.mxGraphViewHtmlReader"></a>mxGraphViewHtmlReader</h3><div class=CBody><p>Constructs a new HTML graph view reader.</p></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="mxCodec.putObject"></a>putObject</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters prettyprint "nowrap>function putObject(</td><td class="PParameter prettyprint " nowrap>$id,</td></tr><tr><td></td><td class="PParameter prettyprint " nowrap>$object</td><td class="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>Assoiates the given object with the given ID.</p><p>Parameters</p><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>id</td><td class=CDLDescription>ID for the object to be associated with.</td></tr><tr><td class=CDLEntry>obj</td><td class=CDLDescription>Object to be associated with the ID.</td></tr></table></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="mxCodec.getObject"></a>getObject</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters prettyprint "nowrap>function getObject(</td><td class="PParameter prettyprint " nowrap>$id</td><td class="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>Returns the decoded object for the element with the specified ID in <a href="#mxCodec.document" class=LVariable id=link21 onMouseOver="ShowTip(event, 'tt1', 'link21')" onMouseOut="HideTip('tt1')">document</a>.&nbsp; If the object is not known then <a href="#mxCodec.lookup" class=LFunction id=link22 onMouseOver="ShowTip(event, 'tt7', 'link22')" onMouseOut="HideTip('tt7')">lookup</a> is used to find an object.&nbsp; If no object is found, then the element with the respective ID from the document is parsed using <a href="#mxCodec.decode" class=LFunction id=link23 onMouseOver="ShowTip(event, 'tt13', 'link23')" onMouseOut="HideTip('tt13')">decode</a>.</p></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="mxCodec.lookup"></a>lookup</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters prettyprint "nowrap>function lookup(</td><td class="PParameter prettyprint " nowrap>$id</td><td class="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>Hook for subclassers to implement a custom lookup mechanism for cell IDs.&nbsp; This implementation always returns null.</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>id</td><td class=CDLDescription>ID of the object to be returned.</td></tr></table></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="mxCodec.getElementById"></a>getElementById</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters prettyprint "nowrap>function getElementById(</td><td class="PParameter prettyprint " nowrap>$id</td><td class="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>Returns the element with the given ID from <a href="#mxCodec.document" class=LVariable id=link24 onMouseOver="ShowTip(event, 'tt1', 'link24')" onMouseOut="HideTip('tt1')">document</a>.</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>id</td><td class=CDLDescription>String that contains the ID.</td></tr></table></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="mxCodec.addElement"></a>addElement</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters prettyprint "nowrap>function addElement(</td><td class="PParameter prettyprint " nowrap>$node</td><td class="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>Adds the given element to <a href="#mxCodec.elements" class=LVariable id=link25 onMouseOver="ShowTip(event, 'tt3', 'link25')" onMouseOut="HideTip('tt3')">elements</a> if it has an ID.</p></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="mxCodec.getId"></a>getId</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters prettyprint "nowrap>function getId(</td><td class="PParameter prettyprint " nowrap>$obj</td><td class="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>Returns the ID of the specified object.&nbsp; This implementation calls <a href="#mxCodec.reference" class=LFunction id=link26 onMouseOver="ShowTip(event, 'tt11', 'link26')" onMouseOut="HideTip('tt11')">reference</a> first and if that returns null handles the object as an <a href="../model/mxCell-php.html#mxCell" class=LClass id=link27 onMouseOver="ShowTip(event, 'tt18', 'link27')" onMouseOut="HideTip('tt18')">mxCell</a> by returning their IDs using <a href="../model/mxCell-php.html#mxCell.getId" class=LFunction id=link28 onMouseOver="ShowTip(event, 'tt19', 'link28')" onMouseOut="HideTip('tt19')">mxCell.getId</a>.&nbsp; If no ID exists for the given cell, then an on-the-fly ID is generated using <a href="../model/mxCellPath-php.html#mxCellPath.create" class=LFunction id=link29 onMouseOver="ShowTip(event, 'tt20', 'link29')" onMouseOut="HideTip('tt20')">mxCellPath.create</a>.</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>obj</td><td class=CDLDescription>Object to return the ID for.</td></tr></table></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="mxCodec.reference"></a>reference</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters prettyprint "nowrap>function reference(</td><td class="PParameter prettyprint " nowrap>$obj</td><td class="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>Hook for subclassers to implement a custom method for retrieving IDs from objects.&nbsp; This implementation always returns null.</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>obj</td><td class=CDLDescription>Object whose ID should be returned.</td></tr></table></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="mxCodec.encode"></a>encode</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters prettyprint "nowrap>function encode(</td><td class="PParameter prettyprint " nowrap>$obj</td><td class="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>Encodes the specified object and returns the resulting XML node.</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>obj</td><td class=CDLDescription>Object to be encoded.</td></tr></table></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="mxCodec.decode"></a>decode</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters prettyprint "nowrap>function decode(</td><td class="PParameter prettyprint " nowrap>$node,</td><td class="PDefaultValuePrefix prettyprint ">&nbsp;&nbsp;</td><td class="PDefaultValue prettyprint " width=100%></td></tr><tr><td></td><td class="PParameter prettyprint " nowrap>$into</td><td class="PDefaultValuePrefix prettyprint ">&nbsp;=&nbsp;</td><td class="PDefaultValue prettyprint " width=100%> null</td><td class="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>Decodes the given XML node.&nbsp; The optional &ldquo;into&rdquo; argument specifies an existing object to be used.&nbsp; If no object is given, then a new instance is created using the constructor from the codec.</p><p>The function returns the passed in object or the new instance if no object was given.</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>node</td><td class=CDLDescription>XML node to be decoded.</td></tr><tr><td class=CDLEntry>into</td><td class=CDLDescription>Optional object to be decodec into.</td></tr></table></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="mxCodec.encodeCell"></a>encodeCell</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters prettyprint "nowrap>function encodeCell(</td><td class="PParameter prettyprint " nowrap>$cell,</td><td class="PDefaultValuePrefix prettyprint ">&nbsp;&nbsp;</td><td class="PDefaultValue prettyprint " width=100%></td></tr><tr><td></td><td class="PParameter prettyprint " nowrap>$node,</td><td class="PDefaultValuePrefix prettyprint ">&nbsp;&nbsp;</td><td class="PDefaultValue prettyprint " width=100%></td></tr><tr><td></td><td class="PParameter prettyprint " nowrap>$includeChildren</td><td class="PDefaultValuePrefix prettyprint ">&nbsp;=&nbsp;</td><td class="PDefaultValue prettyprint " width=100%>true</td><td class="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>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.&nbsp; <a href="mxModelCodec-php.html#mxModelCodec" class=LClass id=link30 onMouseOver="ShowTip(event, 'tt21', 'link30')" onMouseOut="HideTip('tt21')">mxModelCodec</a>, &lt;mxChildChangeCodec&gt; and &lt;mxRootChangeCodec&gt;).&nbsp; This implementation writes the given cell and its children as a (flat) sequence into the given node.&nbsp; The children are not encoded if the optional includeChildren is false.&nbsp; The function is in charge of adding the result into the given node and has no return value.</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>cell</td><td class=CDLDescription><a href="../model/mxCell-php.html#mxCell" class=LClass id=link31 onMouseOver="ShowTip(event, 'tt18', 'link31')" onMouseOut="HideTip('tt18')">mxCell</a> to be encoded.</td></tr><tr><td class=CDLEntry>node</td><td class=CDLDescription>Parent XML node to add the encoded cell into.</td></tr><tr><td class=CDLEntry>includeChildren</td><td class=CDLDescription>Optional boolean indicating if the function should include all descendents.&nbsp; Default is true.</td></tr></table></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="mxCodec.decodeCell"></a>decodeCell</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters prettyprint "nowrap>function decodeCell(</td><td class="PParameter prettyprint " nowrap>$node,</td><td class="PDefaultValuePrefix prettyprint ">&nbsp;&nbsp;</td><td class="PDefaultValue prettyprint " width=100%></td></tr><tr><td></td><td class="PParameter prettyprint " nowrap>$restoreStructures</td><td class="PDefaultValuePrefix prettyprint ">&nbsp;=&nbsp;</td><td class="PDefaultValue prettyprint " width=100%> true</td><td class="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>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.&nbsp; Returns a new <a href="../model/mxCell-php.html#mxCell" class=LClass id=link32 onMouseOver="ShowTip(event, 'tt18', 'link32')" onMouseOut="HideTip('tt18')">mxCell</a> instance that represents the given node.</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>node</td><td class=CDLDescription>XML node that contains the cell data.</td></tr><tr><td class=CDLEntry>restoreStructures</td><td class=CDLDescription>Optional boolean indicating whether the graph structure should be restored by calling insert and insertEdge on the parent and terminals, respectively.&nbsp; Default is true.</td></tr></table></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="mxCodec.insertIntoGraph"></a>insertIntoGraph</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters prettyprint "nowrap>function insertIntoGraph(</td><td class="PParameter prettyprint " nowrap>$cell</td><td class="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>Inserts the given cell into its parent and terminal cells.</p></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="mxCodec.setAttribute"></a>setAttribute</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters prettyprint "nowrap>function setAttribute(</td><td class="PParameter prettyprint " nowrap>$node,</td></tr><tr><td></td><td class="PParameter prettyprint " nowrap>$attribute,</td></tr><tr><td></td><td class="PParameter prettyprint " nowrap>$value</td><td class="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>Sets the attribute on the specified node to value.&nbsp; This is a helper method that makes sure the attribute and value arguments are not null.</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>node</td><td class=CDLDescription>XML node to set the attribute for.</td></tr><tr><td class=CDLEntry>attributes</td><td class=CDLDescription>Attributename to be set.</td></tr><tr><td class=CDLEntry>value</td><td class=CDLDescription>New value of the attribute.</td></tr></table></div></div></div>
</div><!--Content-->
<div id=Footer><a href="http://www.naturaldocs.org">Generated by Natural Docs</a></div><!--Footer-->
<div id=Menu><div class=MEntry><div class=MFile><a href="../index-txt.html">API Specification</a></div></div><div class=MEntry><div class=MFile><a href="../canvas/mxGdCanvas-php.html">canvas/<wbr>mxGdCanvas.php</a></div></div><div class=MEntry><div class=MGroup><a href="javascript:ToggleMenu('MGroupContent1')">Io</a><div class=MGroupContent id=MGroupContent1><div class=MEntry><div class=MFile><a href="mxCellCodec-php.html">mxCellCodec</a></div></div><div class=MEntry><div class=MFile id=MSelected>mxCodec</div></div><div class=MEntry><div class=MFile><a href="mxCodecRegistry-php.html">mxCodecRegistry</a></div></div><div class=MEntry><div class=MFile><a href="mxModelCodec-php.html">mxModelCodec</a></div></div><div class=MEntry><div class=MFile><a href="mxObjectCodec-php.html">mxObjectCodec</a></div></div><div class=MEntry><div class=MFile><a href="mxStylesheetCodec-php.html">mxStylesheetCodec</a></div></div></div></div></div><div class=MEntry><div class=MGroup><a href="javascript:ToggleMenu('MGroupContent2')">Model</a><div class=MGroupContent id=MGroupContent2><div class=MEntry><div class=MFile><a href="../model/mxCell-php.html">mxCell</a></div></div><div class=MEntry><div class=MFile><a href="../model/mxCellPath-php.html">mxCellPath</a></div></div><div class=MEntry><div class=MFile><a href="../model/mxGeometry-php.html">mxGeometry</a></div></div><div class=MEntry><div class=MFile><a href="../model/mxGraphModel-php.html">mxGraphModel</a></div></div></div></div></div><div class=MEntry><div class=MFile><a href="../reader/mxGraphViewHtmlReader-php.html">mxGraphViewHtmlReader</a></div></div><div class=MEntry><div class=MFile><a href="../reader/mxGraphViewImageReader-php.html">mxGraphViewImageReader</a></div></div><div class=MEntry><div class=MFile><a href="../canvas/mxHtmlCanvas-php.html">mxHtmlCanvas</a></div></div><div class=MEntry><div class=MGroup><a href="javascript:ToggleMenu('MGroupContent3')">Util</a><div class=MGroupContent id=MGroupContent3><div class=MEntry><div class=MFile><a href="../util/mxConstants-php.html">mxConstants</a></div></div><div class=MEntry><div class=MFile><a href="../util/mxEvent-php.html">mxEvent</a></div></div><div class=MEntry><div class=MFile><a href="../util/mxEventObject-php.html">mxEventObject</a></div></div><div class=MEntry><div class=MFile><a href="../util/mxEventSource-php.html">mxEventSource</a></div></div><div class=MEntry><div class=MFile><a href="../util/mxImageBundle-php.html">mxImageBundle</a></div></div><div class=MEntry><div class=MFile><a href="../util/mxLog-php.html">mxLog</a></div></div><div class=MEntry><div class=MFile><a href="../util/mxPoint-php.html">mxPoint</a></div></div><div class=MEntry><div class=MFile><a href="../util/mxRectangle-php.html">mxRectangle</a></div></div><div class=MEntry><div class=MFile><a href="../util/mxUtils-php.html">mxUtils</a></div></div></div></div></div><div class=MEntry><div class=MGroup><a href="javascript:ToggleMenu('MGroupContent4')">View</a><div class=MGroupContent id=MGroupContent4><div class=MEntry><div class=MFile><a href="../view/mxCellState-php.html">mxCellState</a></div></div><div class=MEntry><div class=MFile><a href="../view/mxConnectionConstraint-php.html">mxConnectionConstraint</a></div></div><div class=MEntry><div class=MFile><a href="../view/mxEdgeStyle-php.html">mxEdgeStyleFunction</a></div></div><div class=MEntry><div class=MFile><a href="../view/mxGraph-php.html">mxGraph</a></div></div><div class=MEntry><div class=MFile><a href="../view/mxGraphView-php.html">mxGraphView</a></div></div><div class=MEntry><div class=MFile><a href="../view/mxPerimeter-php.html">mxPerimeterFunction</a></div></div><div class=MEntry><div class=MFile><a href="../view/mxStyleRegistry-php.html">mxStyleRegistry</a></div></div><div class=MEntry><div class=MFile><a href="../view/mxStylesheet-php.html">mxStylesheet</a></div></div></div></div></div><div class=MEntry><div class=MGroup><a href="javascript:ToggleMenu('MGroupContent5')">Index</a><div class=MGroupContent id=MGroupContent5><div class=MEntry><div class=MIndex><a href="../../index/General.html">Everything</a></div></div><div class=MEntry><div class=MIndex><a href="../../index/Classes.html">Classes</a></div></div><div class=MEntry><div class=MIndex><a href="../../index/Files.html">Files</a></div></div><div class=MEntry><div class=MIndex><a href="../../index/Functions.html">Functions</a></div></div><div class=MEntry><div class=MIndex><a href="../../index/Interfaces.html">Interfaces</a></div></div><div class=MEntry><div class=MIndex><a href="../../index/Variables.html">Variables</a></div></div></div></div></div><script type="text/javascript"><!--
var searchPanel = new SearchPanel("searchPanel", "HTML", "../../search");
--></script><div id=MSearchPanel class=MSearchPanelInactive><input type=text id=MSearchField value=Search onFocus="searchPanel.OnSearchFieldFocus(true)" onBlur="searchPanel.OnSearchFieldFocus(false)" onKeyUp="searchPanel.OnSearchFieldChange()"><select id=MSearchType onFocus="searchPanel.OnSearchTypeFocus(true)" onBlur="searchPanel.OnSearchTypeFocus(false)" onChange="searchPanel.OnSearchTypeChange()"><option id=MSearchEverything selected value="General">Everything</option><option value="Classes">Classes</option><option value="Files">Files</option><option value="Functions">Functions</option><option value="Interfaces">Interfaces</option><option value="Variables">Variables</option></select></div><script language=JavaScript><!--
HideAllBut([1, 2, 3], 6);// --></script></div><!--Menu-->
<!--START_ND_TOOLTIPS-->
<div class=CToolTip id="tt1"><div class=CVariable><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">var $document</td></tr></table></blockquote>The owner document of the codec.</div></div><div class=CToolTip id="tt2"><div class=CVariable><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">var $objects</td></tr></table></blockquote>Maps from IDs to objects.</div></div><div class=CToolTip id="tt3"><div class=CVariable><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">var $elements</td></tr></table></blockquote>Maps from IDs to elements.</div></div><div class=CToolTip id="tt4"><div class=CVariable><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">var $encodeDefaults</td></tr></table></blockquote>Specifies if default values should be encoded. </div></div><div class=CToolTip id="tt5"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters prettyprint "nowrap>function putObject(</td><td class="PParameter prettyprint " nowrap>$id,</td></tr><tr><td></td><td class="PParameter prettyprint " nowrap>$object</td><td class="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>Assoiates the given object with the given ID.</div></div><div class=CToolTip id="tt6"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters prettyprint "nowrap>function getObject(</td><td class="PParameter prettyprint " nowrap>$id</td><td class="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>Returns the decoded object for the element with the specified ID in document. </div></div><div class=CToolTip id="tt7"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters prettyprint "nowrap>function lookup(</td><td class="PParameter prettyprint " nowrap>$id</td><td class="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>Hook for subclassers to implement a custom lookup mechanism for cell IDs. </div></div><div class=CToolTip id="tt8"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters prettyprint "nowrap>function getElementById(</td><td class="PParameter prettyprint " nowrap>$id</td><td class="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>Returns the element with the given ID from document.</div></div><div class=CToolTip id="tt9"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters prettyprint "nowrap>function addElement(</td><td class="PParameter prettyprint " nowrap>$node</td><td class="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>Adds the given element to elements if it has an ID.</div></div><div class=CToolTip id="tt10"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters prettyprint "nowrap>function getId(</td><td class="PParameter prettyprint " nowrap>$obj</td><td class="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>Returns the ID of the specified object. </div></div><div class=CToolTip id="tt11"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters prettyprint "nowrap>function reference(</td><td class="PParameter prettyprint " nowrap>$obj</td><td class="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>Hook for subclassers to implement a custom method for retrieving IDs from objects. </div></div><div class=CToolTip id="tt12"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters prettyprint "nowrap>function encode(</td><td class="PParameter prettyprint " nowrap>$obj</td><td class="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>Encodes the specified object and returns the resulting XML node.</div></div><div class=CToolTip id="tt13"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters prettyprint "nowrap>function decode(</td><td class="PParameter prettyprint " nowrap>$node,</td><td class="PDefaultValuePrefix prettyprint ">&nbsp;&nbsp;</td><td class="PDefaultValue prettyprint " width=100%></td></tr><tr><td></td><td class="PParameter prettyprint " nowrap>$into</td><td class="PDefaultValuePrefix prettyprint ">&nbsp;=&nbsp;</td><td class="PDefaultValue prettyprint " width=100%> null</td><td class="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>Decodes the given XML node. </div></div><div class=CToolTip id="tt14"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters prettyprint "nowrap>function encodeCell(</td><td class="PParameter prettyprint " nowrap>$cell,</td><td class="PDefaultValuePrefix prettyprint ">&nbsp;&nbsp;</td><td class="PDefaultValue prettyprint " width=100%></td></tr><tr><td></td><td class="PParameter prettyprint " nowrap>$node,</td><td class="PDefaultValuePrefix prettyprint ">&nbsp;&nbsp;</td><td class="PDefaultValue prettyprint " width=100%></td></tr><tr><td></td><td class="PParameter prettyprint " nowrap>$includeChildren</td><td class="PDefaultValuePrefix prettyprint ">&nbsp;=&nbsp;</td><td class="PDefaultValue prettyprint " width=100%>true</td><td class="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>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. </div></div><div class=CToolTip id="tt15"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters prettyprint "nowrap>function decodeCell(</td><td class="PParameter prettyprint " nowrap>$node,</td><td class="PDefaultValuePrefix prettyprint ">&nbsp;&nbsp;</td><td class="PDefaultValue prettyprint " width=100%></td></tr><tr><td></td><td class="PParameter prettyprint " nowrap>$restoreStructures</td><td class="PDefaultValuePrefix prettyprint ">&nbsp;=&nbsp;</td><td class="PDefaultValue prettyprint " width=100%> true</td><td class="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>Decodes cells that have been encoded using inversion, ie. </div></div><div class=CToolTip id="tt16"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters prettyprint "nowrap>function insertIntoGraph(</td><td class="PParameter prettyprint " nowrap>$cell</td><td class="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>Inserts the given cell into its parent and terminal cells.</div></div><div class=CToolTip id="tt17"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters prettyprint "nowrap>function setAttribute(</td><td class="PParameter prettyprint " nowrap>$node,</td></tr><tr><td></td><td class="PParameter prettyprint " nowrap>$attribute,</td></tr><tr><td></td><td class="PParameter prettyprint " nowrap>$value</td><td class="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>Sets the attribute on the specified node to value. </div></div><div class=CToolTip id="tt18"><div class=CClass>Cells are the elements of the graph model. </div></div><div class=CToolTip id="tt19"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">function getId()</td></tr></table></blockquote>Returns the Id of the cell as a string.</div></div><div class=CToolTip id="tt20"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters prettyprint "nowrap>static function create(</td><td class="PParameter prettyprint " nowrap>$cell</td><td class="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>Creates the cell path for the given cell. </div></div><div class=CToolTip id="tt21"><div class=CClass>Codec for mxGraphModels. </div></div><!--END_ND_TOOLTIPS-->
<div id=MSearchResultsWindow><iframe src="" frameborder=0 name=MSearchResults id=MSearchResults></iframe><a href="javascript:searchPanel.CloseResultsWindow()" id=MSearchResultsWindowClose>Close</a></div>
<script language=JavaScript><!--
if (browserType) {if (browserVer) {document.write("</div>"); }document.write("</div>");}// --></script></body></html>