<divid=Content><divclass="CClass"><divclass=CTopicid=MainTopic><h1class=CTitle><aname="mxStylesheetCodec"></a>mxStylesheetCodec</h1><divclass=CBody><p>Codec for <ahref="../view/mxStylesheet-js.html#mxStylesheet"class=LClassid=link6onMouseOver="ShowTip(event, 'tt1', 'link6')"onMouseOut="HideTip('tt1')">mxStylesheet</a>s. This class is created and registered dynamically at load time and used implicitely via <ahref="mxCodec-js.html#mxCodec"class=LClassid=link7onMouseOver="ShowTip(event, 'tt6', 'link7')"onMouseOut="HideTip('tt6')">mxCodec</a> and the <ahref="mxCodecRegistry-js.html#mxCodecRegistry"class=LClassid=link8onMouseOver="ShowTip(event, 'tt7', 'link8')"onMouseOut="HideTip('tt7')">mxCodecRegistry</a>.</p><!--START_ND_SUMMARY--><divclass=Summary><divclass=STitle>Summary</div><divclass=SBorder><tableborder=0cellspacing=0cellpadding=0class=STable><trclass="SMain"><tdclass=SEntry><ahref="#mxStylesheetCodec">mxStylesheetCodec</a></td><tdclass=SDescription>Codec for <ahref="../view/mxStylesheet-js.html#mxStylesheet"class=LClassid=link1onMouseOver="ShowTip(event, 'tt1', 'link1')"onMouseOut="HideTip('tt1')">mxStylesheet</a>s. </td></tr><trclass="SGroup SIndent1"><tdclass=SEntry><ahref="#mxStylesheetCodec.Functions">Functions</a></td><tdclass=SDescription></td></tr><trclass="SFunction SIndent2 SMarked"><tdclass=SEntry><ahref="#mxStylesheetCodec.encode"id=link2onMouseOver="ShowTip(event, 'tt2', 'link2')"onMouseOut="HideTip('tt2')">encode</a></td><tdclass=SDescription>Encodes a stylesheet. </td></tr><trclass="SFunction SIndent2"><tdclass=SEntry><ahref="#mxStylesheetCodec.getStringValue"id=link3onMouseOver="ShowTip(event, 'tt3', 'link3')"onMouseOut="HideTip('tt3')">getStringValue</a></td><tdclass=SDescription>Returns the string for encoding the given value.</td></tr><trclass="SFunction SIndent2 SMarked"><tdclass=SEntry><ahref="#mxStylesheetCodec.decode"id=link4onMouseOver="ShowTip(event, 'tt4', 'link4')"onMouseOut="HideTip('tt4')">decode</a></td><tdclass=SDescription>Reads a sequence of the following child nodes and attributes:</td></tr><trclass="SGroup SIndent1"><tdclass=SEntry><ahref="#mxStylesheetCodec.Variables">Variables</a></td><tdclass=SDescription></td></tr><trclass="SVariable SIndent2 SMarked"><tdclass=SEntry><ahref="#mxStylesheetCodec.allowEval"id=link5onMouseOver="ShowTip(event, 'tt5', 'link5')"onMouseOut="HideTip('tt5')">allowEval</a></td><tdclass=SDescription>Static global switch that specifies if the use of eval is allowed for evaluating text content. </td></tr></table></div></div><!--END_ND_SUMMARY--></div></div></div>
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mxStylesheetCodec.encode"></a>encode</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass=PBeforeParametersnowrap>codec.encode = function(</td><tdclass=PParameternowrap>enc,</td></tr><tr><td></td><tdclass=PParameternowrap>obj</td><tdclass=PAfterParametersnowrap>)</td></tr></table></td></tr></table></blockquote><p>Encodes a stylesheet. See <ahref="#mxStylesheetCodec.decode"class=LFunctionid=link9onMouseOver="ShowTip(event, 'tt4', 'link9')"onMouseOut="HideTip('tt4')">decode</a> for a description of the format.</p></div></div></div>
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mxStylesheetCodec.getStringValue"></a>getStringValue</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass=PBeforeParametersnowrap>codec.getStringValue = function(</td><tdclass=PParameternowrap>key,</td></tr><tr><td></td><tdclass=PParameternowrap>value</td><tdclass=PAfterParametersnowrap>)</td></tr></table></td></tr></table></blockquote><p>Returns the string for encoding the given value.</p></div></div></div>
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mxStylesheetCodec.decode"></a>decode</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass=PBeforeParametersnowrap>codec.decode = function(</td><tdclass=PParameternowrap>dec,</td></tr><tr><td></td><tdclass=PParameternowrap>node,</td></tr><tr><td></td><tdclass=PParameternowrap>into</td><tdclass=PAfterParametersnowrap>)</td></tr></table></td></tr></table></blockquote><p>Reads a sequence of the following child nodes and attributes:</p><h4class=CHeading>Child Nodes</h4><tableborder=0cellspacing=0cellpadding=0class=CDescriptionList><tr><tdclass=CDLEntry>add</td><tdclass=CDLDescription>Adds a new style.</td></tr></table><h4class=CHeading>Attributes</h4><tableborder=0cellspacing=0cellpadding=0class=CDescriptionList><tr><tdclass=CDLEntry>as</td><tdclass=CDLDescription>Name of the style.</td></tr><tr><tdclass=CDLEntry>extend</td><tdclass=CDLDescription>Name of the style to inherit from.</td></tr></table><p>Each node contains another sequence of add and remove nodes with the following attributes:</p><tableborder=0cellspacing=0cellpadding=0class=CDescriptionList><tr><tdclass=CDLEntry>as</td><tdclass=CDLDescription>Name of the style (see <ahref="../util/mxConstants-js.html#mxConstants"class=LClassid=link10onMouseOver="ShowTip(event, 'tt8', 'link10')"onMouseOut="HideTip('tt8')">mxConstants</a>).</td></tr><tr><tdclass=CDLEntry>value</td><tdclass=CDLDescription>Value for the style.</td></tr></table><p>Instead of the value-attribute, one can put Javascript expressions into the node as follows if <ahref="#mxStylesheetCodec.allowEval"class=LVariableid=link11onMouseOver="ShowTip(event, 'tt5', 'link11')"onMouseOut="HideTip('tt5')">mxStylesheetCodec.allowEval</a> is true: <add as=”perimeter”>mxPerimeter.RectanglePerimeter</add></p><p>A remove node will remove the entry with the name given in the as-attribute from the style.</p><h4class=CHeading>Example</h4><blockquote><preclass="prettyprint"><mxStylesheet as="stylesheet">
<divclass="CVariable"><divclass=CTopic><h3class=CTitle><aname="mxStylesheetCodec.allowEval"></a>allowEval</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td>mxStylesheetCodec.allowEval</td></tr></table></blockquote><p>Static global switch that specifies if the use of eval is allowed for evaluating text content. Default is true. Set this to false if stylesheets may contain user input.</p></div></div></div>
<divclass=CToolTipid="tt1"><divclass=CClass>Defines the appearance of the cells in a graph. </div></div><divclass=CToolTipid="tt2"><divclass=CFunction><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass=PBeforeParametersnowrap>codec.encode = function(</td><tdclass=PParameternowrap>enc,</td></tr><tr><td></td><tdclass=PParameternowrap>obj</td><tdclass=PAfterParametersnowrap>)</td></tr></table></td></tr></table></blockquote>Encodes a stylesheet. </div></div><divclass=CToolTipid="tt3"><divclass=CFunction><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass=PBeforeParametersnowrap>codec.getStringValue = function(</td><tdclass=PParameternowrap>key,</td></tr><tr><td></td><tdclass=PParameternowrap>value</td><tdclass=PAfterParametersnowrap>)</td></tr></table></td></tr></table></blockquote>Returns the string for encoding the given value.</div></div><divclass=CToolTipid="tt4"><divclass=CFunction><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass=PBeforeParametersnowrap>codec.decode = function(</td><tdclass=PParameternowrap>dec,</td></tr><tr><td></td><tdclass=PParameternowrap>node,</td></tr><tr><td></td><tdclass=PParameternowrap>into</td><tdclass=PAfterParametersnowrap>)</td></tr></table></td></tr></table></blockquote>Reads a sequence of the following child nodes and attributes:</div></div><divclass=CToolTipid="tt5"><divclass=CVariable><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td>mxStylesheetCodec.allowEval</td></tr></table></blockquote>Static global switch that specifies if the use of eval is allowed for evaluating text content. </div></div><divclass=CToolTipid="tt6"><divclass=CClass>XML codec for JavaScript object graphs. </div></div><divclass=CToolTipid="tt7"><divclass=CClass>Singleton class that acts as a global registry for codecs.</div></div><divclass=CToolTipid="tt8"><divclass=CClass>Defines various global constants.</div></div><!--END_ND_TOOLTIPS-->