Codec for mxStylesheets. This class is created and registered dynamically at load time and used implicitely via mxCodec and the mxCodecRegistry.
| mxStylesheetCodec | Codec for mxStylesheets. |
| Functions | |
| encode | Encodes a stylesheet. |
| getStringValue | Returns the string for encoding the given value. |
| decode | Reads a sequence of the following child nodes and attributes: |
| Variables | |
| allowEval | Static global switch that specifies if the use of eval is allowed for evaluating text content. |
codec.encode = function( enc, obj )
Encodes a stylesheet. See decode for a description of the format.
codec.decode = function( dec, node, into )
Reads a sequence of the following child nodes and attributes:
| add | Adds a new style. |
| as | Name of the style. |
| extend | Name of the style to inherit from. |
Each node contains another sequence of add and remove nodes with the following attributes:
| as | Name of the style (see mxConstants). |
| value | Value for the style. |
Instead of the value-attribute, one can put Javascript expressions into the node as follows if mxStylesheetCodec.allowEval is true: <add as=”perimeter”>mxPerimeter.RectanglePerimeter</add>
A remove node will remove the entry with the name given in the as-attribute from the style.
<mxStylesheet as="stylesheet">
<add as="text">
<add as="fontSize" value="12"/>
</add>
<add as="defaultVertex" extend="text">
<add as="shape" value="rectangle"/>
</add>
</mxStylesheet>Encodes a stylesheet.
codec.encode = function( enc, obj )
Returns the string for encoding the given value.
codec.getStringValue = function( key, value )
Reads a sequence of the following child nodes and attributes:
codec.decode = function( dec, node, into )
Static global switch that specifies if the use of eval is allowed for evaluating text content.
mxStylesheetCodec.allowEval