<!-- saved from url=(0026)http://www.naturaldocs.org -->
<divid=Content><divclass="CClass"><divclass=CTopicid=MainTopic><h1class=CTitle><aname="mxStylesheet"></a>mxStylesheet</h1><divclass=CBody><p>Defines the appearance of the cells in a graph. See <ahref="#mxStylesheet.putCellStyle"class=LFunctionid=link11onMouseOver="ShowTip(event, 'tt9', 'link11')"onMouseOut="HideTip('tt9')">putCellStyle</a> for an example of creating a style.</p><h4class=CHeading>Default Styles</h4><p>The stylesheet contains two built-om styles, which are used if no style is defined for a cell:</p><tableborder=0cellspacing=0cellpadding=0class=CDescriptionList><tr><tdclass=CDLEntry>defaultVertex</td><tdclass=CDLDescription>Default style for vertices</td></tr><tr><tdclass=CDLEntry>defaultEdge</td><tdclass=CDLDescription>Default style for edges</td></tr></table><!--START_ND_SUMMARY--><divclass=Summary><divclass=STitle>Summary</div><divclass=SBorder><tableborder=0cellspacing=0cellpadding=0class=STable><trclass="SMain"><tdclass=SEntry><ahref="#mxStylesheet">mxStylesheet</a></td><tdclass=SDescription>Defines the appearance of the cells in a graph. </td></tr><trclass="SGroup SIndent1"><tdclass=SEntry><ahref="#mxStylesheet.Functions">Functions</a></td><tdclass=SDescription></td></tr><trclass="SFunction SIndent2 SMarked"><tdclass=SEntry><ahref="#mxStylesheet.styles"id=link1onMouseOver="ShowTip(event, 'tt1', 'link1')"onMouseOut="HideTip('tt1')">styles</a></td><tdclass=SDescription>Maps from names to styles.</td></tr><trclass="SFunction SIndent2"><tdclass=SEntry><ahref="#mxStylesheet.mxStylesheet"id=link2onMouseOver="ShowTip(event, 'tt2', 'link2')"onMouseOut="HideTip('tt2')">mxStylesheet</a></td><tdclass=SDescription>Constructs a new stylesheet and assigns default styles.</td></tr><trclass="SFunction SIndent2 SMarked"><tdclass=SEntry><ahref="#mxStylesheet.createDefaultVertexStyle"id=link3onMouseOver="ShowTip(event, 'tt3', 'link3')"onMouseOut="HideTip('tt3')">createDefaultVertexStyle</a></td><tdclass=SDescription>Creates and returns the default vertex style.</td></tr><trclass="SFunction SIndent2"><tdclass=SEntry><ahref="#mxStylesheet.createDefaultEdgeStyle"id=link4onMouseOver="ShowTip(event, 'tt4', 'link4')"onMouseOut="HideTip('tt4')">createDefaultEdgeStyle</a></td><tdclass=SDescription>Creates and returns the default edge style.</td></tr><trclass="SFunction SIndent2 SMarked"><tdclass=SEntry><ahref="#mxStylesheet.putDefaultVertexStyle"id=link5onMouseOver="ShowTip(event, 'tt5', 'link5')"onMouseOut="HideTip('tt5')">putDefaultVertexStyle</a></td><tdclass=SDescription>Sets the default style for vertices.</td></tr><trclass="SFunction SIndent2"><tdclass=SEntry><ahref="#mxStylesheet.putDefaultEdgeStyle"id=link6onMouseOver="ShowTip(event, 'tt6', 'link6')"onMouseOut="HideTip('tt6')">putDefaultEdgeStyle</a></td><tdclass=SDescription>Sets the default style for edges.</td></tr><trclass="SFunction SIndent2 SMarked"><tdclass=SEntry><ahref="#mxStylesheet.getDefaultVertexStyle"id=link7onMouseOver="ShowTip(event, 'tt7', 'link7')"onMouseOut="HideTip('tt7')">getDefaultVertexStyle</a></td><tdclass=SDescription>Returns the default style for vertices.</td></tr><trclass="SFunction SIndent2"><tdclass=SEntry><ahref="#mxStylesheet.getDefaultEdgeStyle"id=link8onMouseOver="ShowTip(event, 'tt8', 'link8')"onMouseOut="HideTip('tt8')">getDefaultEdgeStyle</a></td><tdclass=SDescription>Sets the default style for edges.</td></tr><trclass="SFunction SIndent2 SMarked"><tdclass=SEntry><ahref="#mxStylesheet.putCellStyle"id=link9onMouseOver="ShowTip(event, 'tt9', 'link9')"onMouseOut="HideTip('tt9')">putCellStyle</a></td><tdclass=SDescription>Stores the specified style under the given name.</td></tr><trclass="SFunction SIndent2"><tdclass=SEntry><ahref="#mxStylesheet.getCellStyle"id=link10onMouseOver="ShowTip(event, 'tt10', 'link10')"onMouseOut="HideTip('tt10')">getCellStyle</a></td><tdclass=SDescription>Returns the cell style for the specified cell or the given defaultStyle if no style can be found for the given stylename.</td></tr></table></di
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mxStylesheet.styles"></a>styles</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td>var $styles = array()</td></tr></table></blockquote><p>Maps from names to styles.</p></div></div></div>
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mxStylesheet.mxStylesheet"></a>mxStylesheet</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td>function mxStylesheet()</td></tr></table></blockquote><p>Constructs a new stylesheet and assigns default styles.</p></div></div></div>
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mxStylesheet.createDefaultVertexStyle"></a>createDefaultVertexStyle</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td>function createDefaultVertexStyle()</td></tr></table></blockquote><p>Creates and returns the default vertex style.</p></div></div></div>
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mxStylesheet.createDefaultEdgeStyle"></a>createDefaultEdgeStyle</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td>function createDefaultEdgeStyle()</td></tr></table></blockquote><p>Creates and returns the default edge style.</p></div></div></div>
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mxStylesheet.putDefaultVertexStyle"></a>putDefaultVertexStyle</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass=PBeforeParametersnowrap>function putDefaultVertexStyle(</td><tdclass=PParameternowrap>$style</td><tdclass=PAfterParametersnowrap>)</td></tr></table></td></tr></table></blockquote><p>Sets the default style for vertices.</p></div></div></div>
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mxStylesheet.putDefaultEdgeStyle"></a>putDefaultEdgeStyle</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass=PBeforeParametersnowrap>function putDefaultEdgeStyle(</td><tdclass=PParameternowrap>$style</td><tdclass=PAfterParametersnowrap>)</td></tr></table></td></tr></table></blockquote><p>Sets the default style for edges.</p></div></div></div>
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mxStylesheet.getDefaultVertexStyle"></a>getDefaultVertexStyle</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td>function getDefaultVertexStyle()</td></tr></table></blockquote><p>Returns the default style for vertices.</p></div></div></div>
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mxStylesheet.getDefaultEdgeStyle"></a>getDefaultEdgeStyle</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td>function getDefaultEdgeStyle()</td></tr></table></blockquote><p>Sets the default style for edges.</p></div></div></div>
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mxStylesheet.putCellStyle"></a>putCellStyle</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass=PBeforeParametersnowrap>function putCellStyle(</td><tdclass=PParameternowrap>$name,</td></tr><tr><td></td><tdclass=PParameternowrap>$style</td><tdclass=PAfterParametersnowrap>)</td></tr></table></td></tr></table></blockquote><p>Stores the specified style under the given name.</p><h4class=CHeading>Example</h4><p>The following example adds a new style (called ‘rounded’) into an existing stylesheet:</p><blockquote><preclass="prettyprint">var style = new Array();
graph.stylesheet.putCellStyle('rounded', style);</pre></blockquote><p>In the above example, the new style is an array. The possible keys of the array are all the constants in <ahref="../util/mxConstants-php.html#mxConstants"class=LClassid=link12onMouseOver="ShowTip(event, 'tt11', 'link12')"onMouseOut="HideTip('tt11')">mxConstants</a> that start with STYLE and the values are either JavaScript objects, such as <mxPerimeter.RightAngleRectanglePerimeter> (which is in fact a function) or expressions, such as ‘true’. Note that not all keys will be interpreted by all shapes (eg. the line shape ignores the fill color). The final call to this method associates the style with a name in the stylesheet. The style is used in a cell with the following code:</p><blockquote><preclass="prettyprint">model.setStyle(cell, 'rounded');</pre></blockquote><h4class=CHeading>Parameters</h4><tableborder=0cellspacing=0cellpadding=0class=CDescriptionList><tr><tdclass=CDLEntry>name</td><tdclass=CDLDescription>Name for the style to be stored.</td></tr><tr><tdclass=CDLEntry>style</td><tdclass=CDLDescription>Key, value pairs that define the style.</td></tr></table></div></div></div>
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mxStylesheet.getCellStyle"></a>getCellStyle</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass=PBeforeParametersnowrap>function getCellStyle(</td><tdclass=PParameternowrap>$name,</td><tdclass=PDefaultValuePrefix> </td><tdclass=PDefaultValuewidth=100%></td></tr><tr><td></td><tdclass=PParameternowrap>$defaultStyle</td><tdclass=PDefaultValuePrefix> = </td><tdclass=PDefaultValuewidth=100%> null</td><tdclass=PAfterParametersnowrap>)</td></tr></table></td></tr></table></blockquote><p>Returns the cell style for the specified cell or the given defaultStyle if no style can be found for the given stylename.</p><h4class=CHeading>Parameters</h4><tableborder=0cellspacing=0cellpadding=0class=CDescriptionList><tr><tdclass=CDLEntry>name</td><tdclass=CDLDescription>String of the form [(stylename|key=value);] that represents the style.</td></tr><tr><tdclass=CDLEntry>defaultStyle</td><tdclass=CDLDescription>Default style to be returned if no style can be found.</td></tr></table></div></div></div>
</div><!--Content-->
<divid=Footer><ahref="http://www.naturaldocs.org">Generated by Natural Docs</a></div><!--Footer-->
<divclass=CToolTipid="tt1"><divclass=CFunction><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td>var $styles = array()</td></tr></table></blockquote>Maps from names to styles.</div></div><divclass=CToolTipid="tt2"><divclass=CFunction><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td>function mxStylesheet()</td></tr></table></blockquote>Constructs a new stylesheet and assigns default styles.</div></div><divclass=CToolTipid="tt3"><divclass=CFunction><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td>function createDefaultVertexStyle()</td></tr></table></blockquote>Creates and returns the default vertex style.</div></div><divclass=CToolTipid="tt4"><divclass=CFunction><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td>function createDefaultEdgeStyle()</td></tr></table></blockquote>Creates and returns the default edge style.</div></div><divclass=CToolTipid="tt5"><divclass=CFunction><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass=PBeforeParametersnowrap>function putDefaultVertexStyle(</td><tdclass=PParameternowrap>$style</td><tdclass=PAfterParametersnowrap>)</td></tr></table></td></tr></table></blockquote>Sets the default style for vertices.</div></div><divclass=CToolTipid="tt6"><divclass=CFunction><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass=PBeforeParametersnowrap>function putDefaultEdgeStyle(</td><tdclass=PParameternowrap>$style</td><tdclass=PAfterParametersnowrap>)</td></tr></table></td></tr></table></blockquote>Sets the default style for edges.</div></div><divclass=CToolTipid="tt7"><divclass=CFunction><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td>function getDefaultVertexStyle()</td></tr></table></blockquote>Returns the default style for vertices.</div></div><divclass=CToolTipid="tt8"><divclass=CFunction><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td>function getDefaultEdgeStyle()</td></tr></table></blockquote>Sets the default style for edges.</div></div><divclass=CToolTipid="tt9"><divclass=CFunction><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass=PBeforeParametersnowrap>function putCellStyle(</td><tdclass=PParameternowrap>$name,</td></tr><tr><td></td><tdclass=PParameternowrap>$style</td><tdclass=PAfterParametersnowrap>)</td></tr></table></td></tr></table></blockquote>Stores the specified style under the given name.</div></div><divclass=CToolTipid="tt10"><divclass=CFunction><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass=PBeforeParametersnowrap>function getCellStyle(</td><tdclass=PParameternowrap>$name,</td><tdclass=PDefaultValuePrefix> </td><tdclass=PDefaultValuewidth=100%></td></tr><tr><td></td><tdclass=PParameternowrap>$defaultStyle</td><tdclass=PDefaultValuePrefix> = </td><tdclass=PDefaultValuewidth=100%> null</td><tdclass=PAfterParametersnowrap>)</td></tr></table></td></tr></table></blockquote>Returns the cell style for the specified cell or the given defaultStyle if no style can be found for the given stylename.</div></div><divclass=CToolTipid="tt11"><divclass=CClass>Defines global constants.</div></div><!--END_ND_TOOLTIPS-->